[PHP] Re: permission denied
Hi Anthony! Have you tried giving the full path of 'data.txt' to fopen? Like this: $file = fopen(d:\\inetpub\\www.blahblah.org\\formtest.php, a+); Is it you or your ISP that uses win98? Kindly /Lars Olsson ([EMAIL PROTECTED]) Anthony Ritter wrote: Using MS Win98 / php 4: Any ideas on how I can change my permssion settings on a file called data.txt so it can be read to and written to or do I have to take that up with my ISP. I get the following after I submit a form: Warning: fopen(data.txt, a+) - Permission denied in d:\inetpub\www.blahblah.org\formtest.php on line 80 Your submission was not processed. Thank you for your time and help. TR -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: problems to get image informations form local harddrive usinggetimagesize
Hi! It could be a permission problem. What OS are you using? Win98? Win2000? WinXP? Kindly /Lars Olsson ([EMAIL PROTECTED]) Harald Mohring wrote: isn't it possible to get image informations from the local harddrive? $fotoinfo=getimagesize(C:\\Files\\Temp\\Image.jpg); if i use that code, the errormessage is always Unable to access c:\Files\Temp\Image.jpg getimagesize: unable to open file for reading got anybody a solution? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: imap_open failure
Hi! Shouldn't it be: $pop_inbox = imap_open({$mailserver:110/pop3}INBOX, $login, $password); (as on http://www.php.net/manual/en/function.imap-open.php) Kindly /Lars Olsson ([EMAIL PROTECTED]) Jeff Schwartz wrote: I'm using imap_open in PHP 4.3.0 to successfully access every pop server I've tried - except 1: mail.fea.net. I know the mail server, port, login, and password are correct because I can successfully log into the pop server with both telnet and Outlook. Here's the code: if ($pop_inbox = imap_open({.$mailserver./$mailbox_type:$port/notls},$login,$password)): I've tried every variation of the code, such as using notls or not. In any event, I know the code works because I can log into every other pop server I've tried. imap_last_error() returns: Can not authenticate to POP3 server Has anyone else run into this? Is there a way to see more about the interaction between imap_open and the pop server? Jeff - Do you Yahoo!? Yahoo! Mail Plus - Powerful. Affordable. Sign up now -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Amount of data in the database
A pretty easy way of doing it is to add a size field to the table. Whenever you INSERT INTO or UPDATE the table, update this field to contain the size of the data for the current record. Then, whenever you need to check the amount of data for a particular user, just use this query: SELECT SUM(size) FROM sometable WHERE user=someuser Hope this helps /Lars Olsson ([EMAIL PROTECTED]) PS. Ive done this in a file upload script I created a while ago. If you want, I can mail you the relevant bits and bytes. DS. Denis L. Menezes wrote: Hello friends. I have a need for checking how much data(in kb) exists of each of the user members in the MySQL so that when they upload more data I can restrict/warn them of the amount of data they have on the server at present. can anyone please tell me how to check the amount of data on the mysql for each record? thanks very much Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Amount of data in the database
Hello again! Basically...you can't. What I meant was that when you insert the data into the table, you need to store the size as well. Consider the following table (called files): dataID user filename size filedata [int, autoincremented] [int] [varchar] [int] [blob] Now, let's say user 3 uploads the file 'airplane.jpg' to the server. We need to have the following information: $filename = The name of the file $filedata = The actual file $size = The size of the uploaded file You can find out about how to get these variables from http://www.php.net/manual/en/features.file-upload.php Then you insert the data into your table; INSERT INTO files(user, filename, size, filedata) VALUES (3, $filename, $size, $filedata) This means that every time some user upload a file, the size of the file will be tied to a particular record. Then you just use MySQLs built-in SUM function to find out the total amount of data (check my previous post) Kindly /Lars Olsson ([EMAIL PROTECTED]) Denis L. Menezes wrote: Thanks Lars. Sorry, then I have another question. How do I find the size of the record? Thanks Denis -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] attachment problem
Hi all! I'm writing a webmail application in PHP and most basic things are working now. However, I've recently run into a problem concerning mail attachments. This is the situation right now: When the user opens a letter there are links to all attachments. The links looks like this: http://www.lassoweb.nu/webmail/attachment.php/mailbox=INBOXmsguid=218part=2 Mailbox is the mailbox name, msguid is the message number and part corresponds to the part of the letter that is an attachment. When the user clicks the link the attachment data is extracted from the message and displayed in the browser (if possible). This works nice, but here comes the problem. Since the document is named 'attachment.php', that's the name that comes up in the save box whenever the user tries to save the file. Iv'e tried setting the Content-Disposition header to tell the browser what to call the attachment, but to no avail. The browser still insists on calling all attachments 'attachment.php'! I've been trying to figure this out for a couple of days now, but no luck yet. Perhaps someone out there have had the same problem (and solved it)? I'm thankful for any hints /Lars 'lasso' Olsson ([EMAIL PROTECTED]) PS. One solution might be to 'trick' the browser by creating a fake URL (like http://www.lassoweb.nu/webmail/void/bob.gif), but in order for this to work I need to tell Apache to send all requests to the 'void' directory to a single PHP file. Anyone knows how to set this up? DS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attachment problem
Yes, I've tried using the Content-Disposition header. It doesn't seem to work...here are the relevant parts of my code: snip // Change Content-Type so that it matches the MIME-type of the part header('Content-Type: ' . $type . '/' . $subtype); // Check if there is a name for the part if (isset($name)) { header('Content-Disposition: inline; filename=' . $name); } else { header('Content-Disposition: inline'); } /snip I've tried printing $type, $subtype and $name and they all contain correct values...still no luck. As per your suggestion I tried using wget -S to check the headers. Here are the results: C:\WINDOWS\Profiles\Lasso\Skrivbordetwget -S --spider http://localhost/webmail/ attachment.php?mailbox=INBOXmsguid=279part=2 --21:59:30-- http://localhost/webmail/attachment.php?mailbox=INBOXmsguid=279p art=2 = `attachment.php@mailbox=INBOXmsguid=279part=2' Resolving localhost... done. Connecting to localhost[127.0.0.1]:80... connected. HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK 2 Date: Mon, 13 Jan 2003 20:59:39 GMT 3 Server: Apache/1.3.27 (Win32) PHP/4.2.3 4 X-Powered-By: PHP/4.2.3 5 Set-Cookie: PHPSESSID=12ab68cb5cd7355b2a63b9007bda0221; path=/ 6 Expires: Thu, 19 Nov 1981 08:52:00 GMT 7 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 8 Pragma: no-cache 9 Keep-Alive: timeout=15, max=100 10 Connection: Keep-Alive 11 Content-Type: text/html 200 OK I'm VERY confused about line 11! The type (for this particular request) should be image/bmp (Mozillas Page Info tab confirms this). Still, wget claims it is text/html...hm...strange...now what? /Lars Olsson ([EMAIL PROTECTED]) Timothy Hitchens ) wrote: So you have tried as per the manual: header(Content-Disposition: attachment; filename=downloaded.pdf); I use this all the time without issue.. do you have a shell that you can use to wget -S and see if the correct headers are coming out?? Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attachment problem
It doesn't matter whether I choose 'inline' or 'attachment', browser doesn't seem to care...but at least I found out why wget -S got me text/html instead of image/bmp. I had some session variables that messed things up, but I hacked it a bit and now wget -S is giving me the following headers: C:\WINDOWS\Profiles\Lasso\Skrivbordetwget -S --spider http://localhost/webmail/ attachment.php?mailbox=INBOXmsguid=279part=2 --00:19:19-- http://localhost/webmail/attachment.php?mailbox=INBOXmsguid=279p art=2 = `attachment.php@mailbox=INBOXmsguid=279part=2' Resolving localhost... done. Connecting to localhost[127.0.0.1]:80... connected. HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK 2 Date: Mon, 13 Jan 2003 23:19:27 GMT 3 Server: Apache/1.3.27 (Win32) PHP/4.2.3 4 X-Powered-By: PHP/4.2.3 5 Set-Cookie: PHPSESSID=e4025c8fb31d0de0b04c7aa0e3afc676; path=/ 6 Expires: Thu, 19 Nov 1981 08:52:00 GMT 7 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 8 Pragma: no-cache 9 Content-Disposition: inline; filename=tomtefan.bmp 10 Keep-Alive: timeout=15, max=100 11 Connection: Keep-Alive 12 Content-Type: image/bmp 200 OK The Content-Type seems ok, and so does the Content-Disposition. Browser still suggests 'attachment.php' whenever I choose File-Save As... Strange happenings indeed... /Lars ([EMAIL PROTECTED]) Timothy Hitchens (HiTCHO) wrote: What happens when you change the inline to attachment?? Also does this page have any errors in it... eg parsing ones that are causing PHP to take over the headers and error out?? Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] attachment problem
Well, I'll be damned...don't know why, but suddenly everything seems to work! Guess some little gnome inside my computer finally decided it was time for me to get some sleep... Many thanx for for your help, Timothy! /Lars ([EMAIL PROTECTED]) Lars Olsson wrote: It doesn't matter whether I choose 'inline' or 'attachment', browser doesn't seem to care...but at least I found out why wget -S got me text/html instead of image/bmp. I had some session variables that messed things up, but I hacked it a bit and now wget -S is giving me the following headers: C:\WINDOWS\Profiles\Lasso\Skrivbordetwget -S --spider http://localhost/webmail/ attachment.php?mailbox=INBOXmsguid=279part=2 --00:19:19-- http://localhost/webmail/attachment.php?mailbox=INBOXmsguid=279p art=2 = `attachment.php@mailbox=INBOXmsguid=279part=2' Resolving localhost... done. Connecting to localhost[127.0.0.1]:80... connected. HTTP request sent, awaiting response... 1 HTTP/1.1 200 OK 2 Date: Mon, 13 Jan 2003 23:19:27 GMT 3 Server: Apache/1.3.27 (Win32) PHP/4.2.3 4 X-Powered-By: PHP/4.2.3 5 Set-Cookie: PHPSESSID=e4025c8fb31d0de0b04c7aa0e3afc676; path=/ 6 Expires: Thu, 19 Nov 1981 08:52:00 GMT 7 Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0 8 Pragma: no-cache 9 Content-Disposition: inline; filename=tomtefan.bmp 10 Keep-Alive: timeout=15, max=100 11 Connection: Keep-Alive 12 Content-Type: image/bmp 200 OK The Content-Type seems ok, and so does the Content-Disposition. Browser still suggests 'attachment.php' whenever I choose File-Save As... Strange happenings indeed... /Lars ([EMAIL PROTECTED]) Timothy Hitchens (HiTCHO) wrote: What happens when you change the inline to attachment?? Also does this page have any errors in it... eg parsing ones that are causing PHP to take over the headers and error out?? Timothy Hitchens (HiTCHO) Open Platform Consulting e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Querying two tables
Hi! To fetch information from several tables you usually use a join operation. Here's a starting point in the MySQL manual. http://www.mysql.com/doc/en/JOIN.html /Lars ([EMAIL PROTECTED]) Cesar Aracena wrote: Hi all, I have several tables from which I have to fetch certain products categories based on customer selection. The tables are as follows: Table 1 - Categories catid (autonum) catname Table 2 - Sub categories subcatid (autonum) subcatname Table 3 - Products prodid (autonum) prodname Table 4 - Relationships Catid Subcatid Prodid Now, the question is how to fetch all the sub-categories let's say that are related to category 0001. I know it's as simple as relating two tables in one query, but I don't remember how. Any help appreciated. Cesar L. Aracena [EMAIL PROTECTED] [EMAIL PROTECTED] (0299) 156-356688 Neuquén (8300) Capital Argentina -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP native session
Hi! There are several ways. You could use a database or a text file. If your server comes with dba support, I'd try that. Manual reference http://www.php.net/manual/en/ref.dba.php /lasso ([EMAIL PROTECTED]) Mattia wrote: I'm looking for a way to have a list of the users logged in my site (with a session_start() ). Is it possible to do it with the php4 api? thanks Mattia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Problem with output buffering in PHP 4.0.6 and Apache/1.3.20
Ing.Martin prek wrote: Hi.. I have found a strange problem. I try to use php output buffering, but I found this problem. Working with small amount of data everything is fine. But If I set example script like this: ? function callback($buffer) { return do_something_with($buffer); } ob_start(callback) . . do_something_that_produce_big_output() // more than 1.5 MB . . . ob_end_flush(); ? Everything works fine when $buffer approx 1.5 Mb, but if the size of the output, that need to be bufered exceeded some strange limit aprox 1593400 bytes, buffer is cut to that length and rest of the output is lost(!). I look in docs and manuals, but found nothing about it. Is it posssible to set large size for the output buffering operations or this strange limit is hard coded and cant be exceeded ??? I try to play with PHP.INI or add swapspace and DIMs memory with no effect. Please help. --- Odchoz zprva neobsahuje viry. Zkontrolovno antivirovm systmem AVG (http://www.grisoft.cz). Verze: 6.0.381 / Virov bze: 214 - datum vydn: 2.8.2002 Hi! I don't think that should be considered a problem for PHP output buffering. Du you know ANY user that would that would wait for a 1.5MB page to display? And if you're transferring large binary files to the browser (a LARGE bitmap for example) you could get around this problem by doing 1. Open the file 2. Read a reasonable amount of data (say, 10 bytes) 3. use ob_flush to sende the data to the browser 4. Repeat step 2 and 3 until all of file is read 5. Use ob_end_flush to send the rest of the buffer 6. Close the file Hope this helps /lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Using ini_set with session.gc_maxlifetime
Neil Innes wrote: I've got a site on a server where I can't change the php.ini setting for session.gc_maxlifetime, which is set at the default 1440 seconds. My client wants to entend the time to an hour. The only way I am aware of how to do this kind of thing is through ini_set. However, the documentation says there are a number of configuration options which you can set using ini_set, but which don't work as expected because the options are already in effect before the script runs. Is session.gc_maxlifetime one of those options? After all, ini_set is only supposed to be in effect for the duration of the script, which is not going to work if the whole point of sessions is to allow information to be preserved between pages (scripts). So, can ini_set be used to set session.gc_maxlifetime in any meaningful way, and if not, is there another way to do it? Ta, Neil Innes _ Send and receive Hotmail on your mobile device: http://mobile.msn.com What kind of server do you use? On Apache, you can specify session.gc_maxlifetime in an .htaccess file (provided that Apache allowes overrides). On IIS I don't know if there's a way... Kindly /lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: FILEMTIME
Mike Zagorski wrote: Hello, I amusing the following PHP code.. but I want to make it so that it also displays the time in 24 hr mode and the time is +3600 seconds. (1 hour) ? $last_modified = filemtime(about.php); print(Last Updated ); print(date(m/j/Y, $last_modified)); ? How can I do this? Thanks Mike Check out http://www.php.net/gmdate (for the timezone offset) and http://www.php.net/date (for the date formatting). /lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP multipart form data
Mike Dunlop wrote: hello, i have php 4.2.2 compiled with --enable-ftp running (as a module in apache under red-hat 6.2) and I can not get file uploads through a web page to work!?!? The form variable $userfile (which is the file input name) is returning false; Any ideas how to troubleshoot this? Check your php.ini. Look for register_globals. Check if this is set to off (which is the default for 4.2.2). If it's off, you need to use $_GET['userfile'], $_POST['userfile'] or $_FILES['userfile'] (depending on the METHOD and ENCODING attributes of the FORM tag. This has been discussed numerous times on the list, so you shouldn't have any trouble finding more info about it... This is a good starting point in the manual: http://www.php.net/manual/en/language.variables.predefined.php Kindly /lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: what is equivalent to Response.End ?
Hi! try exit() (http://www.php.net/exit) or die() (http://www.php.net/die) Kindly /lasso ([EMAIL PROTECTED]) Ing. Rajesh Kumar wrote: Hi everybody Can someone tell me what is the PHP equivalent code to ASP's Response.End ? I want to stop my code at a given position so i need this. thanks in advance Raja -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Undefined Index
Hi! JüRgen wrote: It's me again, i don't mean to be a bugger, but i really like to learn as much as possible, that's why i ask (or will ask so many questions). Consider the following (i shortened this a lot, but it will do the trick) $op = $_GET['op']; switch ( $op ) { case admin: DoLogin(); break; default: ShowHomepage(); break; } PHP shoots a Notice Message telling me that there is an undefined index Undefined index: act in g:\apache_web\intern\looney\index.php on line 177 You get this error message whenever $_GET doesn't contain anything. This accects the code shown above. Ok, am i correct in assuming that it pops this message because $op is not defined as anything yet? If so,should i always just do this $_POST['op'] = ''; $op = $_GET['op']; switch ( $op ) { //Code here } Or would it be better and more space efficient to do this $op = isset($_GET['op']); switch ( $op ) { //Code here } Cause if i do that the Notice Message dissapears for some reason i yet fail to grab. This doesn't work since the result of isset($_GET['op']) is either true or false, not a string value. You need to write it like this: if (isset($_GET['op']) { $op = $_GET['op']; switch ($op) { //Code here } } I would really appreciate if somebody could explain to me why the Notice dissapears when using isset(), and also what is the best method to use rather then the two shown above? How do you guysgirls handle this? Thanks a lot in advance for your time and patience! Best regards from Vienna, Jürgen Hope this helps! /lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Function search utility
It still works...try http://www.php.net/mysql or http://www.php.net/fopen for example... /lasso ([EMAIL PROTECTED]) Brian V Bonini wrote: There used to be a utility that let you search php functions from the address bar in your browser by simply appening PHP to the function name eg, php mail I thikn it might of been an IE only thing... I can't remember were I originally got it form and can not find it again, does anyone know? -Brian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] calculating psysical path (a first try)
Hi list! Something I use quite often when programming in ASP is the Server.MapPath method. This method expects a virtual path (on the web server) and returns the corresponding psysical path. I haven't seen this anywhere in PHP, so I've hacked my own little routine to do this (see below). But I still have two questions: a) Is there perhaps a built-in function I can use instead? I browsed through the manual quite a lot, but I haven't found quite like this. b) If there isn't a built-in function, perhaps you could help me make my function better? It seems I use a lot of code for this TINY problem... Here's the function: snip // This function calculates the physical path for a given virtual path. function map_path($virtual_path) { // Deklarera necessary variables as global global $HTTP_SERVER_VARS; // Find out where this file is located in the psysical file system $script_filename = $HTTP_SERVER_VARS[SCRIPT_FILENAME]; // Find out where this file is located in the virtual file system $script_name = $HTTP_SERVER_VARS[SCRIPT_NAME]; // Calculate which folder in the psysical filesystem that corresponds // to the root folder in the virtual filesystem $psychical_root = substr($script_filename, 0, strlen($script_filename) - strlen($script_name)); // Calculate which folder in the psysical filesystem that corresponds // to the given folder in the virtual filesystem $psychical_path = $psychical_root . $virtual_path; return $psychical_path; } /snip Kindly /Lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: MySQL password()
To my knowledge it isn't possible to decrypt the PASSWORD function in MySQL (you need to use MySQL ENCRYPT/DECRYPT for that). However, it's possible to use PASSWORD on the user-provided string too. You could try the following code: $query=SELECT * FROM users where username='$PHP_AUTH_USER' AND passwd=PASSWORD('$PHP_AUTH_PW'); $result = mysql_query($query) or die(Couldn't execute query!); if (mysql_num_rows($result) 0) { // user exists } else { // user don't exist } Kindly /lasso ([EMAIL PROTECTED]) Liam Mackenzie wrote: Hi all, I do this: dbconnect(); $query=SELECT * FROM users where username='$PHP_AUTH_USER'; $result=mysql_query($query); $list=mysql_fetch_array($result); if ($PHP_AUTH_PW !== $list[passwd] || == $PHP_AUTH_PW || all != $list[domain]){ Header(WWW-authenticate: basic realm=\EMM\); Header( HTTP/1.0 401 Unauthorized); unauthorized(); exit; } } Noe this bit: if ($PHP_AUTH_PW !== $list[passwd] My problem is that the password stored in MySQL was done with password(), so it comes out similar to this as plain text: 072g307j9236a82h3u How do I Un password() it? I have RTFM but to no avail. If you tell me to RTFM again, at least tell me what to search for ;-) Cheers, Liam -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] A somewhat unusual session question...
Hi all! The manual claims here (http://se2.php.net/manual/en/ref.session.php) that: /snip ...If session.save_path's path depth is more than 2, garbage collection will not be performed. /snip Anyone know why this is the case? And can you get around it? My scripts currently lives on a shered server and I wanted to get away from using /tmp (which is the default). I changed the session_save path in my .htaccess file to: /home/httpd/vhosts/mydomainname/httpdocs/sessions/ and created some sessions. The creation and destruction of sessions works fine as long as the user logs out correctly, but PHP fails to garbage collect sessions when the user just quits the browser. I've tried changing the session.gc_probability to 100 (and waited until session.gc_maxlifetime had passed), but it still doesn't work. Now I'm stuck with a bunch of deserted session files that don't seem to go away. Any ideas on how to solve this? /Lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A somewhat unusual session question...
I'm aware that the server cannot know whenever a user just quits without logging out, but I was under the impression that the flags session.gc_maxlifetime and session.gc_probability in php.ini would control when and how often leftover session files would be removed. If this isn't true, what are these flags actually used for? Pretty confusing if you ask me... /lasso Scott Fletcher wrote: The session.save_path have nothing to do with it. I have that same problem with the default path, /tmp when the session became a garbage collection when the user quit the browser without logging off. When the user quit the browser then there's no way for the server to know that, so the session stuffs stay active in the session.save_path. You will have to either manually clean it up weekly or use crontab to do the clean up for you at night-time with the time-range the website is off-limit to the user. This is where people do the maintaince also. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: A somewhat unusual session question...
Hm...seems it works after all...Tried extremely short session.gc_maxlifetime and a 100% session.gc_probability...works like a charm! Sorry for not checking this thoroughly enough before whining... ;) /lasso ([EMAIL PROTECTED]) Lars Olsson wrote: Hi all! The manual claims here (http://se2.php.net/manual/en/ref.session.php) that: /snip ...If session.save_path's path depth is more than 2, garbage collection will not be performed. /snip Anyone know why this is the case? And can you get around it? My scripts currently lives on a shered server and I wanted to get away from using /tmp (which is the default). I changed the session_save path in my .htaccess file to: /home/httpd/vhosts/mydomainname/httpdocs/sessions/ and created some sessions. The creation and destruction of sessions works fine as long as the user logs out correctly, but PHP fails to garbage collect sessions when the user just quits the browser. I've tried changing the session.gc_probability to 100 (and waited until session.gc_maxlifetime had passed), but it still doesn't work. Now I'm stuck with a bunch of deserted session files that don't seem to go away. Any ideas on how to solve this? /Lasso ([EMAIL PROTECTED]) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Dynamic Web Pages
Hi! Database queries and global variables are not related to each other. It usually just boils down to the following steps 1. Collect data that that's needed for the database query (via $_GET or $_POST) 2. Run the query against the database and store the results in some nice variables (arrays/strings depending on data) 3. Display the results within the page by printing the variables at appropiate places inside your template file (test.php). Obviously the possibilities are endless, but if you want a starting point you could try the following link: http://www.php.net/manual/en/ref.mysql.php (check under Examples) Kindly /lasso ([EMAIL PROTECTED]) Rolando Morales wrote: I would like to have the same page (test.php) have different text in it depending on a database entry. which is easy enough. but I want it to be on the fly. example list would be created on the fly depending on databse entries. which ever entry was picked (lets say STLT) it would open up my template test.php and it would but the STLT info on the page. Is there a way to do this without turning on Global_Variables which come standard off in php4.2.2 I'm using apache 2.0.39, PHP4.2.2, FreeBSD4.6, Mysql3.23.51 My database entries would be deparmentpageartical template stlt1body of page test.php aps 1body of page test.php srp 1body of page test2.php main 1body of page test.php the list would be created by a query that looks for all page 1 entries from there the main page would show up(default), but once you pick from the list it would show the database enteries for that department. |---|--- |main | |STLT | STLT was picked show STLT artical database entry |aps | this is are STLT page |srp | | | |---|--- |---|--- |main | |stlt | APS was picked show APS artical database entry |APS | this is are APS page |srp | | | |---|--- I assume that Gobal_Variables are off for a reason. Rolando -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Is it possible...
No. Since PHP is executed on the server, the only thing that is sent to the browser is pure HTML (and client-sided scripts like JavaScript). This means you cannot just get the source code of a PHP page by just browsing it. /lasso ([EMAIL PROTECTED]) Apollo wrote: Is it possible download php scripts from webpages ? for example i need php.net scripts or others :-) If yes, how ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: PHP Security Advisory: Vulnerability in PHP versions4.2.0
The correct path for the windows binary version is http://www.php.net/do_download.php?download_file=php-4.2.2-Win32.zip /lasso ([EMAIL PROTECTED]) Rouvas Stathis wrote: Hi all, Just wanting to notify everyone that the link for the PHP.4.2.2 download is broken. -Stathis. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Preventing Multiple Log-Ins after Authentication
I agree. Using a database is usually a good way of storing session information. But as noted by Dennis below, automatic logout may require additional scripts running in the background. This is a bit inferior in PHP compared to ASP. In ASP, support for automatic session destruction is implemented by having a magic function (called Session_End) which will be called automagically by the web server whenever a session expires. Having this in PHP would be very nice too! /lasso ([EMAIL PROTECTED]) Dennis Moore wrote: If you do not want to use cookes and use SID or trans SID; Another method is to track your logins via a database. This can be resource intensive though.You need to update the database upon each click or have an empty window refresh every 1-5 minutes. If there is no activity for 15 or 30 minutes automatically log the person off in the database. This requires a process to run in cron or a separate background program. The advantage of this is that is very easy to add time based accounting to the session management system. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Create Thumbnail from Blob online
Well, if you're just going to show your image (no resizing or other image operations) you don't need to use gd at all. You could just change the Content-Type and print. snippet header(Content-Type: $mimetype); print($imagedata); /snippet /lasso ([EMAIL PROTECTED]) Tommi Trinkaus wrote: Hi, i stored some jpegs in an mysql-database (one field for data, one for type) and i'm able to download them and to show them in an img tag. But wat i want is to use the stored data to create a thumbnail to show it within the browser without creating a file - how can i pass the mysql-blob directly to a gd-function like imagecreate() or imagejpg() ?? (gd-library is working well) thank you for any answer, tommi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: ' giving problem while inserting in table.
Since ' is a string delimiter in MySQL it has to be escaped. Try using mysql_escape_string($string) (http://se.php.net/manual/en/function.mysql-escape-string.php) on all the strings before you try to insert them into MySQL. /lasso ([EMAIL PROTECTED]) Anil Garg wrote: Hi, I am making a faq maintenance system using mysql and php. To insert a entry in to a faq table i am using the following query: - INSERT INTO faq_table_netvd (id,question, answer,netvcr,netdetector,add_date,mod_date,keyword,category,display,attach_ id) VALUES ('0','$frm[question]', '$frm[answer]','$frm[netvcr]','$frm[netdetector]','$frm[add_date]','$frm[mod _date]','$frm[keyword]','$frm[category]','$frm[display]','$frm[attach_id]') ); --- now the problem is when $frm[question] has some string like: why i can't eat. i get the following error: MySQL Error: You have an error in your SQL syntax near 't eat?' ,answer = 'Please recheck the power of your specs:)' ' at line 3.Putting a '\' before ' (e.g. \')solves my problem...but when i open the same quesion to edit it, again i have to put backslashes where ever i find ' in the quesion or answer. Can anyone please suggest a solution to this. thanx and regards anil [please ask if i havent explained the problem fully] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] session_start and HTTP headers in Mozilla, plz help
Hi! I've run across a problem when using session_start and HTTP headers in Mozilla. I'm trying to write a snippet of code that checks whether a user has logged in or not. If the user has a session variable set I want to display the page and if he or she hasn't I want to give them a 403 Forbidden header. My current code looks like this: [top of page] ?php // Start session handling session_start(); // Check login if (isset($HTTP_SESSION_VARS[xyz]) and $HTTP_SESSION_VARS[xyz] == yes) { ? html [page contents] /html ?php } else { header(HTTP/1.0 403 Forbidden); } ? [end of page] This works perfectly in IE 6 (I get a 403 Error Message) but in Mozilla I just get an empty page (containing just the html and head tags). Most other headers seem to work though. If I use header(Location: somepage.php) both Mozilla and IE correctly redirects the browser. I don't know if it's a bug in IE or Mozilla or if I'm plain stupid, but perhaps someone else has experienced this and are willing to give me a hint? Thanks /lasso -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php