RE: [PHP] PHP/Apache security question
of course that's possible... it's not default, but it's very possible i think it's an apache module called suEXEC that will run the script with the script owner's name.group, not apache.apache -Original Message- From: [EMAIL PROTECTED] Subject: [PHP] PHP/Apache security question Is there anything anyone can do about this? of course it would be ideal if php would inherit uid/gid from the script file instead of the server ownership but I think there is no way to accomplish this, so this is why I am clueless. Oh, one more thingie: I have this CGI script here: #!/usr/bin/php htmlhead. etc etc I try to access it and the security warning! page appears. The documentation sais that it's ok to use such CGI scripts, and warns the user about the security threat of using the php binary as a CGI. Obviously I am not using the php binary as a CGI, rather I am creating a CGI script that's interpreted using the php binary, so what seems to be the problem here? Thx a lot, georgeb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP/Apache security question
if the script is running as user scott group scott, then it can only alter/read/execute files that the user scott has access to... nothing else. of course, if you have user scott, group users, and have user tom in group users, then any files that have the group read/write/exec permissions set could possibly be vulnerable to other user's scripts. -Original Message- From: Aaron Bennett [mailto:[EMAIL PROTECTED]] Subject: RE: [PHP] PHP/Apache security question Does anyone know if SuExec plays friendly with PHP? From my recollection, when using suexec, it only alters the current UID/GID for scripts executed by httpd. Does PHP get treated the same way as would say a perl cgi script? I've looked a little at how phpwebhosting.com does it, and they set each user to their own unique primary group, and are (i believe) using suexec in their apache config setting each VirtualHost with their respective user and group... But does that really 'secure' everyone's code from other equally privileged users? :-? -- Aaron Bennett [EMAIL PROTECTED] -Original Message- From: ..s.c.o.t.t.. [mailto:[EMAIL PROTECTED]] Sent: Saturday, July 07, 2001 4:33 PM To: Php-General Subject: RE: [PHP] PHP/Apache security question of course that's possible... it's not default, but it's very possible i think it's an apache module called suEXEC that will run the script with the script owner's name.group, not apache.apache -Original Message- From: [EMAIL PROTECTED] Subject: [PHP] PHP/Apache security question Is there anything anyone can do about this? of course it would be ideal if php would inherit uid/gid from the script file instead of the server ownership but I think there is no way to accomplish this, so this is why I am clueless. Oh, one more thingie: I have this CGI script here: #!/usr/bin/php htmlhead. etc etc I try to access it and the security warning! page appears. The documentation sais that it's ok to use such CGI scripts, and warns the user about the security threat of using the php binary as a CGI. Obviously I am not using the php binary as a CGI, rather I am creating a CGI script that's interpreted using the php binary, so what seems to be the problem here? Thx a lot, georgeb -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: changing to a different file in browser
put Location before the URL: header(Location: http://server.com/file.php;); or header(Location: ./file.php); -Original Message- From: Brad Wright [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 05, 2001 18:54 To: PHP General List Subject: Re: [PHP] Re: changing to a different file in browser ihave tried the header() function as Julio suggested. But I get an error message in the browser. I am also using session variables in all these pages (only 2). My code : if (!mysql_numrows($result) ) { die ( username/password not valid); } else{ header(Menu.php); } the error message in IE: Warning: Cannot add header information - headers already sent by (output started at /home/e-smith/files/ibays/bigpool1/html/login.php:1) in /home/e-smith/files/ibays/bigpool1/html/login.php on line 1 Thanks in advance, brad From: Inércia Sensorial [EMAIL PROTECTED] Date: Thu, 5 Jul 2001 22:26:24 -0300 To: [EMAIL PROTECTED] Subject: [PHP] Re: changing to a different file in browser header (http://www.example.com;); // Goes to example.com. -- Julio Nobrega. A hora está chegando: http://sourceforge.net/projects/toca Brad Wright [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I know this is probably the most stupid question you'll see on this list for a while, but anyway, In an 'if..else' statement, I want to (if a condition is met) change to a totally new php page in the browser window. I know this is simple (in fact i had it working last night but have now forgotten how i did it). ie (no the following is NOT actual PHPsheesh :) If a=1 go to required_page.php else do nothing Thanks in advance, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Re: changing to a different file in browser
even a blank line at the end of a file that you're include()ing will break header. you could use output buffering, but i dont think you really want to go to all that trouble for a simple redirect :) -Original Message- From: Chris Anderson [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 05, 2001 19:47 To: Brad Wright; PHP General List Subject: Re: [PHP] Re: changing to a different file in browser If you use Header after ANY page output, even a space, it will not work - Original Message - From: Brad Wright [EMAIL PROTECTED] To: PHP General List [EMAIL PROTECTED] Sent: Thursday, July 05, 2001 10:25 PM Subject: Re: [PHP] Re: changing to a different file in browser tried it, but it didn't work... still getting the same message in IE. Am I missing something? Can I actually use the headr() function to redirect to a different page while using sesions and session variables?? From: ..s.c.o.t.t.. [EMAIL PROTECTED] Date: Thu, 5 Jul 2001 22:32:22 -0700 To: Php-General [EMAIL PROTECTED] Subject: RE: [PHP] Re: changing to a different file in browser put Location before the URL: header(Location: http://server.com/file.php;); or header(Location: ./file.php); -Original Message- From: Brad Wright [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 05, 2001 18:54 To: PHP General List Subject: Re: [PHP] Re: changing to a different file in browser ihave tried the header() function as Julio suggested. But I get an error message in the browser. I am also using session variables in all these pages (only 2). My code : if (!mysql_numrows($result) ) { die ( username/password not valid); } else{ header(Menu.php); } the error message in IE: Warning: Cannot add header information - headers already sent by (output started at /home/e-smith/files/ibays/bigpool1/html/login.php:1) in /home/e-smith/files/ibays/bigpool1/html/login.php on line 1 Thanks in advance, brad From: Inércia Sensorial [EMAIL PROTECTED] Date: Thu, 5 Jul 2001 22:26:24 -0300 To: [EMAIL PROTECTED] Subject: [PHP] Re: changing to a different file in browser header (http://www.example.com;); // Goes to example.com. -- Julio Nobrega. A hora está chegando: http://sourceforge.net/projects/toca Brad Wright [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi all, I know this is probably the most stupid question you'll see on this list for a while, but anyway, In an 'if..else' statement, I want to (if a condition is met) change to a totally new php page in the browser window. I know this is simple (in fact i had it working last night but have now forgotten how i did it). ie (no the following is NOT actual PHPsheesh :) If a=1 go to required_page.php else do nothing Thanks in advance, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Submiting Data with an '
or you could roll your own function db_quote($data) { $data = preg_replace(/'/, '', $data); return $data; } -Original Message- From: ReDucTor [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 05, 2001 19:54 To: Chris Anderson Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Submiting Data with an ' addslashes() php.net/addslashes - Original Message - From: Chris Anderson [EMAIL PROTECTED] To: Matthew Loff [EMAIL PROTECTED]; 'Mike Mike' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Friday, July 06, 2001 12:45 PM Subject: Re: [PHP] Submiting Data with an ' On the same subject, can I make it automatically addslahes to my variables? Or should I just make my own mysql class? - Original Message - From: Matthew Loff [EMAIL PROTECTED] To: 'Mike Mike' [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Thursday, July 05, 2001 3:29 PM Subject: RE: [PHP] Submiting Data with an ' Use the addslashes() call to automatically escape characters like that. MySQL will not add the slashes into the table cell, so no need to stripslashes() after you SELECT it back out. -Original Message- From: Mike Mike [mailto:[EMAIL PROTECTED]] Sent: Thursday, July 05, 2001 3:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Submiting Data with an ' Hello everyone, I'm having a problem of submiting an ' into a mysql database. When I have a ' it doesn't update or submit the data. but if I use \' it works fine. Does anyone know of a way around this. Thanks --Mike __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] error_log not obeyed
does the directory exist? does php or apache have the right to create new files in /var/www/logs/? if the file exists, are the permissions set correctly on it? keep in mind that the user that owns apache usually has very limited powers -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Tuesday, July 03, 2001 17:34 To: [EMAIL PROTECTED] Subject: [PHP] error_log not obeyed Hello: I'm trying to send PHP errors into a separate log file. I have the following in php.ini: log_errors = On error_log = /var/www/logs/php-errors.log After apache restarted the errors are now being sent to apache's error log, but not the one I specified. Any ideas? Thanks, -- Arcady Genkin i=1; while 1, hilb(i); i=i+1; end -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help Meeeeeeeeeee!!!!!!
perhaps you'll have better luck finding comments and suggestions on a VB or MySQL list -Original Message- From: Veerappan Rajendrakumar [mailto:[EMAIL PROTECTED]] Sent: Tuesday, July 03, 2001 19:30 To: [EMAIL PROTECTED] Subject: [PHP] Help Meee!! Hi, I am working on a banking project. we are planning to take our tour into vb/mysql combination. Please help me sending your comments. Thank you, V.Rajendrakumar. Buy Feng Shui Package for Rs. 151/- only, at http://shopping.rediff.com/shopping/fengshui_mailer.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] How to prevent people from downloading images
there are two answers to this: 1) it cannot be done. as long as that image is on the person's computer screen, it is physically impossible to prevent that person from saving the image and using it. (a simple tap of the print screen will take a screenshot on windows machines, as someone else mentioned) 2) if you used java or some form of server-side script to pass the binary data directly to the browser, it would make it much harder for the average websurfur to steal the image, since he/she wouldnt be able to just right-click on it and select save as... (as someone also mentioned, he bought a java class that did this) but like i said before, if that image is viewable on the computer monitor, it's impossible to protect it if someone wants to steal it bad enough. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Deleting a string from a text file
you could also do it this way: $ofile = file.txt;// original file $nfile = new.file.txt;// new file $string = original; // what needs to be replaced $replace = replacement; // what to replace it with $data = file($ofile); // original file's data $fp = fopen($nfile,w) or die(Cannot open for writing); while ( list(,$line) = each($data) ) { $line = preg_replace(/$string/, $replace, $line); fwrite($fp, $line) or die(Cannot write); } fclose($fp); $r = copy($nfile,$ofile) or die(Unable to copy); $r = unlink($nfile) or die(Cannot unlink); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] [OT-ish] Optional Extras.
off the top of my head, you could try using a lookup table to define the extra options... ford_spec table: id desc --- --- 1 air conditioning 2 whatever ford_cars table: car extra1 extra2 -- --- - 'contour' 1 0 'probe' 0 1 contour would have aircond but no whatever probe would have no aircond but would have whatever so to add more options specific to a manufacturer, you could make an entry into ford_spec and then create an extra3 field in ford_cars... this system, at least, would enable you to have as many extras as you wanted for each manufacturer, and have different options available for different manufacturers. i dont know how efficient this would be, and there are probably a bunch of better ways to do it, but i've seen this method used before by someone who developed a batteries catalog and needed to store different manufacturers with different options for their batteries. -Original Message- From: Dave Mariner [mailto:[EMAIL PROTECTED]] Sent: Monday, June 25, 2001 12:54 To: [EMAIL PROTECTED] Subject: [PHP] [OT-ish] Optional Extras. Please excuse me if you consider this to be off-topic, but this is the best place I can think of to ask the (slightly long-winded) question. Imagine you have a car database (MySQL driven). Different models have different optional extras (air-con, central locking, immobiliser etc). I need to store the optional extras in a searchable form - i.e. the customer may have a wish-list of electric windows, aircon, and power steering. However the optional extras list is not and will not be finalised when the system goes live (probably will never be finalised!). Therefore I cannot do the quick-and-dirty hack of putting all the options as binary fields in my car database, so must come up with a more elegant solution. I've thought of storing e.g. 10 tuples car.option1-aircon code, car.option2-powersteering code. etc. and also going down the header-detail route. My current quandry is to which is going to be better for the search aspect, considering I'd also like to give them a best fit option. Would it be to create a cursor on my fixed criterion (price, age etc) and then iterate through each of those manually in my php script (see - it isn't entirely off topic ;0) ) counting the matches for that record in the optional-extra detail table? Or would it be to do a select where (optionalextra1=mychoice1 or optionalextra2 = mychoice1 ..) and (optionalextra2=mychoice2 or optionalextra2 = mychoice2.. ) and etc etc (yeuch!). I have a sneaking suspicion that there's a more elegant way than either of these, but can't think of it at the moment. If you come up with the solution there's a beer in it for you the next time you're in Paphos, Cyprus! Thanks in advance, Dave. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] test
why dont you just use an email program that works correctly? -Original Message- From: Jon Yaggie [mailto:[EMAIL PROTECTED]] Subject: [PHP] test It wasnt a test my email program gets out of hand occassionally. trust me i am trying very hard to control. i am sorry if it really bothers you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: Re[2]: [PHP] Problem with PHP as CGI
as a test, try removing the shebang line from your script and running the PHP binary from the shell: /usr/local/bin/php myscript.php i've used the CGI version for months now with apache for my website, and frequently use PHP from the shell to test out ideas and code snippets and i've never had any problems. -Original Message- From: Richard Kurth [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 24, 2001 09:31 To: [EMAIL PROTECTED] Subject: Re[2]: [PHP] Problem with PHP as CGI Hello Stuart, yes there is a ? as the first line of my script as a mater of facket I can run a script that looks like this and I still get the problem #!/usr/local/bin/php -q ?php echo HELP; ? Wednesday, May 23, 2001, 9:06:08 PM, you wrote: Stuart J. Browne Richard Kurth [EMAIL PROTECTED] wrote in message Stuart J. Browne [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have php config as a cgi and I put this at the top of my script #!/usr/local/bin/php -q when ever I run this script at root in telnet I get this message below. Error in argument 1, char 3: option not found Error in argument 1, char 3: option not found Stuart J. Browne Code snippett would help, but it sounds as if the first line (after the Stuart J. Browne hash-bang) is NOT ?. Stuart J. Browne I've found that oddities occur without that as the first line of your Stuart J. Browne script.. Stuart J. Browne bkx -- Best regards, Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Problem with PHP as CGI
im not sure that i understand the question, but the way i've got my apache/PHP configured, i dont ever see the actual path to the PHP binary. what type of problem are you having ?? PS: i never use shebang lines in my PHP scripts; i have apache configured to handle *.php files as PHP code. -Original Message- From: midget2000x [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 20:33 To: Stuart J. Browne; [EMAIL PROTECTED] Subject: Re: [PHP] Problem with PHP as CGI This is not an answer, but a further question on this subject. Do you (or anybody) know of a way to keep the path to PHP from showing up when the PHP CGI script is hit via HTTP? On Wed, 23 May 2001, Stuart J. Browne wrote: Richard Kurth [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I have php config as a cgi and I put this at the top of my script #!/usr/local/bin/php -q when ever I run this script at root in telnet I get this message below. Error in argument 1, char 3: option not found Error in argument 1, char 3: option not found Code snippett would help, but it sounds as if the first line (after the hash-bang) is NOT ?. I've found that oddities occur without that as the first line of your script.. bkx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- --- providing the finest in midget technology -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] two data base connections on one page
look at the manual def's for both: mysql_connect and mysql_db_query if you have multiple database connections active, remember to *always* use the linkid of the database you want to talk to -Original Message- From: David Robley [mailto:[EMAIL PROTECTED]] Sent: Wednesday, May 23, 2001 23:06 To: Peter Houchin - SunRentals Australia; Php-General@Lists. Php. Net Subject: Re: [PHP] two data base connections on one page On Thu, 24 May 2001 15:23, Peter Houchin - SunRentals Australia wrote: Hi, I'm playing around with phpwebsite that I down loaded.. and am creating my own pageto add to it phpwebsite creates a database connection and the page I am creating also needs a connection to a different database ... this is possible to do and on the same page ... I know this is probably in the manual .. but I am unsure of what to look for in there for it .. I'm using MySQL and mysql_connect shows nothing for what i need.. any idea's suggestions would be greatly appreciated Peter Once you have opened a connection, you should be able to use mysql_db_query multiple times, specifying different databases each time, and of course using different variables for the result identifiers. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA Amusement is the happiness of those who cannot think. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] bulletin board or forum
blaze board is what i use: http://www.bbhacks.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] if $index=1 how can I create a variable named $column_1
And even though it's much less elegant than the solution by Sean below, you could also use 'eval' $toast = array(wheat, rye, pumpernickel); $numbreads = count($toast); for ($index = 0; $index $numbreads; $index++) { eval(\$column$index = '$toast[$index]'; echo \$column$index . 'BR';) ; } -Original Message- From: Sean R. Bright [mailto:[EMAIL PROTECTED]] To: 'Jay Lepore'; [EMAIL PROTECTED] Subject: RE: [PHP] if $index=1 how can I create a variable named $toast = array(wheat, rye, pumpernickel); $numbreads = count($toast); for ($index = 0; $index $numbreads; $index++) { ${column . $index} = $toasts[$index]; } (A little less code and one less variable required.) Sean -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Forms and PHP_SELF
or if you're hellbent on using one form, you could set a cookie db_insert_formname=1; so that if the page refreshes, you can check the value of the cookie to make sure you dont re-insert the data -Original Message- From: Sandeep Hundal [mailto:[EMAIL PROTECTED]] Sent: Thursday, May 10, 2001 11:11 AM To: 'Chad Guilette'; [EMAIL PROTECTED] Subject: RE: [PHP] Forms and PHP_SELF surely all you need to do is put the php right at the top, and say if (isset($variable) { print this message } else {do this header (); } i've done that loads of times so the form data goes back to the page, and once its inserted into the db, it sends a header to redirect. /sunny -Original Message- From: Chad Guilette [mailto:[EMAIL PROTECTED]] Sent: 10 May 2001 16:07 To: [EMAIL PROTECTED] Subject: [PHP] Forms and PHP_SELF I'm currently working on a project and I've come across a problem which I'm sure has been discussed several times before but I still need some assistance on it. I have a page with a form whose action is $PHP_SELF so the form and the form action are all in the same pagethis works fine but in the form action a message is displayed stating success or failure of the insertion of data into a database and the user is redirected by means of a meta refershduring this time if the user refreshes the page the data is resubmitted againthe user can do this repeatedly Some people have suggested that I use headers but I cannot do this at this point because I've already sent the header... others have suggested I use some variable $script_ran_count = 1 then run and after increment so a test of it would be false...this had no effect others have suggested javascript... I'm really baffled...how can I have a self-submitting form page that has a display message and a meta redirect but if the user refreshes the page stop the resumission of data? Regards, Chad Guilette -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ereg issues
print preg_replace('/(.*?)(\w{2})(.*)/', '\\2', $blah); works for: $blah = *9 scott 777zxsdf; and $blah = scott; -Original Message- From: Jerry Lake [mailto:[EMAIL PROTECTED]] Subject: [PHP] ereg issues I'm feeling a bit stupid today how do I truncate a string to the first two [a-zA-Z] characters ? this sure isn't working snip $test = jerry; $test = ereg_replace(^\w*, ^[a-zA-Z]{2} ,$test); /snip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] regex pattern match and extract
use match_all to get an array of matches. $s = [VET]We r NOT [PA]-Crew [TC]; preg_match_all('/\[.*?\]/', $s, $matches); while (list($k,$v) = each($matches[0])) { print $k = $vBR\n; } prints: 0 = [VET] 1 = [PA] 2 = [TC] -Original Message- From: Michael Roark [mailto:[EMAIL PROTECTED]] Subject: [PHP] regex pattern match and extract $sql=select nfo_gname from galaxy_nfo limit 1; $result=db_query($sql); if ($result) { while (list($nfo_gname)=mysql_fetch_row($result)) { echo ($nfo_gname); ereg (\[[a-zA-Z0-9]\], $nfo_gname, $regs); echo $regs[1]; I'm trying to match any thing between [] and pull it from the string and print it to the page. I want the []'s matched as well. IE: $nfo_gname contains the following information [VET]We r NOT [PA]-Crew [TC] should $regs[1] contain: [VET] [PA] and [TC] ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Check this out - http://www.hotscripts.com/webpoll/results.php
that's an extremely biased poll... considering that it's a *scripting* website. it's only logical that a majority of people going there would choose a scripting language (and since PHP is so newbie friendly, it also makes sense that it has such broad appeal to the newbie web-programmers at the site) and besides, a whole lot of people use PHP on microsoft platforms, so i doubt that the redmond behemoth is shaking in their boots :) -Original Message- From: SED [mailto:[EMAIL PROTECTED]] Subject: [PHP] Check this out - http://www.hotscripts.com/webpoll/results.php ...of course M$ is worried about PHP, see this: http://www.hotscripts.com/webpoll/results.php SED -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] conversion script
if you're renaming to .PHP, i assume that you'll be using PHP. use PHP to solve your problem: This was taken directly from the PHP.net site: if ($dir = @opendir(/tmp)) { while($file = readdir($dir)) { echo $file\n; } closedir($dir); } as others have said before, read the documentation. it really does help. -Original Message- From: Mark Maggelet [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 08, 2001 2:34 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] conversion script On Tue, 8 May 2001 11:09:18 -0700, Ryan Christensen ([EMAIL PROTECTED]) wrote: Would anyone be able to help me out with this: I have quite a few (almost 2000) .html files that I would like to change over to the .php extension. Past that, I would also like to add text to the top bottom of each page (for template purposes.) Does anyone know of a script that would automate this process, going through all the documents in a directory, and making the needed changes? Thanks in advance.. for the first part you can try (not tested): for i in `/bin/ls *html |sed 's/.html//g'`; do mv $i.html $i.php; done for the second part you might want to try putting it in your auto_prepend_file. - Mark Ryan Christensen OlyPen Technical Support [EMAIL PROTECTED] 360.457.3000 800.303.8696 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: php-list- [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php, snmp, and mibs
as someone else suggested... a regexp is probably the thing you want. since i have no idea what the format of a MIB is, i cannot give you any example. but to find dotted num's, use something akin to this: preg_match_all('/(\d+)(?=\.?)/', $MIB, $matches); -Original Message- From: Mike Backes [mailto:[EMAIL PROTECTED]] Sent: Tuesday, May 08, 2001 2:28 PM To: [EMAIL PROTECTED] Subject: [PHP] php, snmp, and mibs Hi, Sorry if this is a repeat question, I just can't seem to find an answer to this question. I am running php4 on NT. I've been able to connect to some network equipment with the snmp commands, and retrieve the results. But it's the list of values, which can be tough to correspond to the MIB. Is there a way to get at least the x.x.x.x.x.x from a MIB file into an array of some kind, or even better, to get the object names and such into an array? Thanks for any information, Mike _ Do You Yahoo!? Get your free @yahoo.com address at http://mail.yahoo.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Multiple select box and form submitting
i apologize in advance if the answer to my question is glaringly obvious. i've got a multiple select on a form and want to find out *all* selected values. the form looks like so: SELECT NAME=form[category] MULTIPLE OPTION VALUE=0First OPTION VALUE=1Second OPTION VALUE=2Third /SELECT when the form submits, $form['category'] is not an array of selected values, but rather a single value. even if i select two or three things, $form['category'] is still one value. can anyone tell me how to get a list of all selected values in the box? thanks in advance... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Variable question (eval is cool)
$bob = Roy; $s = 'Hey there $bob'; $s = 'print '. $s .';'; eval ($s); prints: Hey there Roy; perhaps that's what you're looking for? -Original Message- From: John Vanderbeck [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 4:21 PM To: King, Justin; [EMAIL PROTECTED] Subject: RE: [PHP] Variable question How about manually parsing the string out to give you chunks, that can then be eval'd easy. - John Vanderbeck - Admin, GameDesign (http://gamedesign.incagold.com/) - GameDesign, the industry source for game design and development issues -Original Message- From: King, Justin [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 4:18 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Variable question A simple eval($mysqldata) isn't going to do it though since the string is Your username is $userdata[username]; it'll just spit a parse error. I've already tried that -Justin -Original Message- From: Jack Dempsey [EMAIL PROTECTED] Sent: Monday, May 07, 2001 1:13 PM To: King, Justin; [EMAIL PROTECTED] Subject: RE: [PHP] Variable question ok, look into eval() -Original Message- From: King, Justin [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 4:07 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Variable question Here let me flesh this out a bit more Consider the query SELECT datafield FROM myTable WHERE id=1; This would return My username is $userdata[username]; I want to then output what the database returns, and have php evaluate my variables. -Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Variable question
this also works, since you mentioned that you're trying to get away from evalling an echo statement. $bob = Roy; $s = 'Hey there $bob'; $s = '$somevar = '. $s .';'; eval ($s); print $somevar; prints: Hey there Roy; personally, i think that using regexps to implement an entire symbol parsing engine to do what you ask is something that you really do not need to do. instead of trying to reinvent the wheel, use the free ferarri that PHP provides you :) -Original Message- From: King, Justin [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 4:29 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Variable question I'm trying to get around having to do that, I don't know regular expressions so it makes it difficult :( -Justin -Original Message- From: John Vanderbeck [EMAIL PROTECTED] Sent: Monday, May 07, 2001 1:21 PM To: King, Justin; [EMAIL PROTECTED] Subject: RE: [PHP] Variable question How about manually parsing the string out to give you chunks, that can then be eval'd easy. - John Vanderbeck - Admin, GameDesign (http://gamedesign.incagold.com/) - GameDesign, the industry source for game design and development issues -Original Message- From: King, Justin [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 4:18 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Variable question A simple eval($mysqldata) isn't going to do it though since the string is Your username is $userdata[username]; it'll just spit a parse error. I've already tried that -Justin -Original Message- From: Jack Dempsey [EMAIL PROTECTED] Sent: Monday, May 07, 2001 1:13 PM To: King, Justin; [EMAIL PROTECTED] Subject: RE: [PHP] Variable question ok, look into eval() -Original Message- From: King, Justin [mailto:[EMAIL PROTECTED]] Sent: Monday, May 07, 2001 4:07 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] Variable question Here let me flesh this out a bit more Consider the query SELECT datafield FROM myTable WHERE id=1; This would return My username is $userdata[username]; I want to then output what the database returns, and have php evaluate my variables. -Justin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Filesystem security
my advice would be to disconnect the box from the internet until you understand how to properly secure it. please read the documentation and manuals before your box gets raped and pillaged -Original Message- From: Maxim Maletsky [mailto:[EMAIL PROTECTED]] Subject: RE: [PHP] Filesystem security Read the php.ini file and the manuals on php.net. There are some directives which can limit the parser to operate on files under a certain level. You can also disallow functions if you care. As well as what directives can be overwritten by .htaccess files. No idea where have I read all that, but I am sure there is. -Original Message- From: Anton G. Popov [mailto:[EMAIL PROTECTED]] Subject: [PHP] Filesystem security Hi I have to set up a site for free web hosting incl. php I installed apache and php4.0.4pl1 and now the php scripts can browse the entire filesystem of the machine. Does anyone know how to fix that? 10x a lot Antt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Can I install Lihnux on My Windows 95 machine ?
the learning curve is smaller than most people think... if you are willing to learn, and refuse to be intimidated by the reputation that has been built up around linux, i doubt you'll have any problems installing and running/using it in a lot of ways, i think linux is probably a more natural OS for programmers... we're used to big scary text files where a single incorrect semicolon can cause unheard of errors in far reaching parts of the code linux is much the same way... a single obscure config file can bring down your entire system if configured incorrectly :) -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 26, 2001 3:47 PM To: B. van Ouwerkerk Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Can I install Lihnux on My Windows 95 machine ? I said be prepared. Not that it would happen. Considering the learning curve of linux..I think it is only fair to say that mistakes are likely to happen, in particular for a newbie. On Wed, 25 Apr 2001, B. van Ouwerkerk wrote: Also if you are a newbie to linuxget a different machine or be prepared to lose data or windows on your present machine. Never lost any data.. Not even when I still was a newbie.. But it's always a good idea to create backups. Bye, B. -- Sono -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Passing arrays from page to page
well, one idea is to serialize the array and put into a HIDDEN text field to be submitted with the FORM. or, with no form, try this: doc.php?myarray=. htmlentities(serialize($array)); -Original Message- From: Clif [mailto:[EMAIL PROTECTED]] Subject: [PHP] Passing arrays from page to page I'm trying pass an array from one page to another. Page 1 is a form. Page 2 has the data sent by Page 1 available in $HTTP_POST_VARS. This is where I'm stuck: Page three needs access to those same variables in $HTTP_POST_VARS. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] translating a function from Perl to PHP
i tried to do it myself and nearly fell off my chair becuase PHP makes you jump through hoops to do such a simple thing print preg_replace('/%([a-zA-Z]*)%/e', \$mioArray['$1'], $testo); i never could understand why other languages made regular expressions so convoluted. why not just support the =~ binding operator instead of that awful function syntax...? -Original Message- From: Black Dragon [mailto:[EMAIL PROTECTED]] Subject: [PHP] translating a function from Perl to PHP Hi everyone, I'm a good perl programmer, but I'm not able to translate this small Perl program to PHP: $testo = 'Hi %NOME%, how are you? Tomorrow I\'ll go to %DESTINAZIONE% with %AMICO%!'; %mioArray=( 'NOME' = 'Pippo', 'AMICO' = 'Pluto', 'DESTINAZIONE' = 'Roma'); print $testo.\n\n; $testo =~ s/%([a-zA-Z]*)%/$mioArray{$1}/g;# == this is my problem!!! print $testo.\n; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PERL vs. PHP
PHP was started as a suite of perl programs... it is heavily influenced by perl. if you understand PHP and are comfortable with it, you should not have any problems learning Perl. there are some very important differences between the two languages that you need to keep your eyes open for, things like variable scoping (perl vars are global by default) and variable prefixes @varname = array $varname[1] = item in the array %varname = hash (assoc. array) $varname{'name'} = element of the hash. PHP kind-of smoothes over the perl approach to variables and makes *everything* $varname, $varname[1], $varname['name'] IMO, perl allows you greater control over a number of things that PHP doesn't address, but that's mainly becuase perl is older and has had more time to build up funcitonality and also becuase perl's focus is larger than web-based projects (so you can use perl to do some things that you probably cant do in PHP, like create daemons and servers) all in all, if you know and love PHP, you'll probably find a friendly home in Perl. :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PERL vs. PHP
i program in both PHP/Perl, and the concepts are extremely similar... granted, there are some similarities to C++, but by far, the largest contributor to PHP's language design has been Perl. -Original Message- From: Steve Lawson [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] PERL vs. PHP No, you won't. PHP is has very similar syntax to c/c++ and perl but the concepts are extremely different. SL. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PERL vs. PHP
ahhh... sorry. i thought the history of PHP was a bunch of perl scripts that were used to keep track of website statistics or somethign guess i was wrong. but since you replied, can i ask what influenced you most when developing PHP? personally, i see perl influence everywhere in PHP, but maybe i'm just not familiar enough with C to recognize a lot of C influence. -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Subject: RE: [PHP] PERL vs. PHP PHP was started as a suite of perl programs... it is heavily influenced by perl. if you understand PHP and are comfortable with it, you should not have any problems learning Perl. Not quite. I prototyped the initial parser with a Perl program (pre version 1), but the "suite" as you call it was all written in C. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Another easy question!
it depends. is it a char restriction that MySQL is placing on you? e.g. a TINYTEXT field type can only contain 255 chars, whereas a TEXT type can contain 16MB (or something like that) if it's a PHP restriction, you'll have to wade thru PHP scripts to find the function that checks the length, and alter that function. however, if it's a MySQL limitation, all you need to do is log into the MysQL server and issue some ALTER TABLE statements http://mysql.com/doc/A/L/ALTER_TABLE.html -Original Message- From: Anthony Daniels [mailto:[EMAIL PROTECTED]] Sent: Friday, April 20, 2001 6:12 PM To: [EMAIL PROTECTED] Subject: [PHP] Another easy question! Hello, I really like how this group responds quickly. Here is another minor problem I am facing. My programmers are in Romania and have shut down shop for the weekend. Well, I am in somewhat of a dilema. I have a MySql database and php enhanced admin. section on my site. The problem I am having is that the maximum character amount that my programmers have put on three different variables is too low. I need to increase these considerably. Is there an easy way to do this? If am not too familiar with telenet, if that is what I must use, however, I can learn if given detailed instructions. Please help! Thank you, Anthony Daniels PS I am pretty familiar with how varibales work, but I am not to knowledgeable about the syntax. If spelled out, I can do it. Thanks again. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Password Generator?
you could try swapping out some letters with look-alike alphanum characters to make the password a bit more secure a=@ s=$ d= thus, "password" = "p@$$wor" -Original Message- From: Jon Snell [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 11:47 AM To: [EMAIL PROTECTED] Subject: RE: [PHP] Password Generator? There is code in the source for NetHack to create pronounceable words. Also, combining words would probably be somewhat easy. A lazy coder could import a unix dictionary file into a MySQL table and do "select word from word order by rand limit 2" and just combine the results. -Original Message- From: Plutarck [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 18, 2001 4:52 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Password Generator? I believe there is an article on phpbuilder.com on "pronouncable passwords", which is probably what you'll want to actually do. Using real words would just be way too resource intensive. I'd give you the direct link to the article, but it seems my internet connection only works for NNTP and ftp downloads...my HTTP has broken for the moment, and I have no idea why ;( -- Plutarck Should be working on something... ...but forgot what it was. ""Ashley M. Kirchner"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Is there an easy way to generate generic passwords based on (combined) dictionary words? (ej: take two different words and put them together) AMK4 -- W | | I haven't lost my mind; it's backed up on tape somewhere. | ~ Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 SysAdmin / Websmith . 800.441.3873 x130 Photo Craft Laboratories, Inc. .eFax 248.671.0909 http://www.pcraft.com . 3550 Arapahoe Ave #6 .. . . . . Boulder, CO 80303, USA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Which is better coding style...
i say the first style. unneeded variables and other thingies just obscure things and make it harder to maintain. -Original Message- From: Boget, Chris [mailto:[EMAIL PROTECTED]] Subject: [PHP] Which is better coding style... Which is better? function blah() { switch( $bob ) { case 1: return "this"; case 2: return "that"; default: return "other"; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Which is better coding style...
OOooo... it drives me nuts when i see beginning brackets on seperate lines ;) i like to start brackets on the same line as the statement and finish them on a line of their own. if (...) { } else { } (it drives me nuts to see "} else {" also) -Original Message- From: Sander Pilon [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 4:32 PM To: 'Php-General' Subject: RE: [PHP] Which is better coding style... Definitely the second style :) (If we were talking about C(++) then the first would have even been forbidden by my companies coding standard as well as several coding standards of other companies I worked for.) The reason is this - a function has one entrypoint (duh) and one exitpoint. Jumping out of a function somewhere in the middle leads to unmaintainable code, and bugs when extending that function and that return is overlooked. But, as with the indenting and bracket placing, it is a matter of religion. They would have to torture me for three weeks to get me to place the brackets like you did in your example :) function blah() { $retval = ""; switch( $bob ) { case 1: $retval = "this"; break; case 2: $retval = "that"; break; default: $retval = "other"; break; } return $retval; } -Original Message- From: ..s.c.o.t.t.. [gts] [mailto:[EMAIL PROTECTED]] Sent: 19 April 2001 21:31 To: Php-General Subject: RE: [PHP] Which is better coding style... i say the first style. unneeded variables and other thingies just obscure things and make it harder to maintain. -Original Message- From: Boget, Chris [mailto:[EMAIL PROTECTED]] Subject: [PHP] Which is better coding style... Which is better? function blah() { switch( $bob ) { case 1: return "this"; case 2: return "that"; default: return "other"; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP and Ranges
this works: $r_start = 0; $r_end = 65535; $a = array('12', '198', 'b'); while ( list($k,$v) = each($a) ) { if ( ($v $r_start) ($v $r_end) ) { print "[$v] OKBR\n"; } else { print "[$v] NOPEBR\n"; } } -Original Message- From: Jason Caldwell [mailto:[EMAIL PROTECTED]] Subject: [PHP] PHP and Ranges is there a way to compare a value to a preset range. for example; $preset_ range = [0...65535] $a[0] = "12"; $a[1] = "198"; $a[2] = "B"; $ac = count($a); for($x=0; $x $ac; $x++) { if($a[$x] != $preset_range) { $valid = 0; } else { valid = 1; } print($valid . "\n"); } output should look like: 1 1 0 how is this accomplished in PHP? thanks. jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Last Element in an Array?
you can get the amount of elements in an array using count() and use that # as an index value for 1+ the last value (the last value that's NOT IN the array) $a = array('12', '198', 'b'); print count($a); this'll give you "3", which, as you can see, the last valid subscript of $a is $a[2]; -Original Message- From: Andrew Hill [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 17:08 To: Jason Caldwell Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Last Element in an Array? Jason, You can use array_pop() to return the last element of the array - $last_item = array_pop ($array); but if you just want your array processing to stop when it's reached the last item in the array (and avoid the loop) then do something like: while (list ($var1, $var2) = each ($array)) HTH! Best regards, Andrew Andrew Hill - OpenLink Software Directory of Technology Evangelism Internet Data Integration Technology http://www.openlinksw.com On Thursday, April 19, 2001, at 07:57 PM, Jason Caldwell wrote: Is there a command which will tell me that it is the last in an array? When I use END it just gives me the value IN the array... I want to know when I hit the last element in an array... This is driving me crazy... Thanks. Jason -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] image-resize (thumbnail 150x150 code)
this is what i use to scale down an arbitrary .GIF or .JPG image to 150x150... $image_name is the name of the original file that you want to create a thumbnail of... function save_thumb($image_name,$image_type) { global $Svar; $new_w = 150; $new_h = 150; $image_path = "/path/of/imagedir/". $image_name; $thumb_path = "/path/of/thumbdir/" . $image_name; if ($image_type == "image/pjpeg") { $src_img = imagecreatefromjpeg($image_path); } elseif($image_type == "image/gif") { $src_img = imagecreatefromgif($image_path); } $dst_img = imagecreate($new_w,$new_h); imagecopyresized($dst_img,$src_img,0,0,0,0,$new_w,$new_h,imagesx($src_img),imagesy($s rc_img)); imagejpeg($dst_img, $thumb_path . "_t.jpg"); return 1; } -Original Message- From: Joe Stump [mailto:[EMAIL PROTECTED]] Sent: Thursday, April 19, 2001 17:18 To: De Bodemschat Cc: Php-General-list Subject: Re: [PHP] image-resize/convert Again - if you have imagemagick installed email me and I'll email you my little class that does this. --Joe On Thu, Apr 19, 2001 at 10:02:47AM +0200, De Bodemschat wrote: Hello, I'm creating a bunch of photogalleries and wondering about the following: - Is it possible to convert an image or a whole dir with images (jpg) to 60% of the original imagesize using php to automate this task? I know the gd library is installed, but don't know if it supports jpg... And what functions do I need to use? gd-variables in phpinfo(): GD Support enabled GD Version 1.6.2 or higher FreeType Support enabled FreeType Linkage with TTF library PNG Support enabled Hope you people can help. THanks, Bart Verbeek -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] /* Joe Stump * Sr. PHP Developer * http://www.Care2.com http://www.joestump.net http://gtk.php-coder.net */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP and CVS
do any of you know of any nice web-interfaces to CVS done in PHP? since i write code at home and at work, i wanted to maintain a single repository for files/code that i frequently use... thanks for any suggestions. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] BSD/GD/PHP/APACHE/SOS
i did it for linux. basically, what i did was to get GD and the other libraries, 'configure' and 'make' them all then, go into the PHP directory and tell PHP's configure script where GD and such reside: ex: ./configure --with-gd-dir=../gd-1.8.4/ --with-jpeg-dir=../jpeg-6b/ somthing similar to that should work -Original Message- From: Louis Grenzebach [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 29, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: [PHP] BSD/GD/PHP/APACHE/SOS Would anyone know of, or could possibly supply, a HOW-TO for installing GD, with Jpeg and freetype support for php, on a freebsd platform? I'm currently using apache 1.3.19 (just upgraded from 1.3.12), php 4.0.4pl1 on FreeBSD Release 4.0. I've been trying for 4 days now to get it working, it's finally down to everything compiles and installs OK, but when it comes time to actually run apache, it's unable to find my X11 libs. If you know a work around for just that, it would also be extremely helpful. Thank you in advance. PKshifted -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] BSD/GD/PHP/APACHE/SOS
did you compile apache yourself? try compiling apache yourself and then compiling PHP as a stanalone-CGI (as opposed to server module) and see if that helps any of your prob's. -Original Message- From: Louis Grenzebach [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 29, 2001 11:53 PM To: [EMAIL PROTECTED] Subject: [PHP] BSD/GD/PHP/APACHE/SOS Would anyone know of, or could possibly supply, a HOW-TO for installing GD, with Jpeg and freetype support for php, on a freebsd platform? I'm currently using apache 1.3.19 (just upgraded from 1.3.12), php 4.0.4pl1 on FreeBSD Release 4.0. I've been trying for 4 days now to get it working, it's finally down to everything compiles and installs OK, but when it comes time to actually run apache, it's unable to find my X11 libs. If you know a work around for just that, it would also be extremely helpful. Thank you in advance. PKshifted -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] sanity check please
well, besides the fact that your code is interpreted and the only data that makes it to the browser is what you decide to output (or error message, but they can be turned off/silenced) i dont see how a surfer could get your PHP source code via the webserver. -Original Message- From: Jerry Lake [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 6:42 PM To: [EMAIL PROTECTED] Subject: RE: [PHP] sanity check please you can put you database connection in a file below the web root and include it into the script. that way it isn't visible in the source. Jerry Lake- [EMAIL PROTECTED] Web Designer Europa Communications - http://www.europa.com Pacifier Online - http://www.pacifier.com -Original Message- From: Les Neste [mailto:[EMAIL PROTECTED]] Sent: Friday, March 30, 2001 3:01 PM To: [EMAIL PROTECTED] Subject: [PHP] sanity check please Hi, I have a question about security with PHP. I'm building a site with PHP and some of the scripts connect to MySQL. All someone needs to do to get my MySQL passwords is view the PHP source, right? And the recommended approach around this is to use Zend, right? Please correct me if I'm off base here. TIA! Les Neste 678-778-0382 http://www.lesneste.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] compiling PHP4
has anyone had trouble compiling PHP and GD on a linux/redhat machine?? (what baffles me the most is that it compiled flawlessly on another, almost identical, machine) could anyone offer suggestions or hints, or perhaps suggest a good website/discussion/archive that might address GD-PHP compilation errors? thanks a bunch. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sessions: suggestions and comments
what i did was implement my own session class so that i can have a single session variable ($s) and have it handle all my session needs via an OO interface ($s-CleanUp(), $s-Update(), ...) consequently, all of my session data is in a simple assoc. array that's a variable of the session class (sdata) so i can get to all of my session data via $s-sdata[...] i update a value by: $s-Update('name', 'newvalue) and start the session: $s = new Session( $cookie_sid ); no mucking around with multiple global variables and such... no registering of variables and worrying about PHP's internals - just one object (and thus, one variable) is all i need for session handling. i dont understand why more people dont use assoc. arrays for their session needs... ive never used PHP's built-in session handling so im not too sure of it's limitations, but are there any (good) reasons why more people dont use associative arrays as their session variables? for example: instead of having a mess of globals: $username $firstname $session_id $this $that you could just register one variable and use it as an assoc. array to store all of the values you needed. ($svar, for instance) $svar['username'] $svar['firstname'] $svar['session_id'] $svar['this'] $svar['that'] this would enable you to take an arbitrary number of variables and cut it down to *one* single assoc array seems to be a rather large benefit in doing things this way... so i cannot figure out why i dont see more people taking this road -- i come from a perl background, so im used to using hashes (assoc. arrays) for lots of things. i get the feeling that not very many people on this list (newbies, at least) are familiar or comfortable with assoc. arrays. any comments are welcome :) -Original Message- From: Michael Champagne [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 4:48 PM To: hi Cc: [EMAIL PROTECTED] Subject: Re: [PHP] I don't understand HTTP_SESSION_VARS Maybe I should just go back to using globals then. What does everyone else do normally? Globals or use the track_vars? I can't get these things working at all. Mike Hi, That code causes php to crash. I have never had that happen before. Every time I try to run that script, I am given an internal server warning. ""Johnson, Kirk"" [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Try as below. Note both the global and the session_register statements. function set session() { global $my_session_var,$HTTP_SESSION_VARS; session_start(); $my_session_var = "Blah blah"; session_register($HTTP_SESSION_VARS['my_session_var']); } Kirk -Original Message- From: Michael Champagne [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 1:32 PM To: PHP General Mailing List Subject: [PHP] I don't understand HTTP_SESSION_VARS I'm still having problems with this. I was able to get sessions and session variables working ok with register_globals=on, but I had read that it was better not to keep register_globals on so I turned it off and I'm trying to figure out how this works now. I'm registering a variable in one function say like this: function set session() { global $my_session_var; session_start(); $my_session_var = "Blah blah"; session_register('my_session_var'); } Then I'm trying to read it in another function like this: function read_session() { global $HTTP_SESSION_VARS; session_start(); echo ($HTTP_SESSION_VARS[my_session_var]); } Michael Champagne, Software Engineer -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- Michael Champagne, Software Engineer Capital Institutional Services, Inc. wk: [EMAIL PROTECTED] hm: [EMAIL PROTECTED] ** This communication is for informational purposes only. It is not intended as an offer or solicitation for the purchase or sale of any financial instrument or as an official confirmation of any transaction, unless specifically agreed otherwise. All market prices, data and other information are not warranted as to completeness or accuracy and are subject to change without notice. Any comments or statements made herein do not necessarily reflect the views or opinions of Capital Institutional Services, Inc. Capital Institutional Services, Inc. accepts no liability for any errors or omissions arising as a result of transmission. Use of this communication by other than intended recipients is prohibited. ** -- PHP General Mailing List
RE: [PHP] How send a file usig PHP code ?
send the proper HTTP headers and then output the contents of the file here's what i used when i had to prompt the user for a download box for arbitrary binary files (.gif, .zip, .png, .pdf) you might be able to not tell the browser the size of the data, but it's best to offer that information if you have it. print "Content: $filename\r\n"; print "Content-disposition: inline; filename=\"$filename\"\r\n"; print "Content-length: $size\r\n"; print "Content-type: application/octet-stream\r\n"; print "\r\n"; then start outputting the actual data from the file.zip that should work. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Friday, March 23, 2001 5:18 PM To: [EMAIL PROTECTED] Subject: [PHP] How send a file usig PHP code ? Hi I need send to user a file.zip using PHP code. Someone have a idea ? Thx a lot [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] I need an authentication method that is good... any Ideas? - please help
the way i do it for sites that need minimal to medium is to generate a session id whenever a user comes to the site. this session id is stored in mysql table and as a cookie on the user's computer. when the user logs in correctly, the username is stored in the database with the session ID (not as a cookie, only the session ID is saved as a cookie). i try and make it my goal to never store any usernames or passwords on the user's computer. the existence of the session ID is enough to allow me to look up that ID in the database and see if the user logged in correctly in the past few hours (expire time is ~6 hours, so after 6 hours of inactivity, the id is cleansed from the database) at the top of ever PHP page that requires a valid login, i check to see if the user has a session ID stored as a cookie, then look up that ID in the database to check if it's valid. if the ID is valid, i check to see if a username is also stored in the database. if there's a valid username stored alongside the session ID, then the user is recognized as being logged in. if no username is in the database, then i ask the user to log in. the session table has these fields: id (the generated session id) lastused (last time the user accessed a page) username (the username that the user logged in as) (password information is stored in another table) so... basically, if the user logs in correctly, it will generate a random session id and store the username in the database. *only* the session id will be stored on the client. when the user comes back to the website, if the id in their cookie matches an id in the database *and* the username field has a valid username, the user is not asked to log in again. if the session id is not found in the database (or is expired) the user is directed to a login page. any comments or thoughts on my method are welcome; especially any weaknesses that you may find in my system. thanks -Original Message- From: Romulo Roberto Pereira [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 4:30 PM To: [EMAIL PROTECTED] Subject: [PHP] I need an authentication method that is good... any Ideas? - please help Hello! I am constructing an intranet site. The site is all secure, I mean, all the pages are under a directory that needs a password to get in. These are facts: A) The user information is on a LDAP; B) The user should entry the pair login/password only once; C) Any access to the site without logging first will be routated to a login page; So what would be a good solution on that? If this work, I would like to create a documentation about it. All help will be welcome. Thank you in advance and for your attention, Romulo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Encryption Problem
quite possibly you did not compile PHP with mcrypt library support. for linux distrib's, mcrypt is not default, you have to specify ./configure --with-mcrypt to get mcrypt functionality (i dont know whether it's included by default with the win binary, but i doubt it) do the phpinfo() thing and see if mcrypt is there. -Original Message- From: darion mapp [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 5:19 PM To: [EMAIL PROTECTED] Subject: [PHP] Encryption Problem ok, so i have want to encrypt my user password in the mySQL Database and well that is not working but in addition to that when the user logges into the system i have to encrypt their password and compare the two encrypted passwords to see if they match. this is where my problem starts. I get the same error for both the registration process where the password is encrypted to be placed into the database and when the use logs in and the password is encrypted to be compared. The web browser errors to "Page cannot bbe displayed (IE)" and only when the line below is commented out does it work fine. HELP Project was due last week so i am pressed for time $txtPass = mcrypt_ecb(MCRYPT_BLOWFISH, $key, $txtPass, MCRYPT_ENCRYPT); Get 250 color business cards for FREE! at Lycos Mail http://mail.lycos.com/freemail/vistaprint_index.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Printing MySQL into HTML Tables
modulus also works for finding even nums: if ($i % 2) { // not even } -Original Message- From: darion mapp [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] Printing MySQL into HTML Tables now it seems like you know what is to be done and you are not willing to do the work. Now i have not tested this and you may have to do some work with it but you get the picture. if you lookup the syntax and ensure how to use the command then you will be ok. of course if you still have problems then let em know FOR($i = 0;$i $numrows; ++$i) { echo"trtd$mysql_result($resultidentiferfromquery, $i, fieldwithproduct)/tdtd$mysql_result($resultidentiferfromquery, ++$i, fieldwithproduct)/td/tr"; echo"trtd$mysql_result($resultidentiferfromquery, ++$i, fieldwithproduct)/tdtdnbsp;/td/tr"; if($i/2 0) //not even { echo"trtdnbsp;/tdtdnbsp;/td/tr"; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP/CGI Help
do .php files work anywhere else? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of Maroufski Sent: Thursday, March 22, 2001 5:41 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP/CGI Help Hi all, This is a tough one, wasn't able to find a solution so far. But I hope that someone can help me out or point me in the right direction. Here is what I got: /src contains a bunch of cgi scripts that require apache to have an entry like this ScriptAlias /src "/home/src/" When I try to run a file with .php extension in /src I get an error. I figured out since I have ScriptAlias /src, Apache will handle every file called in that directory as if it were a perl /cgi program. I need to be able to have apache execute the .cgi and .php files in /src Any ideas on how to make Apache differentiate between the two. Any help would be greatly appreciated. Nick -- ~ Nicholas Marouf || http://www.RamallahOnline.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Crypt problem
you dont... as far as i know, crypt only works on = 8 chars it will truncate anything over 8. perhaps try using md5 or mcrypt... -Original Message- From: Randy Johnson [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 22, 2001 4:33 PM To: [EMAIL PROTECTED] Subject: [PHP] Crypt problem hello I use crypt to crypt member's passwords and use the following verify "$stored_password" is the encrypted, stored password. "$password" is the plain text password you just got from the form. ## Check the passwords $encrypted_password = crypt($password,$stored_password); if ($encrypted_password = $stored_password) { $logged_in = 1; }; the problem I am having is that it is only comparing the first 8 characters of the password so if my password was randyrandy i could get in with randyran How do I fix this the crypt password is stored in the database with enough room to store the password so it isn't cutting it off when inserting to the database. thanks randy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] php 4.04pl 1-3 for red hat 7
check php.net and read the 'README' and 'INSTALL' files that come in the .tar.gz file for more detailed information. very basically, you want to get the sources, untar/zip them, run configure, then build the thing and test it (you can do all of this as an unprivileged user). then install as root (or whatever account has the necessary privileges) (replace php. with whatever the PHP tarball is named) at the prompt (you dont need to be root) type: tar xvfz php.tar.gz cd php. ./configure --enable-trans-sid make make test if you didnt get any errors, then (as root) type: make install then configure your webserver and restart the webserver if you have any specific troubles, let me know, i've config'd PHP on three different redhat linux installations using apache and havent had any problems yet. -Original Message- From: Larry Hotchkiss [mailto:[EMAIL PROTECTED]] Subject: [PHP] php 4.04pl 1-3 for red hat 7 Ok, I am working on a site where I would like to use sessions but NOT cookies. I would also like to have the sessions automatically appended to URL but I have a few questions. The current php rpm distribution was not compiled with --enable-trans-sid (according to phpinfo.php), am I correct in assuming I need to recompile? If that is the case, can someone recommend a good "how-to" to walk me through it. I have no experience with compiling at all. -- Larry H -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Pre-Written Script ?
phpmyadmin http://www.phpwizard.net/projects/phpMyAdmin/ -Original Message- From: Jack Sasportas [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 21, 2001 16:17 To: php Subject: [PHP] Pre-Written Script ? Has anyone found a good prewritten (gpl) script that helps you to create the php code to add/edit/modify based on selecting a table that you want to put data into ? I want to use this both to get some data in the computer as well as to learn other coding techniques. Thanks ! ___ Jack Sasportas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Error working
this is a PHP list. your problem is with java, not PHP -Original Message- From: Celestino Roberto Alejandro [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 15, 2001 3:34 PM To: Lista PHPGral Subject: [PHP] Error working Hello..i'm veri tired, and i am going to require your help. I need to make some operations with a cuadratic curve. But with the current php code... ?php $curve = new Java("java.awt.geom.QuadCurve2D.Double") ? ... i get this error: Warning: java.lang.ClassNotFoundException: java.awt.geom.QuadCurve2D.Double Can anybody help me? , please if you can't, only one person can reply this email, because i write too and never, never, reply me, dont know or another problem? :-)...bye, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help! Can't redeclare already declared function in
try using include_once() and require_once() in place of include() and require() also, make sure you havent defined any functions that match PHP internal funcs. -Original Message- From: Johnson, Kirk [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 15, 2001 3:29 PM To: php Subject: RE: [PHP] Help! Can't redeclare already declared function in Are the functions declared in an include()'d file? Is this file being include()'d more than once? That's how I usually provoke this error :) Kirk -Original Message- From: Jack Sasportas [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 15, 2001 1:25 PM To: php Subject: [PHP] Help! Can't redeclare already declared function in I just finished coding everything on a project it was working (all nighter), and now something I just changed is causing this error "Can't redeclare already declared function in " -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Interactive Shells
of course. if it supports sockets then i dont see why it wouldnt work with a back-n-forth exchange of information over those sockets. php.net/sockets look how much smaller that URL is than all the text you typed out in the message :) always check the online manual first. -Original Message- From: Clayton Dukes [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 15, 2001 5:25 PM To: [EMAIL PROTECTED] Subject: [PHP] Interactive Shells Can PHP work with interactive shells such as telnet like Expect does? ie: waitfor "ogin:" put $login waitfor "assword:" put $password etc. TIA! :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Has anyone got MSSQL2000 to connect and work properlly?
of course it's possible... :) -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Thursday, March 15, 2001 5:33 PM To: PHP User Group Subject: [PHP] Has anyone got MSSQL2000 to connect and work properlly? Hello, I am trying to get PHP4 to connect to Microsoft SQL2000. All I want to know is if it is possible on a Win Box and a Linux box for server. Thank you, Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] do..while(0) not staying true
or do .. while (0==0); -Original Message- From: Jim Winstead [mailto:[EMAIL PROTECTED]] Sent: Wednesday, March 07, 2001 2:23 AM To: [EMAIL PROTECTED] Subject: Re: [PHP] do..while(0) not staying true trick question, right? 0 is false. you want do { ... } while(1); jim -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] ++$i and $i++ whatz the difference?
one is post-increment, and one is pre-increment: POST-increment ($i++) $i = 1; print $i++; print "\n" print $i; prints : 1 2 becuase $i is printed out and *then* it is incremented, so the next print statement prints out the incremented value, not the print $i++; statement PRE-increment (++$i) $i = 1; print ++$i; print "\n" print $i; prints : 2 2 becuase $i is incremented, and *then* printed out. -Original Message- From: Dhaval Desai [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 27, 2001 23:50 To: [EMAIL PROTECTED] Subject: [PHP] ++$i and $i++ whatz the difference? Hi! I have a simple question. Please see the code below: ?php for($i=0; $i=10; $i++) { echo "$ibr"; } ? Now, See this code: ?php for($i=0; $i=10; ++$i) { echo "$ibr"; } ? I get the same out put from both the Scrits. What's the difference then anywayz? Thank You! Dhaval Desai __ Do You Yahoo!? Get email at your own domain with Yahoo! Mail. http://personal.mail.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] special characters with perl,mysql,php
i use a regexp to slash-out single quotes for inclusion into an SQL query: // quote a value to make it appropriate for inclusion in an SQL string function db_quote($value) { return ereg_replace("'","\\'",$value); } -Original Message- From: Mitchell Hagerty [mailto:[EMAIL PROTECTED]] Sent: Friday, February 23, 2001 18:54 To: [EMAIL PROTECTED] Subject: [PHP] special characters with perl,mysql,php Hey All, What would be a good method for inserting data into a blob field that contained special characters using perl then retrieving that data with php? URI::Escape has worked well with perl but now that php has gotten into the picture I need a new method. any suggestions? tks mitch -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help INSERTing to MySQL
0 also works for AUTO_INCREMENT fields... -Original Message- From: Philip Olson [mailto:[EMAIL PROTECTED]] Sent: Friday, February 23, 2001 18:41 To: Clayton Dukes Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Help INSERTing to MySQL If I knew I could get answers that easy here, I woudn't have worked on this for 20 hours :-) THANKS btw, field one is an ID field set to auto increment, how can I insert that if I don't know what it is? In this case use NULL as the value for id and it'll auto increment nicely. Using a blank '' will work too. Regarding use of NULL, it's NULL and not 'NULL'. Regards, Philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Help INSERTing to MySQL
you dont need to have a list of field names if you insert the exact amount of fields that exist in the table... if you have fields Name and Email, you can do: INSERT INTO mytable VALUES ('myname','[EMAIL PROTECTED]') without a problem. however, if you have fields Name, Email and Password the previous code will break, since MySQL would complain that you're inserting too few (or too many) pieces of data into the table, and it cant decide which data goes where -Original Message- From: Joe Stump [mailto:[EMAIL PROTECTED]] Sent: Friday, February 23, 2001 17:21 To: Clayton Dukes Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Help INSERTing to MySQL Before your VALUES you need to have a list of the fields ie: insert into table (id,fname,lname) values ('$id','$fname','$lname') --joe On Fri, Feb 23, 2001 at 08:00:30PM -0500, Clayton Dukes wrote: Hello, This is my first attempt, so I'm prolly doing something stupid, but can someone tell me why this doesn't work? All it returns is "Unable to INSERT to database" ---BEGIN--- ? $time = time(); $rand = Random_Password(5); $docid = $time . $rand; if (isset($email) isset($docid)) { mysql_connect("$HOSTNAME", "$DB_USER", "$DB_PASS"); $query = "INSERT INTO documents VALUES ('$docid', '$category', '$subcategory', '$date', '$subject', '$title', '$author', '$email', '$language', '$gr ade', '$level', '$city', '$state', '$county', '$zip', '$authors_comments', '$teachers_comments', 'N', '$docdata')"; $result = mysql_db_query("$DATABASE", $query) or die("Unable to INSERT to database"); if ($result) { echo "p$docid was added to the database/p"; } } ? h1Submit a new document to the database/h1 form Email Address: input type=text name=emailbr Category: select name=category? print "$CATEGORIES" ?/selectbr Sub Category: select name=subcategory? print "$SUBCATEGORIES" ?/selectbr Date Document was written: input type=text name=date (xx-xx-)br Document Subject: input type=text name=subjectbr Document Title: input type=text name=titlebr Document Author: input type=text name=authorbr Document Language: input type=text name=language value=Englishbr Grade Received (Percentage): input type=text name=grade size=3 (xx/100)br Grade Level of Paper: select name=leveloptionHigh School/optionoptionCollege/optionoptionOther/option/selectbr City in which paper was submitted: input type=text name=city value=Jacksonvillebr State in which paper was submitted: input type=text name=state value=FLbr County in which paper was submitted: input type=text name=county value=Duval b(County, not Country!)/bbr School at which paper was submitted: input type=text name=school value="Mandarin High School"br ZIP code: input type=text name=zip size=5 value=32257 b(Put your ZIP code in if you don't know your school's)/bbr Author's Comments: input type=text name=authors_commentsbr Teacher's Comments: input type=text name=teachers_commentsbr Document (ASCII TEXT ONLY):br textarea name=docdata cols=80 rows=30Paste document text here/textarea pinput type=submit value="Submit for verification" /form -END- TIA! Clayton -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- --- Joe Stump, PHP Hacker, [EMAIL PROTECTED] -o) http://www.miester.org http://www.care2.com /\\ "It's not enough to succeed. Everyone else must fail" -- Larry Ellison _\_V --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Download PHP from Linux machine?
well, you could load lynx, then type "G" (go) and type in "www.php.net" on the address bar, then navigate your way to the download page from there. (it's only one page deep into the site) that's how i did it at work on our linux machine. -Original Message- From: Simons [mailto:[EMAIL PROTECTED]] Sent: Friday, February 23, 2001 21:00 To: [EMAIL PROTECTED] Subject: Re: [PHP] Download PHP from Linux machine? try to "double quotes" the url ""Jorge Alvarez"" [EMAIL PROTECTED] gl 976k7t$2t2$[EMAIL PROTECTED]">news:976k7t$2t2$[EMAIL PROTECTED]... Hi there, I want to download PHP from my Linux server, but I can't just type "lynx http://www.php.net/do_download.php?download_file=php-4.0.4pl1.tar.gzsource_ site=www.php.net" This is the link in the PHP downloads page, but the shell gets confused by the character. What should I do? Best Regards, Jorge. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] MySQL execution order?
mysql executes the queries in the order it recieves them, (so if your program's logic executes a select before an update, you'll never see results from the update in your select... at least not normally :) Are you able to access the MySQL monitor program? if so, verify that the data really does exist before running your script (maybe the SELECT is failing beucase the actual data is incorrect, not the code...) go into the monitor and execute your SELECT statement, then run your PHP script... if the results still disagree, post some more information... - Original Message - From: "Don Johnson" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, February 21, 2001 5:19 PM Subject: [PHP] MySQL execution order? Since I've always found my answers in the archive, this is my first post, so please excuse any blunders... I'm trying to download info from a table as a tab-delimted text file. This part works fine. (By disabling the UPDATE statement in the code sample below, I can get the same data file sent time after time.) I need to keep the data in the table for future reference, and only want to download each new record once, so I added a DateTime field that gets updated after downloading. Then searching on that field gives me just the records that haven't been downloaded yet. The weird part is that it seems like the LAST MySQL command (UPDATE) gets executed before the FIRST one (SELECT), because the SELECT statement comes up with 0 rows. Here's some selected (modified) parts of the PHP code: First, I perform the SQL: SELECT * from db_table WHERE (DownloadedDateTime = '-00-00 00:00:00') Then, it parses and sends the info: while ($row = mysql_fetch_row($result)) { while (list($key, $val) = each($row)) { $val = ereg_replace("[\n\r\t]"," ",$val); $val = ereg_replace(" {2,}"," ",$val); echo $val . "\t"; } //end of line echo "\r"; } Then I perform the SQL: UPDATE LOW_PRIORITY db_table SET DownloadedDateTime=CURRENT_TIMESTAMP WHERE (DownloadedDateTime = '-00-00 00:00:00') -- Any ideas why the rows are getting the DownloadedDateTime field updated before they get SELECTed? Thanks, Don Johnson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Where do i look up return status codes?
for system("perl test.pl", $retval); and exec("perl test.pl", $ary, $retval); the value of $retval is the value that the perl script "test.pl" returns, (not a perl status code). as someone else suggested, go and look for exit(126) statements (or just exit(), if exit returns the value of a variable, and not the constant "126") within the perl script and you'll probably find a little note as to *what* the 126 means... - Original Message - From: "Chris Carbaugh" [EMAIL PROTECTED] To: "George Herson" [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 5:10 PM Subject: Re: [PHP] Where do i look up return status codes? I'm not familiar with perl, but I would said either the script it's self is returning the code, or the perl interpreter. Chris On Tue, 20 Feb 2001, George Herson wrote: Date: Tue, 20 Feb 2001 12:13:35 -0500 To: [EMAIL PROTECTED] From: George Herson [EMAIL PROTECTED] Subject: [PHP] Where do i look up return status codes? How do i find out what the return status of an exec() executed command means? For example, i have the line $ciphertext = exec("perl /home/httpd/cgi-bin/passgen.pl $plaintext",$arr,$retstat); which makes $retstat = 126. thanks, geo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] system()
i am not positive about this, but you could try making the amp process a background process by adding a " " to the end of the command line (at least if you're using *nix) -Original Message- From: Ashley M. Kirchner [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 00:40 To: PHP-General List Subject: [PHP] system() While doing a test run on an idea I have, I tried running the system() command on an audio application: ? system('amp -p song_one.mp3') ? ...and found out that it works when I load the file up in a browser - I get sound coming out from the physical web server's audio port. Don't worry, this was the expected behavior, and also what I wanted to happen. However, as the manual page says, system() will hang till the command is done running. I can hit the browser's Stop button, however the actual application is still running - and won't stop till the file is done playing I assume (or will it quit based on the webserver's time out value?) I suppose I can create a button on the same page that executes something like system('killall -KILL amp'); and be done with it. Haven't tried that yet. But, if I'm still crazy tomorrow and plan on continuing with this project, how should this be done properly? Obviously, 'holding' the browser while the program runs isn't the right way to do it. And I need a way to stop the audio somehow. The actual project looks something like this: The server has a few directories filled with mp3 files. I'd like to build a script that would dive into one of those directories (depending on the user selection), and present a list of all the songs, with a check box. The user can then select the ones s/he would like to hear and click a Play button and enjoy. The amount of selections can be anything, from one song, to all (should they want to sit there for 15 hours). However, when they click Play, I want the same page to be reloaded again, with nothing selected, and their (previous) selection to start playing in the background. If they want to change their selection, they can go ahead and pick other songs, and click Play again - THIS is where the previous instance of the 'amp' program should be killed, and a new one started, with the new play list queued. And of course, it should also have a Stop button on the page somewhere. A few notes on the amp program (for those that don't know it): I _CAN_ run several instances of it, and they will all output audio simultaneously through the port (unlike Windows which will tell you the audio device is busy). So, if I start it once with song_one.mp3 playing, and a second time with song_two.mp3 playing, you will hear both songs at the same time. (for that matter, I can run some 6 or 7 instances of the thing before the CPU starts to hiccup). It also doesn't exit till the file is done playing (I believe all players do this). I'm not asking for someone to actually build this for me, no. But I would be very grateful for some pointers, what can I do, and what I should not do, and what to avoid all together. It's something for my household to use, so they can listen to music through a simple interface, as opposed to having to log into the server and figuring out how/what to do through the shell, or X-Win interface. Am I crazy? -- H | Hi, I'm currently out of my mind. Please leave a message. BP! | ~ Ashley M. Kirchner mailto:[EMAIL PROTECTED] . 303.442.6410 x130 Director of Internet Operations / SysAdmin. 800.441.3873 x130 Photo Craft Laboratories, Inc. .eFax 248.671.0909 http://www.pcraft.com .3550 Arapahoe Ave, #6 .. . . . .Boulder, CO 80303, U.S.A. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] array
from the "unset" documentation on php.net // destroy a single variable unset ($foo); // destroy a single element of an array unset ($bar['quux']); // destroy more than one variable unset ($foo1, $foo2, $foo3); -Original Message- From: andreas (@work) [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 00:50 To: [EMAIL PROTECTED] Subject: [PHP] array hi, is there a function to delete an item of an array "1","7","14","33","99","A1","A12" id like to delete the "33" thank you andreas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] PHP as CGI
i had a very similar problem when i first setup PHP/Apache on my linux box... i forgot to add a line to my httpd.conf and got all sorts of "Cant find this" "Cant find that" type of errors my mistake was that i did not set ScriptAlias and Action correctly, and thus apache was having all sorts of problems executing my scripts becuase i put the physical path to php after my Action directive, rather than alias it via a ScriptAlias directive.. (silly me thought i could do away with the ScriptAlias and just point to it directly) make sure you have both of these (or something similar) in your httpd.conf file: ScriptAlias /php/ "/physical/path/to/php" Action application/x-httpd-php "/php/php" (and make sure to "killall -HUP httpd" after any changes to the conf files, although you probably knew that already... :) hope it helps. -Original Message- From: Hrishi [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 03:31 To: [EMAIL PROTECTED] Subject: Re: [PHP] PHP as CGI AddType application/x-httpd-php .php Action application/x-httpd-php /usr/local/php A) I'm not sure you need the "." on ".php" i've tried both with and without the '.' , but the server always responds : --- Not Found The requested URL /usr/bin/php4/test.php was not found on this server. Apache/1.3.3 Server at www.website.com Port 80 --- the installed CGI is php 4.0.3pl1, it runs fine from the command line. any ideas? thanks, Hrishi -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] question about multidimension array
-Original Message- From: Zenith [mailto:[EMAIL PROTECTED]] Subject: [PHP] question about multidimension array Consider the following code: $ary1 = array ("one","two"); $ary2 = array ("three","four"); $2d_Dimension[] = $ary1; $2d_Dimension[] = $ary2; // is $2d_Dimension a 2 dimensional array? yes... the "dimension" of an array is basically how many brackets you put after the variable name... 1D = $this[]; 2D = $this[][]; 3D = $this[][][]; etc // and the next question, how to get out content of the $2d_Dimension[] array while ( list ( $rec_no, $ary ) = each ( $2d_Dimension ) ) { echo ("Record No $rec_no:"); while ( list ( $element1, $element2 ) = each ( $ary ) ) echo "$element1, $element2"; } with a slight modification, that code works perfectly: (see end of email for why you probably got a parse error) ?php $ary1 = array ("one","two"); $ary2 = array ("three","four"); $twod = array($ary1, $ary2); while ( list ($rec_no,$ary) = each ($twod) ) { echo ("Record No $rec_no:"); while ( list ($key,$val) = each ($ary) ) echo "$key=$val; "; echo "BR\n"; } ? // I want to use the above code to print something like // Record No 0:one, two // Record No 1:three, four my code produces: Record No 0:0=one; 1=two; Record No 1:0=three; 1=four; suppress printing $key, and you'll get the output you want. // But I only got the following //Record No 0: //Warning: Variable passed to each() is not an array or object in d:/project/bizvista/testinc.php on line 27 What's the problem? if i use your code verbatim, i get a parse error becuase of the variable name starting with a digit, but as for the error *you* describe, when i put the loop inside of a function, and fail to declare $twod as global, i get the same error: "Warning: Variable passed to each() is not an array or object ..." make sure you declare all globals as "global $varname" in your functions... PHP is basically the reverse of almost every other language (things are local by default, global by declaration)... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] ASP / PHP / embedded scripting (possibly OT)
i dont know too much about ASP, as i've never had to use it, but i thought ASP as more of an enviornment (or meta-language) rather than an actual programming language (becuase VBscript is the default language for ASP pages, i always assumed that other languages could be utilized in place of VB(yuck)) could you use any other language aside from VBscript if the client mandates ASP, or is ASP tied to VB/Microsoft? the reason i ask is becuase i heard about a perl product that would basically do almost the same thing as PHP (put perl code in the HTML document, and the server would parse thru it when someone requested the page)... and i always thought that ASP was the meta-language that governed the rules for embedded programming (use ? to start script, etc... rules like that) rather than an actual *language* am i wrong? anyone care to clarify what ASP is, and what it's relation to PHP is on or off the list, whichever suits you ;) PS: please excuse me if you feel that i am off topic -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 10:16 To: Adrian Murphy Cc: [EMAIL PROTECTED] Subject: Re: [PHP] woe is me I feel your pain. :-( __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___+- On Mon, 19 Feb 2001, Adrian Murphy wrote: i'm sorry,i just had to share this with people who'd understand. we've just secured clients who are m$ affiliated and they insist everthing be done with asp. excuse me while i go off for a little cry. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] some more about include() and require()
include() will only load the file if the include() statement is encountered during the execution of your script if (1==0) { include("file"); } the file will never be include()'d, since the if/then will always fail. require() will always put the contents of the file being requie()'d into your script, regardless if it is executed or not... if (1==0) { require("file"); } the contents of "file" will be placed inside of the if/then, even though it'll never be executed. also, include() is evaluated every time it is encountered, whereas require() is only evaluated once... ** **From the PHP.net website documentation** The include() statement includes and evaluates the specified file. If "URL fopen wrappers" are enabled in PHP (which they are in the default configuration), you can specify the file to be include()ed using an URL instead of a local pathname. See Remote files and fopen() for more information. An important note about how this works is that when a file is include()ed or require()ed, parsing drops out of PHP mode and into HTML mode at the beginning of the target file, and resumes again at the end. For this reason, any code inside the target file which should be executed as PHP code must be enclosed within valid PHP start and end tags. This happens each time the include() statement is encountered, so you can use an include() statement within a looping structure to include a number of different files. include() differs from require() in that the include statement is re-evaluated each time it is encountered (and only when it is being executed), whereas the require() statement is replaced by the required file when it is first encountered, whether the contents of the file will be evaluated or not (for example, if it is inside an if statement whose condition evaluated to false). -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] what's the difference between include and require?? An unsuccessful include will give you an error. An unsuccessful require will kill the program. On Mon, 19 Feb 2001, Zenith wrote: Though I have read the manual about these two things, include() and require(), but I still not very clear about the difference between these?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] system()
is there something with the PHP system command that makes it unable to spawn nohup background processes perl and PHP are closely related, so i cant really understand how an external perl program would be able to do things that PHP couldnt (at least in terms of this specific problem) would a PHP call to "system('nohup ... ')" fail, or are your reasons for suggesting an external program based on something else other than simple feasability? ive never had to do anything like that before, and im not on a linux computer right now, so i cant test it myself. -Original Message- From: Christian Reiniger [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] system() On Monday 19 February 2001 21:00, ..s.c.o.t.t.. wrote: i am not positive about this, but you could try making the amp process a background process by adding a " " to the end of the command line (at least if you're using *nix) That alone won't help - "nohup" is also needed. What he could do is write a small Perl/C wrapper for amp, which launches the program in the background and returns its process id. Then he can do a $AmpPID = system ("launchamp $Arg"); (the wrapper would have to execute "nohup amp $Args ") and add a 'stop' link a href="ampstop.php?pid=?= $AmpPID ?"Stop/a And ampstop.php can do a system ("kill -KILL $pid"); However, when they click Play, I want the same page to be reloaded again, with nothing selected, and their (previous) selection to start playing in the background. If they want to change their selection, they can go ahead and pick other songs, and click Play again - THIS is where the previous instance of the 'amp' program should be killed, and a new one started, with the new play list queued. And of course, it should also have a Stop button on the page somewhere. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Session support in PHP (buffering output to browser)
there was an awesome article on phpbuilder about buffering output, controlling when things got to the browser... so that you could set cookies/headers anywhere in your script (or, as he talks about, gzip content on the fly beofre outputting it to the browser) http://phpbuilder.com/columns/argerich20010125.php3 PS: for anyone who doesnt know about phpbuilder.com yet, it is a very very good site, full of very very good information -Original Message- From: Kath [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 12:54 To: Sascha Andres; [EMAIL PROTECTED] Subject: Re: [PHP] Session support in PHP Make sure there are no lines (except a ?php of course) above your session_start(), INCLUDING blank lines. Example that will work: ?php session_start(); ? HTML yadda yadda yadda etc etc etc Example that will not work: ?php session_start(); ? HTML yadda yadda yadda etc etc Hope this helps, Kath - Original Message - From: "Sascha Andres" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Monday, February 19, 2001 2:38 PM Subject: [PHP] Session support in PHP hi, when doing a session_start() followed by session_register(...) before the html header the first call stops with the error 'html header already written'. how can i prevent the html header to be written until the session_start() is called? sascha -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Libraries (OT)
well, i agree about writing some of my own libraries it helps me get to know the language and the features that i am using better. Libraries are a "Good Thing", it's just that i've seen loads of people ask questions (on other lists mostly, since im new here) about things that they'd know about if they had rolled their own modules once in a while. personally, i feel that it's problematic when a person uses another person's libraries/modules/code without really understanding what the code does... -Original Message- From: Kath [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] Libraries I don't exactly try to reinvent a new and better wheel... I just find that writing my own libraries makes the site feel like it is more all mine. - Kath -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] mysql problem
ahhh... yes... :) the linux version is much stricter when it comes to table definitions... i had the same problem trying to declare an INDEX for my table too for linux, any key that you use as an INDEX on a table must be declared NOT NULL (whereas the win32 port doesnt seem to care very much)... for future reference, i reccomend trying out your SQL code in the MySQL monitor (the command line utility that comes with the server)... generally the error messages are *MUCH* more helpful than the ones i get via PHP -Original Message- From: Josh G [mailto:[EMAIL PROTECTED]] Sent: Monday, February 19, 2001 17:00 To: PHP User Group Subject: Re: [PHP] mysql problem Ok, I've fixed the problem, it seems there's some major differences between the linux / win32 ports of the client. instead of blah integer primary key auto_increment which works on windows, I used blah integer not null auto_increment primary key and now it works... I love computers, I really do. Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "Josh G" [EMAIL PROTECTED] To: "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:42 AM Subject: Re: [PHP] mysql problem Nope, I've been using autoincrement on that box for a year or so. It's not a copy/paste thing, cause I'm getting it when I type the lines in by hand, too... Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "David Robley" [EMAIL PROTECTED] To: "Josh G" [EMAIL PROTECTED]; "PHP User Group" [EMAIL PROTECTED] Sent: Tuesday, February 20, 2001 11:41 AM Subject: Re: [PHP] mysql problem On Tue, 20 Feb 2001 10:57, Josh G wrote: Hi, sorry to post this here, but it's driving me crazy. On my local machine, the following works no furys: create table category (category_id integer primary key auto_increment,name varchar(255) ); But on the production machine, I get: ERROR 1064: parse error near 'auto_increment,name varchar(255) )' at line 1 Any idea why It's driving me nuts.. Gfunk - http://www.gfunk007.com/ Is the version of Mysql on the production box an older one? autoincrement is comparatively new, I think. -- David Robley| WEBMASTER Mail List Admin RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/ AusEinet| http://auseinet.flinders.edu.au/ Flinders University, ADELAIDE, SOUTH AUSTRALIA -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Can I select only the newest record?
yes, that will work... however, if you're trying to select from a table that lacks an explicit AUTO_INSERT field, yet has an incrementing field (DATETIME is one that comes to mind), selecting the LAST_INSERT_ID wouldnt work... -Original Message- From: PHPBeginner.com [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 03:12 To: ..s.c.o.t.t..; Php-General Subject: RE: [PHP] Can I select only the newest record? I wonder, if LAST_INSERT_ID will work in here... I know it works when on the same file was an insertion.. but will it return you the last ever inserted id, say a week ago? I feel like it won't, but don't know for sure... try it... Sincerely, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) [EMAIL PROTECTED] www.phpbeginner.com -Original Message- From: ..s.c.o.t.t.. [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 4:59 PM To: Php-General Subject: RE: [PHP] Can I select only the newest record? there are two ways that come to mind of doing this if you're using some kind of auto-incrementing field (not necessarily AUTO_INCREMENT, but any field that increases [or decreases] with time) this will select the entire row, but limit the query to only return 1 result (and depending on how your order, this result could be the highest/lowest value of the field): (to get highest value of field id) SELECT * FROM mytable ORDER BY id ASC LIMIT 1; (to get lowest value of field id) SELECT * FROM mytable ORDER BY id DESC LIMIT 1; PS: there's probably a more efficient way to do it, but this is what came to mind at the moment... -Original Message- From: Brian Drexler [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 20:22 To: Php-General Subject: [PHP] Can I select only the newest record? Using PHP3/MySQL, is there a way I can select only the newest record from a MySQL table. I have a datetime field and an Auto_incremented field. Anyone got any ideas??? Brian Drexler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Simple REGEX?
well, if the only characters that you want to allow are alphanum/space/underscore, you could use a perl regexp to match against anything *other* than those things...(a positive match would indicate that the string being matched had invalid characters in it) use this: preg_match('/[^\w\s]/', $input); (to see an explanation of why this works, please read the bottom of my email... i give a short breakdown of it) if you want to allow any more characters, simply place the character you want to allow within the brackets, and any instance of that character in the string to be matched will be ignored (rather than matched) for example, to allow periods and question marks in your input (without getting a positive match on the regexp), modify it to look like this: '/[^\w\s\.\?]/' what will match and what will not match using this regexp: print preg_match('/[^\w\s]/', $t); $t = "ea!ti_t99"; will print "1" since the "!" will match the regexp $t = "Hello one_two" will print "0" since nothing matches $t = "How *are* you" will print "1" since the "*" matches the regexp works like this: [ ] = character class ^ = not \w = alphanumeric \s = space the character class brackets are just to let the regexp know that the things inside of it are to be matched one by one against the string. "[suv]" would not match the entire string "suv", but rather "s" or "u" or "v", so "[\w\s]" would match any string that had an alphanumeric character or whitespace in it. since you want to find strings that have NOT-alphanum or NOT-space, you simply negate the character class that will match alphanum and space, by adding a "^" to it... making it "[^\w\s]" (match anything that is NOT an alphanumeric or space character - meaning match any string that has invalid characters). if you want to allow other characters into your input, just add them into the character class. if you find that you need to allow "?" into your input, use this "[^\w\s\?]"... and it will match any string that does NOT have alphanum/space/?, meaning that it will match any string with invalid chars. -Original Message- From: James, Yz [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 12:15 To: [EMAIL PROTECTED] Subject: [PHP] Simple REGEX? Hi guys, I'd like to restrict the characters a client is inputting to a database. I already have a system that'll exclude certain characters. Alpha Numerics are permitted, together with the underscore and spaces. Is there a collective expression for the following characters? : !",.?@() Because I'd like to allow those too. And I'm useless with RegEx. Thanks as always, James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Apache config
any good .conf files? ...mine reads like a stephen king novel :) it's easy... if you go to php.net and read thru their installation documentation, there are about 4-5 lines total that you need to add to your httpd.conf (at least when you install php as a stanalone cgi) to get apache to properly handle php content... took me about 5 minutes to add the lines, restart apache, and get my first "Hello world" php script to greet me :) im using win2k myself, so if you have any severe trouble, i could possibly help you out... -Original Message- From: Sitkei es Tarsa Bt [mailto:[EMAIL PROTECTED]] Subject: [PHP] Apache config Hi, I would like to use Apache and PHP4 on W2K. If you have any good Httpd.conf file for the Apache, please send me. Thank you. Paul. [mailto:[EMAIL PROTECTED]] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Count of multi-dimensional array
it's not very elegant, but i havent come across any PHP core function that will do what you asked, so here's a little loop that will return the total length of a multidimensional array $total = 0; for ($i=0; $i count($myarray); $i++) { $total += count( $myarray[$i] ); } print $total; in your case, it will (should) print "8" -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 09:52 To: bill Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Count of multi-dimensional array count($myarray) will give you 3 On Sat, 17 Feb 2001, bill wrote: How can i get the count of a multi-dimensional array? if I have $myarray[0][chicken] $myarray[0][fish] $myarray[0][meat] $myarray[1][fries] $myarray[1][chips] $myarray[2][coke] $myarray[2][pepsi] $myarray[2][rootbeer] How can I get the number of first elements (which would be 3 above)? thanks, bill -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Determingin if cookies are useable?
hmmm... what i would do is set a cookie named "cookies_enabled" in the very beginning of your site, and check for the presense of that variable in places that you need cookie functionality... logically, if $cookies_enabled isnt set, it means that the cookie doesnt exist (and thus cookie support for the browser is lacking or dismal) -Original Message- From: John Vanderbeck [mailto:[EMAIL PROTECTED]] Subject: Re: [PHP] Determingin if cookies are useable? Well, since cookies are set in the header, I would say you would have to at least refresh the same page. I'm just putting a cookie into my home page for now. and it will be checked in just afew areas of the site that REQUIRE the cookies to work right. - John Vanderbeck - Admin, GameDesign -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] checking image extensions
or, a bit more concisely, you could use a regexp... to allow only jpg/gif/png file formats, setup the regexp to match on those three formats, and yell at people who submit anything other than those three $imgName = "one.jpg"; if (! preg_match('/\.(jpg|gif|png)$/', $imgName) ) { print "file format is not supported!"; } -Original Message- From: John Vanderbeck [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 08:27 To: Alvin Tan; Php-General Subject: Re: [PHP] checking image extensions Hi, Newbie question here. I'm trying to write a function to check an image extension, part of the code is: if (substr($imgName, -4) != ".jpg") if ((substr($imgName, -4) != ".jpg") || (substr($imgName, -4) != ".gif")) { echo "P CLASS=ErrorI'm sorry, but the ikmage format you submitted is not a supported format./P"; } - John Vanderbeck - Admin, GameDesign -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Stylesheets
well, CSS support in netscape 4 is abyssmal to begin with, and it's a 5 year old browser, so i would venture to guess that's why you cant get anything to look the way it should... i never thought i'd see the day when MSIE was more standards compliant and more stable than netscape... (well, at least until netscape 6 is finalized and non-beta code :) -Original Message- From: Christian Reiniger [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 06:09 To: PHP List Subject: Re: [PHP] Stylesheets On Saturday 17 February 2001 10:26, Michael Hall wrote: I'm building a PHP application which uses stylesheets. Stylesheets seem to be broken in a big way on my system - using Netscape 4 something on Red Hat 6.1. Is this Netscape or somehow something to do with PHP? Things work as Do you have javascript turned of? Netscape4 only interprets CSS if javascript is enabled. -- Christian Reiniger LGDC Webmaster (http://sunsite.dk/lgdc/) Drink wet cement. Get stoned. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] using a regular expression to trim whitespace
there's a much easier way to get rid of whitespace and linebreaks at the end of a variable than using a looped ereg_replace (as i previously suggested) 1) use trim() 2) use preg_replace('/\s*$/', '', $input) both will cremate spaces and linebreaks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] REGEX prob
did you check the value *before* writing it to a file? before trying to solve any problem, you have to know where to look perhaps the problem lies with the file instead of the regexp. the following code worked great for me: ?php $html='a href="link.htm?something=valueflag=982420537PHPSESSID=2c86b460d360b13c3ef08b8a46b9c afc"Lnk/a'; $html = preg_replace('/flag=(\d{9})PHPSESSID=(\w{32})/', append_url(), $html ); print $html; save_url($html); die("Done"); function append_url() { return "new_url=this"; } function save_url($html) { if ( !($f = fopen('test.txt', 'w')) ) { die("Cannot write file"); } else { fwrite($f, $html); fclose($f); } return 1; } ? -Original Message- From: n e t b r a i n [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 12:49 To: [EMAIL PROTECTED] Subject: [PHP] REGEX prob Hi all, I'm trying to match a particular piece of string in a big string using a regex in order to change it whith another value ... I mean: eg: $html="a href=link.htm?flag=982420537PHPSESSID=2c86b460d360b13c3ef08b8a46b9cafcLnk /a"; function change_sess($html_code){ if(eregi("flag=[0-9]{9}PHPSESSID=[[:alnum:]]{32}",$html_code)){ str_replace("flag=[0-9]{9}PHPSESSID=[[:alnum:]]{32}","?=append_url();?", $html_code); } } change_sess($html); ... $fp=fopen($my_file,"w"); fwrite($fp,$html); ... But open the $my_file, the changes are not applied ... (I mean: there's always the original string -- flag=982420537PHPSESSID=2c86b460d360b13c3ef08b8a46b9cafc) Anyone could help me, please? many thanks in advance max -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] more on trimming
well, there are two solutions, 1) for variables with only whitespace to be trimmed 2) variables with whitespace and \n to be trimmed 1) solution: the way i'd do it too is regexp... very similar to your solution (you're on the right track, but just needed to take that final step) $var = "This is a variable "; print ".". ereg_replace('( +)$','',$var) ."."; this will print ".This is a variable." the regexp replaces all whitespace at the end with nothing. "$" means to match at the end, and "( +)" means to match one or more spaces 2) solution: for text with mixed linebreaks and spaces, i cannot seem to find a single regexp that'll compile, so i came up with a bad emulation of perl's s//g (global replace) by using a while loop to keep checking if there's any more crap that needs to get cut off the end... $var = "This is text with linebreaks and spaces "; while (ereg("(\n| )$", $var)) { $var = ereg_replace("(\n+| +)$",'',$var); } print "$varBR\n"; prints: "This is text with linebreaks and spaces" (with no further linebreaks *or* spaces after the word "spaces") PS: if anyone out there is more familiar with PHP/regexps than i am, could you please send me an email explaining how to get global pattern matching (ala perl's s///g command) in PHP?? i cannot seem to find any switches for ereg that make it match global -Original Message- From: jaskirat [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 00:17 To: [EMAIL PROTECTED] Subject: [PHP] more on trimming Since this thread is running I would like to know the gurus' opinons on the similar following situation Suppose there is a variable like this $var = "This is a variable "; Now I want to strip off white spaces on the end without losing them in the middle of the sentence .. I had figured that there is a no direct way of doing it and some thing like this works $var = trim (ereg_replace(" ","",$var)); the first argument to ereg_replace is "two spaces" so that single spaces between the words are not removed then trim to remove any space on the end which may still remain. But I feel its still not a fool proof solution because there may be two spaces in between words some where also which will then be clubbed together. Any body has a better idea. Jaskirat -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] location
you could possibly store the name/password as cookies, so that they're available to the PHP script without the user having to type them in more than once per session (or even longer if you set the expire date properly) i know that cookies are horribly insecure, but for purposes of a very simple validation routine, cookies are sufficient) if ( !validate_user($ck_name,$ck_pw) ) { print "you are not logged in, please go log in"; } else { print "you are logged in"; } function validate_user($ck_name, $ck_pw) { //make whatever calls you need to the database //to see if this name/pw combination are valid. //return 1 if good, return 0 if bad } -Original Message- From: jaskirat [mailto:[EMAIL PROTECTED]] Sent: Saturday, February 17, 2001 00:30 To: Brandon Feldhahn; [EMAIL PROTECTED] Subject: Re: [PHP] location make a function which validates users. Then where ever you want to restrict access just call that function before other things .. and it will do the trick where ever you need .. no if statements needed. HTH Jaskirat At 11:47 PM 2/16/01 -0800, Brandon Feldhahn wrote: how would i make somthing in a IF statement that would take somone to the members page when they get the login correct -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] search
it's such a complex question and answer that i really think you need to ponder some more fundamental design concepts before you ask for advice on actually coding the thing... such as what type of database layout fits the type of information you will be storing/searching/retrieving, how you want to categorize the information in your database, how the interface will look and operate (do you want to allow boolean expressions, or just search for any occurence of any word in the search field) to get a very simple searcher thing working, it's not very hard (ive done it in perl/MySQL for a site that had about 20 static HTML pages and some news stories in a database table) and it took me about half a day however, you have to know what you want to accomplish beforehand or else you'll bang your head against the wall quite often during development :) if you're going for an exremely simple searcher with few features and not too much flexibility, i'd reccomend creating a keyword lookup table that simply relates keywords to the thing they refer to (HTML page, PHP page, etc...) the table might look a bit like this, if you had two pages and a total of two keywords: key| page --| "foo" | "firewall.html" "bar" | "vpn.html" "bar" | "firewall.html" then, when people entered either "foo" or "bar" (or "foo bar") into your search field, the resulting query would be a list of pages that were associated with either (or both) of those keywords. "foo" = "firewall.html" "bar" = "vpn.html" "foo bar" = "firewall.html" and "vpn.html" -Original Message- From: Brandon Feldhahn [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 23:07 To: [EMAIL PROTECTED] Subject: [PHP] search How do i make a php and MySQL search engine? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] PHP Book Recommendations
I agree... The red book "Professional PHP Programming" (WROX "Programmer to Programmer" series) is an exellent PHP book but, if you're looking for novice level stuff, WROX also published a companion called "Beginning PHP4". i was fluent in perl when i picked up the professional one, and had no problems with it... but i wouldnt reccomend it to people with little or no programming experience... the professional book seems to take for granted a grasp of fundamental programming concepts, if you're a true novice, get the "beginning php4" one first (and then professional :) - Original Message - From: "John Monfort" [EMAIL PROTECTED] To: "Brian V Bonini" [EMAIL PROTECTED] Cc: "PHP Lists" [EMAIL PROTECTED] Sent: Friday, February 16, 2001 5:26 PM Subject: Re: [PHP] PHP Book Recommendations Profession PHP Programming ISBN: 1-861002-96-3 __John Monfort_ _+---+_ P E P I E D E S I G N S www.pepiedesigns.com "The world is waiting, are you ready?" -+___+- On Fri, 16 Feb 2001, Brian V Bonini wrote: Can I get some recommendations on some good PHP books. Something broad but with good novice concepts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Finding the? in $REQUEST_URI?page=blah
i'd use split, to split the value up into an array: if this is your url $url = "/pages/error.php?/pages/login.php?user=scott"; and use this code: $thing = split('\?', $url); print $thing[0] ." BR\n "; print $thing[1] ." BR\n "; print $thing[2] ." BR\n "; output will be: /pages/error.php /pages/login.php user=scottx - Original Message - From: "James, Yz" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 16, 2001 5:57 PM Subject: [PHP] Finding the? in $REQUEST_URI?page=blah I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds. OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: form method="post" action=? echo "$REQUEST_URI"; /* Minus the suffix the page may include */ ?" Username: input type="text" name="username"r etc/form Can anyone help? Thankees :) James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Can PHP execute a refresh to a new page?
i've been using the header("...") approach myself, but was curious to see if there's a builtin PHP function that will accomplish the same thing im a kind-of new PHP programmer, and havent really been exposed to too much of the language yet, but i found it quite odd that such a function seems to be absent from the core language, since it's a web based language... and moving a browser from one URL to another is quite common among web scripts. -Original Message- From: Chris Lee [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 20:01 To: [EMAIL PROTECTED] Subject: Re: [PHP] Can PHP execute a refresh to a new page? HTTP can also tell a broswer to 'refresh' ? header("Location: http://$SERVER_NAME$PHP_SELF"); ? -- Chris Lee Mediawaveonline.com em. [EMAIL PROTECTED] ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Kenneth R Zink II"" [EMAIL PROTECTED] wrote in message 014501c09890$cf4322d0$[EMAIL PROTECTED]">news:014501c09890$cf4322d0$[EMAIL PROTECTED]... Can PHP execute a refresh to a new page? If so, how? Thanks. Kenneth R Zink II [EMAIL PROTECTED]ICQ# 5095094 '87 2.8L TBI GMC S-15 Ext. Cab (Hurricane) ...524 in the works !!! http://www.s-series.org/htm/windstorm/project-windstorm.htm '85 3.4L Carbed Chevy S-10 Blazer (FireStorm) ...Soon to be 3.4L SFI DIS !!! http://www.s-series.org/htm/firestorm/firestorm.htm Racing by the Grace of God!! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Finding the? in $REQUEST_URI?page=blah
with slight modifications, yes... that will work. 1) PHP doesnt support built-in regexp's (which is a constant sore in the side of any perl programmer) so you'll have to ditch the /:/ for ':' 2) you have to declare lists as list(), unlike the assumed behaviour in perl when it sees () = ... this is how you'd do it in PHP $str = 'C:programs:this:that.exe'; list($one, $two) = split(':', $str); print $one ."BR\n"; print $two ."BR\n"; not very different, but different enough to be annoying :) -Original Message- From: John Monfort [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 16:57 To: ..s.c.o.t.t.. [gts] Cc: php-general Subject: Re: [PHP] Finding the? in $REQUEST_URI?page=blah Is the PHP split command the same as that in Perl? ex. ($var_1, $var_2) = split(/:/,$string, 2); will something like that work? On Fri, 16 Feb 2001, ..s.c.o.t.t.. [gts] wrote: i'd use split, to split the value up into an array: if this is your url $url = "/pages/error.php?/pages/login.php?user=scott"; and use this code: $thing = split('\?', $url); print $thing[0] ." BR\n "; print $thing[1] ." BR\n "; print $thing[2] ." BR\n "; output will be: /pages/error.php /pages/login.php user=scottx - Original Message - From: "James, Yz" [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Friday, February 16, 2001 5:57 PM Subject: [PHP] Finding the? in $REQUEST_URI?page=blah I really wouldn't ask this if I wasn't completely exausted, but the last thing I feel like doing just now is reading up on this when someone can probably answer it in a matter of seconds. OK, I've an error handling page. Basically, I want to split (that might even be one of the functions I'll have to use) this sort of url: error.php?/pages/login.php?username=name into: /pages/login.php I'm using : header("location: error.php?page=$REQUEST_URI"); When echoing the request_uri back on the error page, it omits the error.php? bit, so I get: login.php?username=name The reason I want to do this is so that I can use a re-login form that will submit to the page the user has badly logged into, so if they logged in to main.php, the request_uri would be something like: /pages/main.php?username=name Which I'd want to rebuild on the error page, into a form, like: form method="post" action=? echo "$REQUEST_URI"; /* Minus the suffix the page may include */ ?" Username: input type="text" name="username"r etc/form Can anyone help? Thankees :) James. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Can I select only the newest record?
there are two ways that come to mind of doing this if you're using some kind of auto-incrementing field (not necessarily AUTO_INCREMENT, but any field that increases [or decreases] with time) this will select the entire row, but limit the query to only return 1 result (and depending on how your order, this result could be the highest/lowest value of the field): (to get highest value of field id) SELECT * FROM mytable ORDER BY id ASC LIMIT 1; (to get lowest value of field id) SELECT * FROM mytable ORDER BY id DESC LIMIT 1; PS: there's probably a more efficient way to do it, but this is what came to mind at the moment... -Original Message- From: Brian Drexler [mailto:[EMAIL PROTECTED]] Sent: Friday, February 16, 2001 20:22 To: Php-General Subject: [PHP] Can I select only the newest record? Using PHP3/MySQL, is there a way I can select only the newest record from a MySQL table. I have a datetime field and an Auto_incremented field. Anyone got any ideas??? Brian Drexler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]