[PHP] dates problem
I'm having a prowith determing a time interval. I need to find out how many seconds, minutes, days have passed since a cpecific date (1.1.1980.), but when I pass that dade to a time stamp , I get 1983.315529200. How am I suposed to handle the year (1983.) o there is smething else ? I think the only way to do this is to make the time stamp for the interval between now and the specific date. thanx Nikola Veber -- 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] how to pass authentication info to SMTP server
Hi Ramsus and Renze, I would like to implement sending an e-mail through SMTP server. Here my SMTP server needs authentication. How to pass the username and password to SMTP server?? Thanks in advance. Regards -Balaji -- Information transmitted by this E-MAIL is proprietary to Wipro and/or its Customers and is intended for use only by the individual or entity to which it is addressed, and may contain information that is privileged, confidential or exempt from disclosure under applicable law. If you are not the intended recipient or it appears that this mail has been forwarded to you without proper authority, you are notified that any use or dissemination of this information in any manner is strictly prohibited. In such cases, please notify us immediately at mailto:[EMAIL PROTECTED] and delete this mail from your records. - -- 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: run a script for any HTTP request (was: run a script on access toa directory)
Jason thanks! your information about those 512 bytes is VERY useful but just a lil' too late, i already came up with a solution using a conditional URL rewrite rule in my apache, along with a " ForceType .." which helps me invoke my php script, if anyone is interested i can send out the details, it actually executes the php script for every http request received by the apache server. Rasmus, thanks for your efforts on PHP development, we ALL owe you big time. I hope you succeed with that request_rec stuff soon, i spent some 4 hours making possible that a script be invoked for every http request... this has to be easier for next PHP version! Thanks to everyone who *at least* tried to help. Enrique- >From: Rasmus Lerdorf <[EMAIL PROTECTED]> >To: Jason Bell <[EMAIL PROTECTED]> >CC: Enrique Vadillo <[EMAIL PROTECTED]>, ><[EMAIL PROTECTED]>, <[EMAIL PROTECTED]> >Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a script >on access to a directory) >Date: Fri, 7 Sep 2001 15:13:10 -0700 (PDT) > >Sure, I know that very well, but that has nothing to do with what we are >discussing here. > >-Rasmus > >On Fri, 7 Sep 2001, Jason Bell wrote: > > > IE has "Friendly Error Messages" so on a normal 404 response, IE would >show > > it's own error message, and not the one from the server. The Documented >way > > around this is to ensure that your 404 document is larger than 512 >bytes. > > > > http://www.zdnet.com/products/stories/reviews/0,4161,2779295-3,00.html > > > > > > - Original Message - > > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> > > To: "Enrique Vadillo" <[EMAIL PROTECTED]> > > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > > Sent: Friday, September 07, 2001 2:45 PM > > Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a >script > > on access to a directory) > > > > > > > What do you mean MSIE does not support 404 ErrorDocument? That is a > > > server-side function. It has absolutely nothing to do with the >browser. > > > Try going to: http://php.net/strlen > > > > > > That is an ErrorDocument 404 thing that kicks in and takes you to the > > > right place in the PHP documentation. And believe me, it works just >fine > > > for people using MSIE. > > > > > > Right now an ErrorDocument 404 is the only way to do this. I am >currently > > > working on the framework to allow PHP scripts to be inserted at any >stage > > > in the Apache request_rec handler mechanism. This would allow you to >run > > > a PHP script to translate uri's to on-disk pathnames for example, >write > > > Apache authentication modules in PHP and many many other efficient >ways to > > > shoot yourself in the foot. Needs another week or two of development > > > before it will be ready for serious testing though. > > > > > > -Rasmus > > > > > > > MSIE does not support 404 ErrorDocument, that only works fine > > > > with Netscape. Rewriting URLs is nasty when you have to mix > > > > it with php script writing, this could be so much simpler with > > > > a php script. > > > > > > > > I know it's a tough question, anyone dares to beat the problem? > > > > > > > > Enrique- > > > > > > > > >From: Philip Hallstrom <[EMAIL PROTECTED]> > > > > >To: Enrique Vadillo <[EMAIL PROTECTED]> > > > > >CC: <[EMAIL PROTECTED]> > > > > >Subject: [PHP] Re: run a script for any HTTP request (was: run a >script > > on > > > > >access to a directory) > > > > >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT) > > > > > > > > > >What's wrong with rewriting urls? The other alternative is to make > > sure > > > > >that none of the urls you are accessing actually exist and then >setup > > an > > > > >ErrorDocument handler which calls the php script of your choice... > > which > > > > >can then do whatever you want... > > > > > > > > > >-philip > > > > > > > > > >On Fri, 7 Sep 2001, Enrique Vadillo wrote: > > > > > > > > > > > That was a fine idea Doug, but what if we push the subject and > > > > > > go a little further? > > > > > > > > > > > > I am thinking now that i'd like to make it possible that for > > > > > > ANY http request received by my Apache i'd like to have a php > > > > > > script executed first, i.e.: > > > > > > > > > > > > http://domain.com/ > > > > > > http://domain.com/anydir/anyfile > > > > > > > > > > > > for any of those locations typed, i'd like to be able to > > > > > > execute the php script. i know it's kinda weird but this is > > > > > > what i'm really looking for. any ideas anyone? > > > > > > > > > > > > Enrique- > > > > > > > > > > > > _ > > > > Descargue GRATUITAMENTE MSN Explorer en >http://explorer.msn.es/intl.asp > > > > > > > > > > > > > > > > > > > > > -- > > > 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
Re: [PHP] how to execute a php script thru a cron job
thanks daniel, but how do i add it to the cron job for daily execution ? regards carry On Thursday, September 06, 2001 at 10:51:00 PM, Daniel Rezny wrote: > Hello Carry, > > Thursday, September 06, 2001, 5:05:53 PM, you wrote: > > CI> hello, > > > > CI> can anybody suggest me how to execute a php file thru a cron job? > > CI> i have a php script which checks for invalid links in my links database and >mails the result to the site admin if any 400 series errors are found. > > > > CI> thanks in advance. > > If you have a binary php version you can do it like this: > /path/to/php/binary /path/to/script > > Or you can do it thru lynx like this: > /path/to/lynx -dump www.some_server.com/script.php > > I hope it helps. > > -- > Best regards, > Danielmailto:[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] > > Carry Ian e-mail: [EMAIL PROTECTED] -- Get real solutions to all your problems. http://www.salahkarindia.com - India's first advisory Portal Your friend, advisor, healer,companion!!! Register now to get free advice on all your problems. -- -- 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] files
hey, I have a large file and I want to keep the last x row of it. I figured out how to navigate to the point where I want to extract the data, but I cant figure out how to extact from the file current $fp and write out the data to another file. Think of it like this, when the file gets to be x bytes, get the last 20 lines from it and copy it to another file, so that I could dump the old and replace it witht the new Thanks. <--snip of example code--> $fp = fopen("./chat/chat.txt", "r+"); $size = filesize("chat/chat.txt"); $count = 0; while (!@feof($fp)) { $lines = fgets($fp, 4096); $count = $count + 1; } $count--; // return the correct # of lines in file echo "Lines: $count"; $offset = round($count - ($count / 4)); echo "Offset: $offset"; $count = 0; rewind($fp); while ($count < $offset) { $lines = fgets($fp, 4096); $count = $count + 1; } echo "New Offset: $count"; $file = fread($fp); if (!copy($file, $file.'.bak')) { print ("failed to copy $file...\n"); } fclose($fp); -- 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 MySQL
Hello, we're using our MySQL database quite extensively from our PHP scripts, but sometimes everything stops working and it says "Too many connections". Is there a problem with MySQL support from within PHP? Doesn't it close its connections with the database when the script stops executing? Is there anything I can do to resolve this problem? Regards, Pieter Philippaerts -- 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] Reprise of dissapearing session variables
ok! I've been trying to figure this out, and I'm completely stumped! I've started from scratch with a test script, here is my code: Testing"; print $PHPSESSID; print "\$sess_name is: $sess_name\$sess_auth is: $sess_auth"; if ($go) { print "Go was initiated"; $sess_name = "BillyBob"; }; if (session_is_registered("sess_name") != FALSE) { print "\$sess_name is registered with the session!"; } else { print "\$sess_name is NOT registered with the session!"; }; ?> The session variables will remain set, but will it looks like my session gets lost every now and then if you want to see an example, go to http://northpointless.org/test.php and hit refresh several times. I cannot figure out what is happening.
[PHP] Iffy W2K, dodgy PHP or sketchy programmer?
Been up for four f**g hours too late trying to find something wrong with my code, lately finding out, that there apparently is nothing wrong with it (in this particular case). I wish for verification. As a developement box I run a W2K, newest Apache and PHP 4.0.whatnot. Had this problem of first page loaded not getting a SID. It required reloading once, before sessions started working for itself. Impossible to accept, since login (through a different file) is possible straight from this page. Header("location: referer etc") sending me back to the unsessioned page. No amount of forceful SID entries helped. Got very annoyed and pulled one of those sure-to-work "hello world" programs: Counter initialized, please reload this page to see it increment"; } else { echo "Waking up session $PHPSESSID"; $SESSION["count"]++; } echo "The counter is now $SESSION[count] "; ?> Guess what, it did not work either. Except that it did, uploaded to the providers server (basic unix stuff. More or less the same version on PHP), as did my own script. Now why is that? Does someone know a explanation/remedy for this, since it makes developing slightly inconsistent with this requiring that gimmick and that not. Regards to anyone caring to answer. - Jon Thompson Coon -- 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] Ordering a query
I use the following code to order the results of the query by the variable $order. $result = mysql_query("SELECT articles.title,vote.votes,vote.total,articles.date,staff.firstname,articles.content,articles.id FROM staff,articles,vote WHERE articles.authorid = staff.id AND articles.id = vote.item ORDER BY `$order` DESC",$db); I assign the variable a value according to my url, http://www.mysite.com/file.php?order=something My question is. Is there a way of assigning the $order variable a default value? Like if they hit http://www.mysite.com/file.php without the order=something can I tell the script to assign $order a default value? Thanks, Nate
[PHP] Delete top 2 lines (was file management)
Here is what Im attempting $size = filesize("chat/chat.txt"); // get size of file if (filesize("chat/chat.txt") > 500) { // if over x bytes chop it down $fp = fopen("./chat/chat.txt", "r+"); // open a fp $count = 0; // setup a count while (!@feof($fp) && ($count < 2)) { //if not eof & < 2 rewind($fp); // go to beginning $bytes = fgets($fp, 4096); // get the # of bytes in line ftruncate($fp, $bytes); // kill line with # of bytes $count = $count + 1; // increment count } // end while loop fclose($fp); // close fp } // close if here is what is happening currently, when the file goes over 500 bytes, the whole file gets dumped, not what I want. The form Im using can only put out 109 bytes plus /n total. In this example (if you want to call it one), I would like it to kill the first 2 lines in the file. Thanks to Hughes for putting me on to this, its a little clearer... Gerard Samuel wrote: > You know what, I think Im explaining myself wrong. The word truncate in > itself means I believe to cut at the bottom. This isn't what I need. > Basically, its a chat script and all the newer messages are at the > bottom, and when the file reaches x bytes I want to 'cut off the head' > of the file by x lines. leaving the most current messages at the bottom > alone. > Ive been messing around with truncate all this time getting the wrong > results. Why cant files be as easy as databases :) > If any one has a clue please point it to me. > Meantime, back to the manual. > Thanks > > Sterling Hughes wrote: > > On Fri, 7 Sep 2001, Gerard Samuel wrote: > > > > > >>Can a file be truncated from the beginning, and by x amount of lines?? > >>Thanks > >> > >> > > Truncated from the beginning? Do you mean truncate the file by X > > lines, starting from the first position in the file, well, yeah: > > > > > $fp = fopen("filename", "r+"); > > > > // Start counting from 0, set to one, if you want to start counting > > // from 1 > > $count = 0; > > > > while (!@feof($fp)) { > > // Not used, but unless your line lengths are longer than > > // 4K, this will effectively skip over a line > > $line = fgets($fp, 4096); > > > > if (++$count == $line_number_you_want) { > > ftruncate($fp, ftell($fp)); > > } > > } > > > > fclose($fp); > > ?> > > > > Please note the above is devoid of error checking :) > > > > -Sterling > > > > > > > > > > -- 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: php.ini not being read
> I am positive. > /etc/rc.d/init.d/httpd stop > /etc/rc.d/init.d/httpd start > I have never touched the apache installation. I am currently under the > impression that compiling > with --with-config-file-path=/etc/httpd/conf/php.ini has screwed up the > install. That is unless someone has any other ideas? > > My first question really is if the php install doesn't find the php.ini does > it use built in defaults? That would help explain why my changes aren't > active. > > I asked this because I noticed when I made changes to the session > configuration they were never realised in the pages I am running. Yes, the built-in default will be used if you have no php.ini file. Or if PHP can't find it. The phpinfo() page will tell you where it is looking for it to be. -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] Re: php.ini not being read
>Is php.ini readable? > >Any messages in your Apache error log? No messages in the apache error logs. >Are you 100% sure you really killed Apache and restarted?... I've >had cases >where I managed to install the new Apache in a different location, >and ended >up with two different sets of httpd's running. Quite disconcerting. I am positive. /etc/rc.d/init.d/httpd stop /etc/rc.d/init.d/httpd start I have never touched the apache installation. I am currently under the impression that compiling with --with-config-file-path=/etc/httpd/conf/php.ini has screwed up the install. That is unless someone has any other ideas? My first question really is if the php install doesn't find the php.ini does it use built in defaults? That would help explain why my changes aren't active. I asked this because I noticed when I made changes to the session configuration they were never realised in the pages I am running. brett -- 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] file management
You know what, I think Im explaining myself wrong. The word truncate in itself means I believe to cut at the bottom. This isn't what I need. Basically, its a chat script and all the newer messages are at the bottom, and when the file reaches x bytes I want to 'cut off the head' of the file by x lines. leaving the most current messages at the bottom alone. Ive been messing around with truncate all this time getting the wrong results. Why cant files be as easy as databases :) If any one has a clue please point it to me. Meantime, back to the manual. Thanks Sterling Hughes wrote: > On Fri, 7 Sep 2001, Gerard Samuel wrote: > > >>Can a file be truncated from the beginning, and by x amount of lines?? >>Thanks >> >> > Truncated from the beginning? Do you mean truncate the file by X > lines, starting from the first position in the file, well, yeah: > > $fp = fopen("filename", "r+"); > > // Start counting from 0, set to one, if you want to start counting > // from 1 > $count = 0; > > while (!@feof($fp)) { > // Not used, but unless your line lengths are longer than > // 4K, this will effectively skip over a line > $line = fgets($fp, 4096); > > if (++$count == $line_number_you_want) { > ftruncate($fp, ftell($fp)); > } > } > > fclose($fp); > ?> > > Please note the above is devoid of error checking :) > > -Sterling > > > -- 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] GD
Make sure you do not have an older version of gd on your system before trying to compile gd a new version. This will save you hours of frustration. /dkm - Original Message - From: "Sebastian Wenleder" <[EMAIL PROTECTED]> To: "Joseph Bannon" <[EMAIL PROTECTED]>; "PHP (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 11:35 AM Subject: Re: [PHP] GD > At 10:06 Uhr -0500 07.09.2001, Joseph Bannon wrote: > >I just installed PHP 4.0.6. > > > >1) Do I have to down load GD (graphics library) and install it sperately or > >is it in 4.0.6 already? > >2) Do I have to run anything special during configuration? > >3) Do I have to completely re-install PHP and Apache? > > > >Thanks, > > > >Joseph > > Hi Joseph, > > You have to download GD from http://www.boutell.com/gd/ > make sure you have zlib, libjpeg, libpng, and (if you need it) freetype > if not compile and install them all... > then configure php with > #./configure \ > --with-gd= \ > --with-zlib= \ > --with-jpeg-dir= \ > --with-png-dir= \ > --with-tiff-dir= \ > --with-freetype-dir= > #make > #make install > > then you will have to restart apache > > Best regards, Sebastian Wenleder > > -- > 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/mysql search. need help
i have a form where a user inputs a home service type and this results in a list of that value, eg a user inputs 'plumber' and a list of plumbers is displayed. if a user accidentally types plumbar no results are displayed. is there anyway of making php/mysql recognise the first three letters or give a closest match to the query. yours liz lynch
Re: [PHP] GD picture quality
> Take a look at this picture... > > http://www.sayimhot.com/images/mycurrentscore.jpg > > ... now take a look at it while text is added to it... > > http://www.sayimhot.com/myscore.php > > What happens to the picture quality? How can it be improved? (code below) You mean the font quality? The picture looks the same. Try using: ImageTTFText(); Also when you create the jpg at the end set quality to maximum: imagejpeg($img, '', 100); ^^^ -- 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] Re: C-style parameterized macros
> "Neil" == Neil Zanella <[EMAIL PROTECTED]> writes: Neil> Hello, Neil> I have noticed that PHP can be used to define constants but Neil> not parametrized macros, a feature is is currently lacking. Neil> It is possible to use arrays instead with the only Neil> disadvantage that array values can be reassigned. I guess Neil> this is not a real concern. Does anyone know if Neil> parameterized macros will be implemented in future PHP Neil> releases? I have $.02 worth remark. If macros are implemented in php, I suggest that the implementor cosider the macro front-end to the BLISS compiler as a model. My feeling is that cpp is quite limited. -- 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] strange register_shutdown_function() and fopen() conflict
scenario... i am trying to open a file from i function that is called automatically because it is registered with register_shutdown_function(). for some reason i am unable to call fopen(). i am assuming that my script causes a fatal error and i cannot see the output because with apache, one is not able to output at this stage. i'm running redhat linux roswell (7.2 beta), apache 1.3.19 for the code that appears below, if i comment out the line: $testfp = fopen("test.txt", "w+"); then i get the following output.txt file: opened output.txt successfully entered test_shutdown_function() failed to open test.txt end test_shutdown_function() if i don't comment out the line, then i get only this: opened output.txt successfully entered test_shutdown_function() any suggestions? my script must be terminating and i'm wondering why? i have tried to eliminate the possibility that fopen is failing for ordinary i/o or permissions reasons. any ideas? or maybe just a hint as to how to debug this? here is the code -- 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] GD picture quality
Take a look at this picture... http://www.sayimhot.com/images/mycurrentscore.jpg ... now take a look at it while text is added to it... http://www.sayimhot.com/myscore.php What happens to the picture quality? How can it be improved? (code below) Thanks, Joseph -- 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] private functions
Hello, Sorry, i posted this to my local newsfeed a while ago but i don't think it is propogating properly, however i apologise if this appears twice. --- i've been using private functions like the code below a little, and just discovered that if you call the outside function more than once you get an error. Apparently it doesn't like redeclaring the inside function the second time you call the outside function... this seems strange to me. Any help would be appreciated. Lukas -- 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: run a script for any HTTP request (was: run a scripton access to a directory)
Sure, I know that very well, but that has nothing to do with what we are discussing here. -Rasmus On Fri, 7 Sep 2001, Jason Bell wrote: > IE has "Friendly Error Messages" so on a normal 404 response, IE would show > it's own error message, and not the one from the server. The Documented way > around this is to ensure that your 404 document is larger than 512 bytes. > > http://www.zdnet.com/products/stories/reviews/0,4161,2779295-3,00.html > > > - Original Message - > From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> > To: "Enrique Vadillo" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> > Sent: Friday, September 07, 2001 2:45 PM > Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a script > on access to a directory) > > > > What do you mean MSIE does not support 404 ErrorDocument? That is a > > server-side function. It has absolutely nothing to do with the browser. > > Try going to: http://php.net/strlen > > > > That is an ErrorDocument 404 thing that kicks in and takes you to the > > right place in the PHP documentation. And believe me, it works just fine > > for people using MSIE. > > > > Right now an ErrorDocument 404 is the only way to do this. I am currently > > working on the framework to allow PHP scripts to be inserted at any stage > > in the Apache request_rec handler mechanism. This would allow you to run > > a PHP script to translate uri's to on-disk pathnames for example, write > > Apache authentication modules in PHP and many many other efficient ways to > > shoot yourself in the foot. Needs another week or two of development > > before it will be ready for serious testing though. > > > > -Rasmus > > > > > MSIE does not support 404 ErrorDocument, that only works fine > > > with Netscape. Rewriting URLs is nasty when you have to mix > > > it with php script writing, this could be so much simpler with > > > a php script. > > > > > > I know it's a tough question, anyone dares to beat the problem? > > > > > > Enrique- > > > > > > >From: Philip Hallstrom <[EMAIL PROTECTED]> > > > >To: Enrique Vadillo <[EMAIL PROTECTED]> > > > >CC: <[EMAIL PROTECTED]> > > > >Subject: [PHP] Re: run a script for any HTTP request (was: run a script > on > > > >access to a directory) > > > >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT) > > > > > > > >What's wrong with rewriting urls? The other alternative is to make > sure > > > >that none of the urls you are accessing actually exist and then setup > an > > > >ErrorDocument handler which calls the php script of your choice... > which > > > >can then do whatever you want... > > > > > > > >-philip > > > > > > > >On Fri, 7 Sep 2001, Enrique Vadillo wrote: > > > > > > > > > That was a fine idea Doug, but what if we push the subject and > > > > > go a little further? > > > > > > > > > > I am thinking now that i'd like to make it possible that for > > > > > ANY http request received by my Apache i'd like to have a php > > > > > script executed first, i.e.: > > > > > > > > > > http://domain.com/ > > > > > http://domain.com/anydir/anyfile > > > > > > > > > > for any of those locations typed, i'd like to be able to > > > > > execute the php script. i know it's kinda weird but this is > > > > > what i'm really looking for. any ideas anyone? > > > > > > > > > > Enrique- > > > > > > > > > _ > > > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > > > > > > > > > > > > > > > -- > > 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] URLencode
Simplest way is to do this $string = "my string"; $string=urlencode(str_replace(" ","+",$string)); ie use str_replace to manually replace spaces with +, urlencode then won't do anything further to it - Original Message - From: "Brandon Orther" <[EMAIL PROTECTED]> To: "PHP User Group" <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 11:05 PM Subject: RE: [PHP] URLencode > I just realized that on the server I am trying to run this on, URLEncode > is working like rawurlencode. Does anyone have any idea why this might > be happening? > > Thank you, > > > Brandon Orther > WebIntellects Design/Development Manager > [EMAIL PROTECTED] > 800-994-6364 > www.webintellects.com > > > -Original Message- > From: Brandon Orther [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 2:41 PM > To: PHP User Group > Subject: [PHP] URLencode > > Hello, > > I am working on a script and using urlencode but not getting the results > I want. Does anyone know how to convert the spaces of a sting of text > in "+" instead of %20? > > Thanks > > > -- > 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] URLencode
I just realized that on the server I am trying to run this on, URLEncode is working like rawurlencode. Does anyone have any idea why this might be happening? Thank you, Brandon Orther WebIntellects Design/Development Manager [EMAIL PROTECTED] 800-994-6364 www.webintellects.com -Original Message- From: Brandon Orther [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 2:41 PM To: PHP User Group Subject: [PHP] URLencode Hello, I am working on a script and using urlencode but not getting the results I want. Does anyone know how to convert the spaces of a sting of text in "+" instead of %20? Thanks -- 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] auto increment
On Vie 07 Sep 2001 19:01, [EMAIL PROTECTED] wrote: > you know how, if you make a field a primary key and have it auto > increment... then if you delete an entry and add a new one it makes the > field 2 instead of 1... i know thats explained bad but do you know what i > mean? is there a way to make it go back to 1 as if there were never any > fields entered? Man, this is a PHP list, not an SQL list. Any way, you never said what Database server you are using, and the auto incrementals work differently on Oracle, PostGreSQL, MySQL or Informix. Saludos... :-) -- Porqué usar una base de datos relacional cualquiera, si podés usar PostgreSQL? - Martín Marqués |[EMAIL PROTECTED] Programador, Administrador, DBA | Centro de Telematica Universidad Nacional del Litoral - -- 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] auto increment
you know how, if you make a field a primary key and have it auto increment... then if you delete an entry and add a new one it makes the field 2 instead of 1... i know thats explained bad but do you know what i mean? is there a way to make it go back to 1 as if there were never any fields entered? Thanks, Nate
Re: [PHP] Re: run a script for any HTTP request (was: run a script on access to a directory)
IE has "Friendly Error Messages" so on a normal 404 response, IE would show it's own error message, and not the one from the server. The Documented way around this is to ensure that your 404 document is larger than 512 bytes. http://www.zdnet.com/products/stories/reviews/0,4161,2779295-3,00.html - Original Message - From: "Rasmus Lerdorf" <[EMAIL PROTECTED]> To: "Enrique Vadillo" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 2:45 PM Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a script on access to a directory) > What do you mean MSIE does not support 404 ErrorDocument? That is a > server-side function. It has absolutely nothing to do with the browser. > Try going to: http://php.net/strlen > > That is an ErrorDocument 404 thing that kicks in and takes you to the > right place in the PHP documentation. And believe me, it works just fine > for people using MSIE. > > Right now an ErrorDocument 404 is the only way to do this. I am currently > working on the framework to allow PHP scripts to be inserted at any stage > in the Apache request_rec handler mechanism. This would allow you to run > a PHP script to translate uri's to on-disk pathnames for example, write > Apache authentication modules in PHP and many many other efficient ways to > shoot yourself in the foot. Needs another week or two of development > before it will be ready for serious testing though. > > -Rasmus > > > MSIE does not support 404 ErrorDocument, that only works fine > > with Netscape. Rewriting URLs is nasty when you have to mix > > it with php script writing, this could be so much simpler with > > a php script. > > > > I know it's a tough question, anyone dares to beat the problem? > > > > Enrique- > > > > >From: Philip Hallstrom <[EMAIL PROTECTED]> > > >To: Enrique Vadillo <[EMAIL PROTECTED]> > > >CC: <[EMAIL PROTECTED]> > > >Subject: [PHP] Re: run a script for any HTTP request (was: run a script on > > >access to a directory) > > >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT) > > > > > >What's wrong with rewriting urls? The other alternative is to make sure > > >that none of the urls you are accessing actually exist and then setup an > > >ErrorDocument handler which calls the php script of your choice... which > > >can then do whatever you want... > > > > > >-philip > > > > > >On Fri, 7 Sep 2001, Enrique Vadillo wrote: > > > > > > > That was a fine idea Doug, but what if we push the subject and > > > > go a little further? > > > > > > > > I am thinking now that i'd like to make it possible that for > > > > ANY http request received by my Apache i'd like to have a php > > > > script executed first, i.e.: > > > > > > > > http://domain.com/ > > > > http://domain.com/anydir/anyfile > > > > > > > > for any of those locations typed, i'd like to be able to > > > > execute the php script. i know it's kinda weird but this is > > > > what i'm really looking for. any ideas anyone? > > > > > > > > Enrique- > > > > > > _ > > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > > > > > > > > > -- > 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: run a script for any HTTP request (was: run a scripton access to a directory)
What do you mean MSIE does not support 404 ErrorDocument? That is a server-side function. It has absolutely nothing to do with the browser. Try going to: http://php.net/strlen That is an ErrorDocument 404 thing that kicks in and takes you to the right place in the PHP documentation. And believe me, it works just fine for people using MSIE. Right now an ErrorDocument 404 is the only way to do this. I am currently working on the framework to allow PHP scripts to be inserted at any stage in the Apache request_rec handler mechanism. This would allow you to run a PHP script to translate uri's to on-disk pathnames for example, write Apache authentication modules in PHP and many many other efficient ways to shoot yourself in the foot. Needs another week or two of development before it will be ready for serious testing though. -Rasmus > MSIE does not support 404 ErrorDocument, that only works fine > with Netscape. Rewriting URLs is nasty when you have to mix > it with php script writing, this could be so much simpler with > a php script. > > I know it's a tough question, anyone dares to beat the problem? > > Enrique- > > >From: Philip Hallstrom <[EMAIL PROTECTED]> > >To: Enrique Vadillo <[EMAIL PROTECTED]> > >CC: <[EMAIL PROTECTED]> > >Subject: [PHP] Re: run a script for any HTTP request (was: run a script on > >access to a directory) > >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT) > > > >What's wrong with rewriting urls? The other alternative is to make sure > >that none of the urls you are accessing actually exist and then setup an > >ErrorDocument handler which calls the php script of your choice... which > >can then do whatever you want... > > > >-philip > > > >On Fri, 7 Sep 2001, Enrique Vadillo wrote: > > > > > That was a fine idea Doug, but what if we push the subject and > > > go a little further? > > > > > > I am thinking now that i'd like to make it possible that for > > > ANY http request received by my Apache i'd like to have a php > > > script executed first, i.e.: > > > > > > http://domain.com/ > > > http://domain.com/anydir/anyfile > > > > > > for any of those locations typed, i'd like to be able to > > > execute the php script. i know it's kinda weird but this is > > > what i'm really looking for. any ideas anyone? > > > > > > Enrique- > > > _ > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > > > -- 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] file management
Sterling, your example looks doable, Ill report back when Im done with these other functions. Thanks Sterling Hughes wrote: > On Fri, 7 Sep 2001, Gerard Samuel wrote: > > >>Can a file be truncated from the beginning, and by x amount of lines?? >>Thanks >> >> > Truncated from the beginning? Do you mean truncate the file by X > lines, starting from the first position in the file, well, yeah: > > $fp = fopen("filename", "r+"); > > // Start counting from 0, set to one, if you want to start counting > // from 1 > $count = 0; > > while (!@feof($fp)) { > // Not used, but unless your line lengths are longer than > // 4K, this will effectively skip over a line > $line = fgets($fp, 4096); > > if (++$count == $line_number_you_want) { > ftruncate($fp, ftell($fp)); > } > } > > fclose($fp); > ?> > > Please note the above is devoid of error checking :) > > -Sterling > > > -- 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: run a script for any HTTP request (was: run a script on access to a directory)
Explorer does support 404 documents. You just have to make sure the document is bigger than 512 bytes. - Original Message - From: "Enrique Vadillo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 2:36 PM Subject: Re: [PHP] Re: run a script for any HTTP request (was: run a script on access to a directory) > MSIE does not support 404 ErrorDocument, that only works fine > with Netscape. Rewriting URLs is nasty when you have to mix > it with php script writing, this could be so much simpler with > a php script. > > I know it's a tough question, anyone dares to beat the problem? > > Enrique- > > >From: Philip Hallstrom <[EMAIL PROTECTED]> > >To: Enrique Vadillo <[EMAIL PROTECTED]> > >CC: <[EMAIL PROTECTED]> > >Subject: [PHP] Re: run a script for any HTTP request (was: run a script on > >access to a directory) > >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT) > > > >What's wrong with rewriting urls? The other alternative is to make sure > >that none of the urls you are accessing actually exist and then setup an > >ErrorDocument handler which calls the php script of your choice... which > >can then do whatever you want... > > > >-philip > > > >On Fri, 7 Sep 2001, Enrique Vadillo wrote: > > > > > That was a fine idea Doug, but what if we push the subject and > > > go a little further? > > > > > > I am thinking now that i'd like to make it possible that for > > > ANY http request received by my Apache i'd like to have a php > > > script executed first, i.e.: > > > > > > http://domain.com/ > > > http://domain.com/anydir/anyfile > > > > > > for any of those locations typed, i'd like to be able to > > > execute the php script. i know it's kinda weird but this is > > > what i'm really looking for. any ideas anyone? > > > > > > Enrique- > > > _ > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > > > -- > 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] Cybercash compiling as shared module
On Fri, 7 Sep 2001, Michael Kimsal wrote: > I'm trying this specifically with the cybercash module. When I just do > ./configure --with-cybercash=/path/to/mck, it works (well, it gets thru > configure > and make anyway). > > ./configure --with-cybercash=/path/to/mck,shared and > ./configure --with-cybercash=shared,/path/to/mck > > both don't work. Is Cybercash not something that can be compiled as a > shared object? > No, I got this working in PHP 4.0.2 (scary that I remembered this off the top of my head). -Sterling -- 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] URLencode
Hello, I am working on a script and using urlencode but not getting the results I want. Does anyone know how to convert the spaces of a sting of text in "+" instead of %20? Thanks
Re: [PHP] file management
On Fri, 7 Sep 2001, Gerard Samuel wrote: > Can a file be truncated from the beginning, and by x amount of lines?? > Thanks > Truncated from the beginning? Do you mean truncate the file by X lines, starting from the first position in the file, well, yeah: Please note the above is devoid of error checking :) -Sterling -- 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] Cybercash compiling as shared module
I'm trying this specifically with the cybercash module. When I just do ./configure --with-cybercash=/path/to/mck, it works (well, it gets thru configure and make anyway). ./configure --with-cybercash=/path/to/mck,shared and ./configure --with-cybercash=shared,/path/to/mck both don't work. Is Cybercash not something that can be compiled as a shared object? Rasmus Lerdorf wrote: >>That's not allowing me to simply dl() an SO file, because I don't have the >>SO file to start with - that's what I was trying to get at. If I have >>to reconfigure >>everything, there's not much point, I don't think. Unless I'm missing >>something >>obvious. I'd like to be able to simply have an SO file I can dl() >>without recompiling. >>Or are you saying that that configure statement WILL create an SO file >>that can >>be dl()ed later, without recompiling PHP? >> > >Exactly. When you do ./configure --with-foo=shared; make >then modules/foo.so will appear magically and you can dl() that or load it >using "extension=foo.so" in your php.ini. You don't have to recompile >PHP. > >-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] Re: run a script for any HTTP request (was: run a script on access toa directory)
MSIE does not support 404 ErrorDocument, that only works fine with Netscape. Rewriting URLs is nasty when you have to mix it with php script writing, this could be so much simpler with a php script. I know it's a tough question, anyone dares to beat the problem? Enrique- >From: Philip Hallstrom <[EMAIL PROTECTED]> >To: Enrique Vadillo <[EMAIL PROTECTED]> >CC: <[EMAIL PROTECTED]> >Subject: [PHP] Re: run a script for any HTTP request (was: run a script on >access to a directory) >Date: Fri, 7 Sep 2001 14:15:52 -0700 (PDT) > >What's wrong with rewriting urls? The other alternative is to make sure >that none of the urls you are accessing actually exist and then setup an >ErrorDocument handler which calls the php script of your choice... which >can then do whatever you want... > >-philip > >On Fri, 7 Sep 2001, Enrique Vadillo wrote: > > > That was a fine idea Doug, but what if we push the subject and > > go a little further? > > > > I am thinking now that i'd like to make it possible that for > > ANY http request received by my Apache i'd like to have a php > > script executed first, i.e.: > > > > http://domain.com/ > > http://domain.com/anydir/anyfile > > > > for any of those locations typed, i'd like to be able to > > execute the php script. i know it's kinda weird but this is > > what i'm really looking for. any ideas anyone? > > > > Enrique- _ Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp -- 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] randomly picking a variable from an array
> Which is more resource attentive however (Random question, not necessarily > pertaining to this)? > > Making MySQL do extra work or PHP do some extra work? Generally it would be more efficient to have MySQL do it as part of its SELECT. But there could be cases where it would be more efficient to do it in PHP. Really depends on what you are doing. Try benchmarking both. -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]
[PHP] PHP 4.0.4pl1 HEAD request problem
Software: Apache/1.3.19 (Unix) PHP/4.0.4pl1 mod_ssl/2.8.2 OpenSSL/0.9.6 and PHP is built as a loadable module for Apache. HEAD requests to PHP pages that have calls to ob_start() and ob_end_flush() do not work properly. index.php - *without* ob_start() / ob_end_flush() - Here's the response from a HEAD request to that index.php: -- HTTP/1.1 200 OK Date: Fri, 07 Sep 2001 21:11:00 GMT Server: Apache/1.3.19 (Unix) PHP/4.0.4pl1 mod_ssl/2.8.2 OpenSSL/0.9.6 X-Powered-By: PHP/4.0.4pl1 Connection: close Content-Type: text/html Connection closed by foreign host. === index.php - *with* ob_start() / ob_end_flush() -- Here's the response from a HEAD request to that index.php: -- Connection closed by foreign host. Is this a bug with PHP 4.0.4pl1? -- Hardy Merrill Mission Critical Linux, Inc. http://www.missioncriticallinux.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] file management
Can a file be truncated from the beginning, and by x amount of lines?? Thanks -- 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] randomly picking a variable from an array
Actually, the difference in speed between generating a random number in either MySQL or PHP is pretty much negligable. If you can have MySQL return just a single row, however, instead of an entire set of rows then there will be a notable difference =) Sheridan Saint-Michel Website Administrator FoxJet, an ITW Company www.foxjet.com - Original Message - From: "Kath" <[EMAIL PROTECTED]> To: "King, Justin" <[EMAIL PROTECTED]>; "Rasmus Lerdorf" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 3:57 PM Subject: Re: [PHP] randomly picking a variable from an array > Which is more resource attentive however (Random question, not necessarily > pertaining to this)? > > Making MySQL do extra work or PHP do some extra work? > > - k > > - Original Message - > From: "King, Justin" <[EMAIL PROTECTED]> > To: "Rasmus Lerdorf" <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Friday, September 07, 2001 4:19 PM > Subject: RE: [PHP] randomly picking a variable from an array > > > But that would make sense rasmus... and I don't like to make sense =)... > if its an array filled from a database, randomizing on the database > level would still be better though. > > --Justin King, School District of Superior Web Coordinator > (www.superior.k12.wi.us) > > > -Original Message- > From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 3:13 PM > To: King, Justin > Cc: Joseph Bannon; [EMAIL PROTECTED] > Subject: RE: [PHP] randomly picking a variable from an array > > I'd say the easiest way would be to use array_rand() > See http://php.net/array_rand > > -Rasmus > > On Fri, 7 Sep 2001, King, Justin wrote: > > > The easiest way I can think of would be to get a random number based > on > > the size of an array. If you're querying your database and filling an > > array with all images, just use the database's random routine instead. > > (I.E. "SELECT quote,author from randomQuote ORDER by RAND() LIMIT 1" > in > > mysql) > > > > If this isn't the case, something like this should work.. > > > > srand(time()); > > $random=rand(0,sizeof($myVar)-1); > > > > Hope I could be of some help... > > > > --Justin King, School District of Superior Web Coordinator > > (www.superior.k12.wi.us) > > > > > > -Original Message- > > From: Joseph Bannon [mailto:[EMAIL PROTECTED]] > > Sent: Friday, September 07, 2001 2:08 PM > > To: PHP (E-mail) > > Subject: [PHP] randomly picking a variable from an array > > > > How do you randomly picking a variable from an array with PHP? > > > > Thanks, > > > > Joseph > > > > > > > > > > PS. Thanks to those who helped me with GD. If you go to my site, > you'll > > see > > the new counter I created at the top of the page. > > > > http://www.collegesucks.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]
Re[2]: [PHP] The future of PHP
Hello Sean, Thursday, September 06, 2001, 1:46:28 PM, you wrote: SCM> My experience is the same. Here in Spain everybody uses Microsoft SCM> products. W95, W98, NT everywhere, and now 2000. There a lot of MCSE SCM> around and very little Linux/PHP experts. Yes there are a lot of people SCM> that say "I'm an expert on this or that..." but once you get to work SCM> with them, you notice that their knoledge is not the one that they say. I hope germany is on the way to change this. Open Source is sponsored and supported by the goverment ;) SCM> The Universities and companies I have been working at or with they all SCM> use in 90% of the tasks MS products. And for critical tasks they use SCM> Solaris or another Unix. Here, at my university, they use linux, Solaris, M$ And my employer, an ISP, uses most linux boxes. SCM> Where did you get that thing about EU being more open source that the SCM> US??? Is it your personal experience or what??? It is not my own SCM> experience... maybe what you mean is that the US is more in the bussines SCM> of making money with the open source than the EU, but that is something SCM> else. look up ... -- Best regards, Manuelmailto:[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] Re: run a script for any HTTP request (was: run a script on accessto a directory)
What's wrong with rewriting urls? The other alternative is to make sure that none of the urls you are accessing actually exist and then setup an ErrorDocument handler which calls the php script of your choice... which can then do whatever you want... -philip On Fri, 7 Sep 2001, Enrique Vadillo wrote: > That was a fine idea Doug, but what if we push the subject and > go a little further? > > I am thinking now that i'd like to make it possible that for > ANY http request received by my Apache i'd like to have a php > script executed first, i.e.: > > http://domain.com/ > http://domain.com/anydir/anyfile > > for any of those locations typed, i'd like to be able to > execute the php script. i know it's kinda weird but this is > what i'm really looking for. any ideas anyone? > > Enrique- > > >From: "Doug Granzow" <[EMAIL PROTECTED]> > >To: [EMAIL PROTECTED] > >Subject: Re: execute a script on access to a directory > >Date: Fri, 7 Sep 2001 15:38:45 -0400 > > > >You can make "go" the name of your PHP script, then put this in your Apache > >config: > > > > > > ForceType application/x-httpd-php > > > > > >Now in your "go" script, you have it do whatever you wanted it to do, then > >use an include to load the "getit" script. > > > >Doug Granzow > >[EMAIL PROTECTED] > > > ><[EMAIL PROTECTED]> wrote: > > > Hi, > > > > > > I would like to know how i can force a PHP script to be > > > executed everytime a certain directory is accessed, for > > > example in http://domain.com/go/getit the presence of the > > > /go/ directory would force a PHP script to be executed > > > prior to any operation. > > > > > > Do i need to play with rewriting urls in Apache or is > > > there any other cleaner method (that would not require > > > rewriting URLs) to achieve this? i'd hate to have to > > > rewrite URLs... > > > > > > thanks. > > > _ > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > > > -- > 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] randomly picking a variable from an array
Which is more resource attentive however (Random question, not necessarily pertaining to this)? Making MySQL do extra work or PHP do some extra work? - k - Original Message - From: "King, Justin" <[EMAIL PROTECTED]> To: "Rasmus Lerdorf" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 4:19 PM Subject: RE: [PHP] randomly picking a variable from an array But that would make sense rasmus... and I don't like to make sense =)... if its an array filled from a database, randomizing on the database level would still be better though. --Justin King, School District of Superior Web Coordinator (www.superior.k12.wi.us) -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 3:13 PM To: King, Justin Cc: Joseph Bannon; [EMAIL PROTECTED] Subject: RE: [PHP] randomly picking a variable from an array I'd say the easiest way would be to use array_rand() See http://php.net/array_rand -Rasmus On Fri, 7 Sep 2001, King, Justin wrote: > The easiest way I can think of would be to get a random number based on > the size of an array. If you're querying your database and filling an > array with all images, just use the database's random routine instead. > (I.E. "SELECT quote,author from randomQuote ORDER by RAND() LIMIT 1" in > mysql) > > If this isn't the case, something like this should work.. > > srand(time()); > $random=rand(0,sizeof($myVar)-1); > > Hope I could be of some help... > > --Justin King, School District of Superior Web Coordinator > (www.superior.k12.wi.us) > > > -Original Message- > From: Joseph Bannon [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 2:08 PM > To: PHP (E-mail) > Subject: [PHP] randomly picking a variable from an array > > How do you randomly picking a variable from an array with PHP? > > Thanks, > > Joseph > > > > > PS. Thanks to those who helped me with GD. If you go to my site, you'll > see > the new counter I created at the top of the page. > > http://www.collegesucks.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] Hosting Question
Anyone ever use Featurehosting.com? They seem ridiculously cheap. I was wondering if they're too good to be true or if they're the real deal. Look at small to medium traffic stes, no amazon.com's here. Matt "TrollBoy" Wiseman Webmaster: Shoggoth.net Site Designer: phpslash.org The oldest and strongest emotion of mankind is fear, and the oldest and strongest kind of fear is fear of the unknown. -H.P. Lovecraft - Please do not resell my e-mail address to anyone or send me unsolicited e-mail - -- 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] run a script for any HTTP request (was: run a script on access to a directory)
That was a fine idea Doug, but what if we push the subject and go a little further? I am thinking now that i'd like to make it possible that for ANY http request received by my Apache i'd like to have a php script executed first, i.e.: http://domain.com/ http://domain.com/anydir/anyfile for any of those locations typed, i'd like to be able to execute the php script. i know it's kinda weird but this is what i'm really looking for. any ideas anyone? Enrique- >From: "Doug Granzow" <[EMAIL PROTECTED]> >To: [EMAIL PROTECTED] >Subject: [PHP] Re: execute a script on access to a directory >Date: Fri, 7 Sep 2001 15:38:45 -0400 > >You can make "go" the name of your PHP script, then put this in your Apache >config: > > > ForceType application/x-httpd-php > > >Now in your "go" script, you have it do whatever you wanted it to do, then >use an include to load the "getit" script. > >Doug Granzow >[EMAIL PROTECTED] > ><[EMAIL PROTECTED]> wrote: > > Hi, > > > > I would like to know how i can force a PHP script to be > > executed everytime a certain directory is accessed, for > > example in http://domain.com/go/getit the presence of the > > /go/ directory would force a PHP script to be executed > > prior to any operation. > > > > Do i need to play with rewriting urls in Apache or is > > there any other cleaner method (that would not require > > rewriting URLs) to achieve this? i'd hate to have to > > rewrite URLs... > > > > thanks. _ Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp -- 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] socket error
On Sat, 8 Sep 2001, sagar wrote: > thanX sterling, > > i've changed it to socket_open() but the problem > still exists. > Sorry, meant socket_create() -- for a list of the new names, open up php4/ext/sockets/sockets.c and take a look at the function entry. -Sterling > /sagar > > - Original Message - > From: Sterling Hughes <[EMAIL PROTECTED]> > To: sagar <[EMAIL PROTECTED]> > Cc: php <[EMAIL PROTECTED]> > Sent: Saturday, September 08, 2001 1:54 AM > Subject: Re: [PHP] socket error > > > > On Sat, 8 Sep 2001, sagar wrote: > > > > > line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { > > > echo "socket() failed: reason: " . strerror($sock) . > "\n"; > > > } > > > > > > i'm getting an error saying > > > Fatal error: Call to undefined function: socket() in c:\program > files\apache group\apache\htdocs\test\sock.php on line 10 > > > > > > > > > can any one help > > > > > > > The socket functions have been renamed as of php4.0.7 > > > > Use socket_open() instead... > > > > -Sterling > > > _ > 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]
Re: [PHP] socket error
thanX sterling, i've changed it to socket_open() but the problem still exists. /sagar - Original Message - From: Sterling Hughes <[EMAIL PROTECTED]> To: sagar <[EMAIL PROTECTED]> Cc: php <[EMAIL PROTECTED]> Sent: Saturday, September 08, 2001 1:54 AM Subject: Re: [PHP] socket error > On Sat, 8 Sep 2001, sagar wrote: > > > line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { > > echo "socket() failed: reason: " . strerror($sock) . "\n"; > > } > > > > i'm getting an error saying > > Fatal error: Call to undefined function: socket() in c:\program files\apache group\apache\htdocs\test\sock.php on line 10 > > > > > > can any one help > > > > The socket functions have been renamed as of php4.0.7 > > Use socket_open() instead... > > -Sterling _ 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]
RE: [PHP] randomly picking a variable from an array
On Fri, 7 Sep 2001, King, Justin wrote: > The easiest way I can think of would be to get a random number based on > the size of an array. If you're querying your database and filling an > array with all images, just use the database's random routine instead. > (I.E. "SELECT quote,author from randomQuote ORDER by RAND() LIMIT 1" in > mysql) > > If this isn't the case, something like this should work.. > > srand(time()); > $random=rand(0,sizeof($myVar)-1); > > Hope I could be of some help... > array_rand() will also do this for you... -Sterling > --Justin King, School District of Superior Web Coordinator > (www.superior.k12.wi.us) > > > -Original Message- > From: Joseph Bannon [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 2:08 PM > To: PHP (E-mail) > Subject: [PHP] randomly picking a variable from an array > > How do you randomly picking a variable from an array with PHP? > > Thanks, > > Joseph > > > > > PS. Thanks to those who helped me with GD. If you go to my site, you'll > see > the new counter I created at the top of the page. > > http://www.collegesucks.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] socket error
On Sat, 8 Sep 2001, sagar wrote: > line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { > echo "socket() failed: reason: " . strerror($sock) . "\n"; > } > > i'm getting an error saying > Fatal error: Call to undefined function: socket() in c:\program files\apache >group\apache\htdocs\test\sock.php on line 10 > > > can any one help > The socket functions have been renamed as of php4.0.7 Use socket_open() instead... -Sterling -- 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] socket error
line10 -> if (($sock = socket(AF_INET, SOCK_STREAM, 0)) < 0) { echo "socket() failed: reason: " . strerror($sock) . "\n"; } i'm getting an error saying Fatal error: Call to undefined function: socket() in c:\program files\apache group\apache\htdocs\test\sock.php on line 10 can any one help its urgent /sagar
RE: [PHP] randomly picking a variable from an array
But that would make sense rasmus... and I don't like to make sense =)... if its an array filled from a database, randomizing on the database level would still be better though. --Justin King, School District of Superior Web Coordinator (www.superior.k12.wi.us) -Original Message- From: Rasmus Lerdorf [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 3:13 PM To: King, Justin Cc: Joseph Bannon; [EMAIL PROTECTED] Subject: RE: [PHP] randomly picking a variable from an array I'd say the easiest way would be to use array_rand() See http://php.net/array_rand -Rasmus On Fri, 7 Sep 2001, King, Justin wrote: > The easiest way I can think of would be to get a random number based on > the size of an array. If you're querying your database and filling an > array with all images, just use the database's random routine instead. > (I.E. "SELECT quote,author from randomQuote ORDER by RAND() LIMIT 1" in > mysql) > > If this isn't the case, something like this should work.. > > srand(time()); > $random=rand(0,sizeof($myVar)-1); > > Hope I could be of some help... > > --Justin King, School District of Superior Web Coordinator > (www.superior.k12.wi.us) > > > -Original Message- > From: Joseph Bannon [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 2:08 PM > To: PHP (E-mail) > Subject: [PHP] randomly picking a variable from an array > > How do you randomly picking a variable from an array with PHP? > > Thanks, > > Joseph > > > > > PS. Thanks to those who helped me with GD. If you go to my site, you'll > see > the new counter I created at the top of the page. > > http://www.collegesucks.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] randomly picking a variable from an array
I'd say the easiest way would be to use array_rand() See http://php.net/array_rand -Rasmus On Fri, 7 Sep 2001, King, Justin wrote: > The easiest way I can think of would be to get a random number based on > the size of an array. If you're querying your database and filling an > array with all images, just use the database's random routine instead. > (I.E. "SELECT quote,author from randomQuote ORDER by RAND() LIMIT 1" in > mysql) > > If this isn't the case, something like this should work.. > > srand(time()); > $random=rand(0,sizeof($myVar)-1); > > Hope I could be of some help... > > --Justin King, School District of Superior Web Coordinator > (www.superior.k12.wi.us) > > > -Original Message- > From: Joseph Bannon [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 2:08 PM > To: PHP (E-mail) > Subject: [PHP] randomly picking a variable from an array > > How do you randomly picking a variable from an array with PHP? > > Thanks, > > Joseph > > > > > PS. Thanks to those who helped me with GD. If you go to my site, you'll > see > the new counter I created at the top of the page. > > http://www.collegesucks.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] Content management
I'm actually doing the same thing for my district. We've developed a code system much like html, only not. Sounds stupid but it works. I mostly ripped off UBB code. For example: [b]bold[/b], [i]italics[/i] Then we give the people using it an instruction sheet. Since [ and ] don't require a shift people tend to like it better. If you wanted to go further you could use javascript have automatically put in the tag. --Justin King, School District of Superior Web Coordinator (www.superior.k12.wi.us) -Original Message- From: Scott Parks [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 2:53 PM To: [EMAIL PROTECTED] Subject: [PHP] Content management Hi All- I am developing a web interface for a school that will allow them to mange the entire site, from users to the actual display elements. The trick has been, they must not have to know HTML to do the administration. The question: does anyone have some links or examples of this kind of system from a layout perspective, even functionality. I want to deliver something they can really use. Thanks, -Scott -- 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] randomly picking a variable from an array
The easiest way I can think of would be to get a random number based on the size of an array. If you're querying your database and filling an array with all images, just use the database's random routine instead. (I.E. "SELECT quote,author from randomQuote ORDER by RAND() LIMIT 1" in mysql) If this isn't the case, something like this should work.. srand(time()); $random=rand(0,sizeof($myVar)-1); Hope I could be of some help... --Justin King, School District of Superior Web Coordinator (www.superior.k12.wi.us) -Original Message- From: Joseph Bannon [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 2:08 PM To: PHP (E-mail) Subject: [PHP] randomly picking a variable from an array How do you randomly picking a variable from an array with PHP? Thanks, Joseph PS. Thanks to those who helped me with GD. If you go to my site, you'll see the new counter I created at the top of the page. http://www.collegesucks.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] Re: newbie ? :)
Have you contacted Mercury yet? Try them or try the linux.redhat.misc newsgroup. -- Gaylen "Caleb Carvalho" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > hello all, > > i am trying to install Loadrunner for in linux, > > am not sure where is my LD_LIBRARY_PATH > linux rhat7.1 can some pls point me out > > many thanks, > > kind regards > caleb > > > > _ > Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp > -- 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] Re: clear contents?
"Jeremy Morano" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > Hi everone... > I'm having a little problem. The code below pops up a password dialog box > where the user types in a username and a password to be able to proceed. > However, if the user does not close the browser and goes back to the link, > which they pops up the diolog box again and they don't have to type in there > username and password again. They are remembered. I would like it so that > the user has to type in there username and password any and every time that > the diolog box is called on. Doe anyone know how to do this? I tried to > clear the contents of PHP_AUTH_USER and PHP_AUTH_PW at the top of the page > but that just messed things up. Can someone please help me? > > [some code] > header( 'WWW-Authenticate: Basic realm="Private"' ); > header( 'HTTP/1.0 401 Unauthorized' ); > echo 'Authorization Required.'; > exit; > Wouldn't it be enough to randomly create a name for the realm? / Franklin -- 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] Content management
Hi All- I am developing a web interface for a school that will allow them to mange the entire site, from users to the actual display elements. The trick has been, they must not have to know HTML to do the administration. The question: does anyone have some links or examples of this kind of system from a layout perspective, even functionality. I want to deliver something they can really use. Thanks, -Scott -- 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] randomly picking a variable from an array
Example if you do know the number of items in the array: /* Begin */ $choice = rand(1, 6); echo $array[$choice]; /* End */ That will randomly pick something from 1-6 in the array. If you do not know the number of things in the array (say it is off a form or something): /* Begin */ $numinarray = count($array); $choice = rand(1, $numinarray); echo $array[$choice]; /* End */ HTH! - k - Original Message - From: "Joseph Bannon" <[EMAIL PROTECTED]> To: "PHP (E-mail)" <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 3:08 PM Subject: [PHP] randomly picking a variable from an array > How do you randomly picking a variable from an array with PHP? > > Thanks, > > Joseph > > > > > PS. Thanks to those who helped me with GD. If you go to my site, you'll see > the new counter I created at the top of the page. > > http://www.collegesucks.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] Re: execute a script on access to a directory
You can make "go" the name of your PHP script, then put this in your Apache config: ForceType application/x-httpd-php Now in your "go" script, you have it do whatever you wanted it to do, then use an include to load the "getit" script. Here's an except from my equivalent of your 'go' script: // $PATH_INFO = the rest of the URI after dmb/ // (in "http://www.minarets.net/dmb/trading/toptraders";) // remove anything other than letters, numbers, dots, underscores, // and dashes, and put into an array // for example "trading/toptraders" will be an array consisting // of "trading" ($args[1]) and "toptraders" ($args[2]). The / is discarded. ereg("(^[-_.\/a-zA-Z0-9]*$)", $PATH_INFO, $arg); $args = split( "/", $arg[1]); $file = "include/" . $args[1] . ".inc"; if (file_exists($file)) { include "$file"; } else { ?> 404 not found wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi, > > I would like to know how i can force a PHP script to be > executed everytime a certain directory is accessed, for > example in http://domain.com/go/getit the presence of the > /go/ directory would force a PHP script to be executed > prior to any operation. > > Do i need to play with rewriting urls in Apache or is > there any other cleaner method (that would not require > rewriting URLs) to achieve this? i'd hate to have to > rewrite URLs... > > thanks. > > Enrique- > > > _ > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > -- 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: Error handling and the usage of "@"
"Seb Frost" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > So I should chuck it on all mysql functions? Done. Don't ya just love > search and replacing a whole directory of scripts :-) Still works fine > too - bonus! er... I should have noted - if you are going to surpress the default error messages, you need to do your own custom error checking to replace it... ;-) -- 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] randomly picking a variable from an array
create a random number from 0 to count($array) and use that as the index jack -Original Message- From: Joseph Bannon [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 3:08 PM To: PHP (E-mail) Subject: [PHP] randomly picking a variable from an array How do you randomly picking a variable from an array with PHP? Thanks, Joseph PS. Thanks to those who helped me with GD. If you go to my site, you'll see the new counter I created at the top of the page. http://www.collegesucks.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] Re: Error handling and the usage of "@"
So I should chuck it on all mysql functions? Done. Don't ya just love search and replacing a whole directory of scripts :-) Still works fine too - bonus! - seb -Original Message- From: Hugh Bothwell [mailto:[EMAIL PROTECTED]] Sent: 07 September 2001 20:32 To: [EMAIL PROTECTED] Subject: [PHP] Re: Error handling and the usage of "@" "Seb Frost" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Could someone give me an example of the sort of error handling you put in > your php scripts? Cheers. Should I be preceding every command with @? > Anything where this would be harmful? Just looking for some pointers really In general, stuff that (a) might fail in normal use and (b) prints an unwanted error message. This usually deals with calls to external programs, stuff that sometimes be down. In my case, this is pretty much restricted to mail() and the mysql_xx functions. -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- 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] Re: Error handling and the usage of "@"
"Seb Frost" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Could someone give me an example of the sort of error handling you put in > your php scripts? Cheers. Should I be preceding every command with @? > Anything where this would be harmful? Just looking for some pointers really In general, stuff that (a) might fail in normal use and (b) prints an unwanted error message. This usually deals with calls to external programs, stuff that sometimes be down. In my case, this is pretty much restricted to mail() and the mysql_xx functions. -- 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] execute a script on access to a directory
Nope, i'm not talking about a directory containing exclusively PHP scripts, in that case i would've prepended a php script to the directory and we're done, but no, i am talking about access to a directory containing files of any kind. see? Thanks for the help anyway, any better suggestions? Enrique- >From: "Jason Bell" <[EMAIL PROTECTED]> >To: "Enrique Vadillo" <[EMAIL PROTECTED]>, "PHP Users" ><[EMAIL PROTECTED]> >Subject: Re: [PHP] execute a script on access to a directory >Date: Fri, 7 Sep 2001 12:12:58 -0700 > >You could always add an include() for every page under the /go directory. > >Simplest way that I can think of. > > >- Original Message - >From: "Enrique Vadillo" <[EMAIL PROTECTED]> >To: <[EMAIL PROTECTED]> >Sent: Friday, September 07, 2001 12:09 PM >Subject: [PHP] execute a script on access to a directory > > > > Hi, > > > > I would like to know how i can force a PHP script to be > > executed everytime a certain directory is accessed, for > > example in http://domain.com/go/getit the presence of the > > /go/ directory would force a PHP script to be executed > > prior to any operation. > > > > Do i need to play with rewriting urls in Apache or is > > there any other cleaner method (that would not require > > rewriting URLs) to achieve this? i'd hate to have to > > rewrite URLs... > > > > thanks. > > > > Enrique- _ Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp -- 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] randomly picking a variable from an array
How do you randomly picking a variable from an array with PHP? Thanks, Joseph PS. Thanks to those who helped me with GD. If you go to my site, you'll see the new counter I created at the top of the page. http://www.collegesucks.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] Re: network connections
If you're talking over a million messages, I think you need a solution that is designed specifically for handling mail. I would suggest looking into qmail (www.qmail.org) to replace sendmail on the server in question. qmail is much more efficient than sendmail in handling large amounts of mail, and it won't drag your server down. I think it's possible that some of your smtp connections are hanging for some reason or another, and PHP is not timing them out. 10,000 connections out of 1 million emails means about 1% of your connections are failing in some way -- not surprising when talking smtp. If you're talking smtp directly to remote mail server, how are you handling retries, failed mail, etc.? Again, I would suggest qmail since it would take care of all of that for you, instead of you having to reinvent the wheel. I have a script which sends out about 30,000 emails once a month, through qmail, and it is set up so that qmail automatically routes any bounces back to another script where I can update my database to reflect which users' mail is bouncing. Doug Granzow [EMAIL PROTECTED] "J.R. Lillard" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > i've got a command-line php script that i've been using to deliver large > amounts of e-mail. originally it relied on mail() to deliver the > messages but i could easily overload sendmail and bring the box (redhat > 7.1) to a crawl. so i am now using the various network functions to > speak smtp directly from the script. i seem to be having a problem with > an excessive number of tcp connections that eventually brings down the > machine. > > i have attempted a semi-multi-threaded approach by spawning off > additional copies of the script to deliver more mail simultaneously. so > i might have 100 copies of the script running at the same time. and > this was after dumping a million messages into my mysql-based mail > queue. things may run okay for a few hours...maybe even a day...but > then doing a netstat shows over 10k tcp connections. and the only way > i've found to fix the problem is to reboot the machine. > > thinking that i was attempting too many connections at the same time, i > throttled down the number of threads to 25. this slowed down my mail > delivery of course. and it allowed the machine to stay up longer. but > i eventually ran into the same problem after maybe two or three weeks. > just before it died, i was showing over 30k tcp connections. > > are they any known issues in the php networking code that would cause > this to happen? as far as i know, i should never have more than 25 tcp > connections open. but i'm not sure if they are not being closed > properly or what. > > -- > -jr > -- 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] Error handling and the usage of "@"
Could someone give me an example of the sort of error handling you put in your php scripts? Cheers. Should I be preceding every command with @? Anything where this would be harmful? Just looking for some pointers really :-) - seb --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- 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] execute a script on access to a directory
You could always add an include() for every page under the /go directory. Simplest way that I can think of. - Original Message - From: "Enrique Vadillo" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 12:09 PM Subject: [PHP] execute a script on access to a directory > Hi, > > I would like to know how i can force a PHP script to be > executed everytime a certain directory is accessed, for > example in http://domain.com/go/getit the presence of the > /go/ directory would force a PHP script to be executed > prior to any operation. > > Do i need to play with rewriting urls in Apache or is > there any other cleaner method (that would not require > rewriting URLs) to achieve this? i'd hate to have to > rewrite URLs... > > thanks. > > Enrique- > > > _ > Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp > > > -- > 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] execute a script on access to a directory
Hi, I would like to know how i can force a PHP script to be executed everytime a certain directory is accessed, for example in http://domain.com/go/getit the presence of the /go/ directory would force a PHP script to be executed prior to any operation. Do i need to play with rewriting urls in Apache or is there any other cleaner method (that would not require rewriting URLs) to achieve this? i'd hate to have to rewrite URLs... thanks. Enrique- _ Descargue GRATUITAMENTE MSN Explorer en http://explorer.msn.es/intl.asp -- 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] Re: How to pass variables to php functions from url's?
On Fri, 7 Sep 2001 13:28:16 +0200 impersonator of [EMAIL PROTECTED] (\ Tais M. Hansen) planted &I saw in php.general: >Hi Martin, > >Take a look at the Apache mod_rewrite docs. > >http://httpd.apache.org/docs-2.0/mod/mod_rewrite.html > > >I added this to my httpd.conf: > Or if you don't have access to httpd.conf and/or not mod_rewrite installed, check to see if you can use .htaccess in your respective directory with adding there handler (your script) for all these files to be processed by. See Apache docs, if/how it is possible to pass params. I didn't use it myself, as my servers don't allow it, but read/lerned s/t. >---snip--- >RewriteEngine on >RewriteCond %{HTTP_HOST}^nu\.osd\.dk$ >RewriteRule ^.*$http://www.osd.dk/main.php?m=nu >[R=301,L] >---snip--- > >If a user types the URL "nu.osd.dk" it will call >http://www.osd.dk/main.php?m=nu. > > >-- >Tais M. Hansen > > > >"Martin Lindhe" <[EMAIL PROTECTED]> wrote in message >831D8A28AF18D5119EAA00E018C5B81C23BA08@MAIL1">news:831D8A28AF18D5119EAA00E018C5B81C23BA08@MAIL1... >> I need to solve the following problem, but I can't figure out how: >> Let's assume we have a server called www.test.com >> When a user access http://www.test.com/path/username, >> I want a php script to execute, as if the url entered was >> http://www.test.com/path.php?value=username. >> I'm running PHP 4.0.6 on Apache 1.3.20. >> Thanks! >> /Martin Lindhe > > i Leonid. -- 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] For the RegExps gurus!
On Fri, 7 Sep 2001 09:39:37 +0200 impersonator of [EMAIL PROTECTED] (* R&Ze:) planted &I saw in php.general: > >From: ~~~i LeoNid ~~ <[EMAIL PROTECTED]> >Date: Thu, Sep 06, 2001 at 05:30:44PM + >Message-ID: <3b97b222.78196206@localhost> >Subject: Re: [PHP] For the RegExps gurus! > >> You can keep improving:) or you can use piece of my working (except for >> $Harlem, to which i am not going:) code (I give it for free this time:) >> >> No /me, no ereg, no nothing - gentleMen:)-just /i (did you miss it, btw?:) > > > > > >If you look at the stuff you sent you'll understand why I improved >it. > You didn't. Actually please expose - tell i tell i:). I am all ears:) >Btw... why the h*ll do you explode() the string you're matching, >while there's the /m modifier? You're making it to difficult for >yourself (and others). No need for the messy solution you created... Well. So much fuss of so little issue. I admit, It was just a quick addition for the posting without much thinking (may be just to add $Harlem variable:). You can do without exploding - and no need for other code alterations there, I believe. No need in /m either (Correct me, if I am wrong:), coz I am not checking on beginning or end of string. What other "mess" you have noticed:) >Just use RE's that are as simple as possible. It has the best >performance and it reads a lot easier. > ? RE ? Sorry, I am not a club insider:) Please, > -- 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] Re: clear contents? - Ignore previous response
Oops!!! I didn't read your question fully. I think you CAN do what you want, if you can get some kind of cookie or and/or session variable to work to record when the user got to your page. You leave your logic as is, except that when you get a valid user you check to see if they have been on the page before via a cookie and/or session variable. If they haven't, you just go on as normal. If they have been to your page you FIRST reset the cookie/session variable to say they haven't been to the page and THEN issue your header AS IF THEY HAD THE INCORRECT USERNAME/ PASSWORD. This will force the browser to reprompt for username/password and when they come back to your page, you'll treat them as if they've never been there and let them through. e.g. using cookies (I don't use sessions so I might get the syntax wrong), if ( (! $auth) or $reprompt == 'Yes') { // Cancel the reprompt cookie("reprompt"); header( 'WWW-Authenticate: Basic realm="Private"' ); header( 'HTTP/1.0 401 Unauthorized' ); echo 'Authorization Required.'; exit; } else // Mark them ready to be reprompted next time cookie("reprompt","Yes"); session_start(); } Sorry, George George Whiffen wrote: > > Jeremy, > > I don't think it's possible to do what you want, and I have tried finding > a way. > > With your "header " you are requestion an http authentication which means > the browser has to store the username and password and send them with EVERY page. > Those are the rules. > > The only way to tell the browser to lose the username/password that I've found is to >tell > it that they're incorrect, (even though they are correct). But if you do > that it will go and ask the user to type them in again another three times > before it gives up and drops them. > > You'll find that most of your users will probably keep the username/password > even after closing the browser and switching their computer off, which I guess > is even worse as far as you're concerned. > > I hope I'm wrong but if you really must get them to enter username/password > every time, I think you'll have to create your own login box and forget > about http authentication. > > It might be worth posting your question to an apache newsgroup as well. Even > if you're not using Apache, you should find those guys know just about everything > there is to know about http authentication. > > Good Luck and I hope I'm wrong! > > George > > Jeremy Morano wrote: > > > > Hi everone... > > I'm having a little problem. The code below pops up a password dialog box > > where the user types in a username and a password to be able to proceed. > > However, if the user does not close the browser and goes back to the link, > > which they pops up the diolog box again and they don't have to type in there > > username and password again. They are remembered. I would like it so that > > the user has to type in there username and password any and every time that > > the diolog box is called on. Doe anyone know how to do this? I tried to > > clear the contents of PHP_AUTH_USER and PHP_AUTH_PW at the top of the page > > but that just messed things up. Can someone please help me? > > > > > session_start(); > > session_register("PHP_AUTH_USER"); > > > > if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) > > > > // Connect to MySQL > > > > mysql_connect( 'l', 'c', 'c' ) > > or die ( 'Unable to connect to server.' ); > > > > // Select database on MySQL server > > > > mysql_select_db( 'contact' ) > > or die ( 'Unable to select database.' ); > > > > // Formulate the query > > > > $sql = "SELECT * FROM users WHERE > > username = '$PHP_AUTH_USER' AND > > password = '$PHP_AUTH_PW'"; > > > > // Execute the query and put results in $result > > > > $result = mysql_query( $sql ) > > or die ( 'Unable to execute query.' ); > > > > // Get number of rows in $result. > > > > $num = mysql_numrows( $result ); > > > > if ( $num != 0 ) > > > > // A matching row was found - the user is authenticated. > > > > $auth = true; > > > > } > > > > } > > > > if ( ! $auth ) > > > > header( 'WWW-Authenticate: Basic realm="Private"' ); > > header( 'HTTP/1.0 401 Unauthorized' ); > > echo 'Authorization Required.'; > > exit; > > > > } else > > > > session_start(); > > > > } > > -- 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] Re: UD4 & PhAkt Users?
Thanks for your comments. The advice to just learn the code is both wise and simple. To complicate matters, I did download a trial version of Ultra Dev, installed PhAkt, found a JDBC driver that would work through my Mac to connect to a MySQL database, only to learn that the webhosting company won't allow such connections. So until I'm able to set up a local testing environment (an expensive and time consuming affair), UltraDev isn't an option for me. In short, your advice has been supported by my experience. Best regards, Vicki -- 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] Re: clear contents?
Jeremy, I don't think it's possible to do what you want, and I have tried finding a way. With your "header " you are requestion an http authentication which means the browser has to store the username and password and send them with EVERY page. Those are the rules. The only way to tell the browser to lose the username/password that I've found is to tell it that they're incorrect, (even though they are correct). But if you do that it will go and ask the user to type them in again another three times before it gives up and drops them. You'll find that most of your users will probably keep the username/password even after closing the browser and switching their computer off, which I guess is even worse as far as you're concerned. I hope I'm wrong but if you really must get them to enter username/password every time, I think you'll have to create your own login box and forget about http authentication. It might be worth posting your question to an apache newsgroup as well. Even if you're not using Apache, you should find those guys know just about everything there is to know about http authentication. Good Luck and I hope I'm wrong! George Jeremy Morano wrote: > > Hi everone... > I'm having a little problem. The code below pops up a password dialog box > where the user types in a username and a password to be able to proceed. > However, if the user does not close the browser and goes back to the link, > which they pops up the diolog box again and they don't have to type in there > username and password again. They are remembered. I would like it so that > the user has to type in there username and password any and every time that > the diolog box is called on. Doe anyone know how to do this? I tried to > clear the contents of PHP_AUTH_USER and PHP_AUTH_PW at the top of the page > but that just messed things up. Can someone please help me? > > session_start(); > session_register("PHP_AUTH_USER"); > > if (isset( $PHP_AUTH_USER ) && isset($PHP_AUTH_PW)) > > // Connect to MySQL > > mysql_connect( 'l', 'c', 'c' ) > or die ( 'Unable to connect to server.' ); > > // Select database on MySQL server > > mysql_select_db( 'contact' ) > or die ( 'Unable to select database.' ); > > // Formulate the query > > $sql = "SELECT * FROM users WHERE > username = '$PHP_AUTH_USER' AND > password = '$PHP_AUTH_PW'"; > > // Execute the query and put results in $result > > $result = mysql_query( $sql ) > or die ( 'Unable to execute query.' ); > > // Get number of rows in $result. > > $num = mysql_numrows( $result ); > > if ( $num != 0 ) > > // A matching row was found - the user is authenticated. > > $auth = true; > > } > > } > > if ( ! $auth ) > > header( 'WWW-Authenticate: Basic realm="Private"' ); > header( 'HTTP/1.0 401 Unauthorized' ); > echo 'Authorization Required.'; > exit; > > } else > > session_start(); > > } > > if ($valid != "yes") { > header("Location: contact_menu.php"); > exit; > } > > ?> -- 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] urlencode
> for an example I send the variable $user='user 1', and in the url there > appears user=user+1 (which I think is correct) but when I read the variable > in the php page it displays user+1 (doesn´t it has to return to user '1'?). urlencodes counterpart is "urldecode" you need to decode each variable that youhave encoded -- 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_replace - How do I stop it being "greedy"?
Thanks Jack, preg_replace with an s modifier works a treat. I'm still curious as to how to get ereg_replace to work as well. Everything I read about regex/Posix Regular Expressions, seems to suggest that a ? should also work with ereg_replace! George Jack Dempsey wrote: > > look into the s modifier...it makes a dot match a newline as well, where > normally it wouldn't > > jack > > -Original Message- > From: George Whiffen [mailto:[EMAIL PROTECTED]] > Sent: Friday, September 07, 2001 1:09 PM > To: [EMAIL PROTECTED] > Subject: [PHP] ereg_replace - How do I stop it being "greedy"? > > Hi, > > I've got a problem with regular expression syntax with ereg_replace: > > ereg_replace(':start:(.*):end:','this is \\1',':start: first :end: middle > :start: last :end:'); > >returns - this is first :end: middle :start: last > >but I want - this is first middle this is last > > The problem seems to be that ereg_replace is being greedy on the match and > matching as much as it > can > instead of just finding the first match, handling that and then going on to > the next match. > > I can get it to work with preg_replace i.e. > > preg_replace(':start:(.*?):end:','this \\1',':start first :end: middle > :start: last :end:') > >returns - this is first middle this is last > > But my actual string is on multiple lines, and preg_replace doesn't seem to > continue trying > to match on the next line, whereas ereg_replace happily treats newlines just > like any other > character. > > So how do I stop ereg_replace being greedy or alternatively get preg_replace > to treat multiple > lines as a single source string? > > George > > -- > 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] ImageGIF
Install a version of GD with GIF support. > No, its not listed. What do I need to do? > > J > > > > -Original Message- > > phpinfo() also lists which image types your GD supports. Does it list > GIF? Later versions do not have GIF support. > > -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] ImageGIF
No, its not listed. What do I need to do? J -Original Message- phpinfo() also lists which image types your GD supports. Does it list GIF? Later versions do not have GIF support. -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] beginner code help
There is no parse error in this code. Check the line before that one. And see stristr(), strcasecmp() and strtolower() for ways to do case independant comparisons. -Rasmus On Fri, 7 Sep 2001, Nikola Veber wrote: > Hi ! > > Can anyone tell me why this line returns the parse error > > if (strstr($name, "firstname") or strstr($ime, "lastname")){ > } > > With this line I'd like to determine if string $name , which contains both first and > last name, has earlier defined first and last name, with no difference of the > order(name is first, surname last or oposite). > Can anyone tell me how to compare string values in non-case sensitive way(with > no difference between upper and lower case characters Name == name) > > > -- 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] ImageGIF
> ImageGif: No GIF support in this PHP build in counter.php > > I get this error message when I try to run this code... > > Header("Content-Type: image/gif"); > $im = ImageCreate(500, 75); > $red = ImageColorAllocate($im, 255, 0, 0); > ImageFill($im, 100, 100, $red); > ImageGIF($im); > > I installed GD. When I use phpinfo(), it says GD is enabled. What gives? phpinfo() also lists which image types your GD supports. Does it list GIF? Later versions do not have GIF support. -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]
[PHP] ImageGIF
ImageGif: No GIF support in this PHP build in counter.php I get this error message when I try to run this code... Header("Content-Type: image/gif"); $im = ImageCreate(500, 75); $red = ImageColorAllocate($im, 255, 0, 0); ImageFill($im, 100, 100, $red); ImageGIF($im); I installed GD. When I use phpinfo(), it says GD is enabled. What gives? Thanks, J -- 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] beginner code help
Hi ! Can anyone tell me why this line returns the parse error if (strstr($name, "firstname") or strstr($ime, "lastname")){ } With this line I'd like to determine if string $name , which contains both first and last name, has earlier defined first and last name, with no difference of the order(name is first, surname last or oposite). Can anyone tell me how to compare string values in non-case sensitive way(with no difference between upper and lower case characters Name == name) -- 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_replace - How do I stop it being "greedy"?
look into the s modifier...it makes a dot match a newline as well, where normally it wouldn't jack -Original Message- From: George Whiffen [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 1:09 PM To: [EMAIL PROTECTED] Subject: [PHP] ereg_replace - How do I stop it being "greedy"? Hi, I've got a problem with regular expression syntax with ereg_replace: ereg_replace(':start:(.*):end:','this is \\1',':start: first :end: middle :start: last :end:'); returns - this is first :end: middle :start: last but I want - this is first middle this is last The problem seems to be that ereg_replace is being greedy on the match and matching as much as it can instead of just finding the first match, handling that and then going on to the next match. I can get it to work with preg_replace i.e. preg_replace(':start:(.*?):end:','this \\1',':start first :end: middle :start: last :end:') returns - this is first middle this is last But my actual string is on multiple lines, and preg_replace doesn't seem to continue trying to match on the next line, whereas ereg_replace happily treats newlines just like any other character. So how do I stop ereg_replace being greedy or alternatively get preg_replace to treat multiple lines as a single source string? George -- 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] network connections
i've got a command-line php script that i've been using to deliver large amounts of e-mail. originally it relied on mail() to deliver the messages but i could easily overload sendmail and bring the box (redhat 7.1) to a crawl. so i am now using the various network functions to speak smtp directly from the script. i seem to be having a problem with an excessive number of tcp connections that eventually brings down the machine. i have attempted a semi-multi-threaded approach by spawning off additional copies of the script to deliver more mail simultaneously. so i might have 100 copies of the script running at the same time. and this was after dumping a million messages into my mysql-based mail queue. things may run okay for a few hours...maybe even a day...but then doing a netstat shows over 10k tcp connections. and the only way i've found to fix the problem is to reboot the machine. thinking that i was attempting too many connections at the same time, i throttled down the number of threads to 25. this slowed down my mail delivery of course. and it allowed the machine to stay up longer. but i eventually ran into the same problem after maybe two or three weeks. just before it died, i was showing over 30k tcp connections. are they any known issues in the php networking code that would cause this to happen? as far as i know, i should never have more than 25 tcp connections open. but i'm not sure if they are not being closed properly or what. -- -jr -- 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] ereg_replace - How do I stop it being "greedy"?
Hi, I've got a problem with regular expression syntax with ereg_replace: ereg_replace(':start:(.*):end:','this is \\1',':start: first :end: middle :start: last :end:'); returns - this is first :end: middle :start: last but I want - this is first middle this is last The problem seems to be that ereg_replace is being greedy on the match and matching as much as it can instead of just finding the first match, handling that and then going on to the next match. I can get it to work with preg_replace i.e. preg_replace(':start:(.*?):end:','this \\1',':start first :end: middle :start: last :end:') returns - this is first middle this is last But my actual string is on multiple lines, and preg_replace doesn't seem to continue trying to match on the next line, whereas ereg_replace happily treats newlines just like any other character. So how do I stop ereg_replace being greedy or alternatively get preg_replace to treat multiple lines as a single source string? George -- 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 do I find out what version of GD I'm running?
Run this function: phpinfo ([int what]) Check the manual for further details. Regards, Sumarlidi Einar Dadason SED - Graphic Design -- Phone: (+354) 4615501 Mobile: (+354) 8960376 Fax: (+354) 4615503 E-mail: [EMAIL PROTECTED] Homepage:www.sed.is -- -Original Message- From: Seb Frost [mailto:[EMAIL PROTECTED]] Sent: 7. september 2001 15:55 To: PHP (E-mail) Subject: [PHP] How do I find out what version of GD I'm running? with phpinfo it just says GD 1.6 or above. This is on a webhoster. How do I find out what version they're actually running? I tried asking but they're useless... - seb -Original Message- From: Sebastian Wenleder [mailto:[EMAIL PROTECTED]] Sent: 07 September 2001 16:36 To: Joseph Bannon; PHP (E-mail) Subject: Re: [PHP] GD At 10:06 Uhr -0500 07.09.2001, Joseph Bannon wrote: >I just installed PHP 4.0.6. > >1) Do I have to down load GD (graphics library) and install it >sperately or is it in 4.0.6 already? >2) Do I have to run anything special during configuration? >3) Do I have to completely re-install PHP and Apache? > >Thanks, > >Joseph Hi Joseph, You have to download GD from http://www.boutell.com/gd/ make sure you have zlib, libjpeg, libpng, and (if you need it) freetype if not compile and install them all... then configure php with #./configure \ --with-gd= \ --with-zlib= \ --with-jpeg-dir= \ --with-png-dir= \ --with-tiff-dir= \ --with-freetype-dir= #make #make install then you will have to restart apache Best regards, Sebastian Wenleder -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- 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] urlencode
Hi, I need to know wich is the best way to send variables through an URL,that if the variables are of the string type, and what if the variable has spaces like $string='this is a test'. I have read about the use of urlencode(), but I have a strange behaviour using this function, sometimes it work and sometimes not. for an example I send the variable $user='user 1', and in the url there appears user=user+1 (which I think is correct) but when I read the variable in the php page it displays user+1 (doesn´t it has to return to user '1'?). Thanks --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.268 / Virus Database: 140 - Release Date: 8/7/01 -- 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] Locale Month Name
LC_* are predefined constants, so: setlocale(LC_ALL, "LT"); - Original Message - From: Veniamin Goldin <[EMAIL PROTECTED]> To: php <[EMAIL PROTECTED]> Sent: Thursday, August 30, 2001 11:37 AM Subject: [PHP] Locale Month Name > Hello ! > > Please help me, > > How to get Month name according to server's locale setings ? > > I tryed to use: > > setlocale("LC_ALL", "LT"); > $month = strftime("%B", mktime(0,0,0,$m,1,$y)); > > But I get message: > > Warning: Passing locale category name as string is deprecated. Use the > LC_* -constants instead. in > > (My PHP runes on Windows Server) > > > Thank 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] > -- 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] GD
What is FreeType? J -Original Message- From: Sebastian Wenleder [mailto:[EMAIL PROTECTED]] Sent: Friday, September 07, 2001 10:36 AM To: Joseph Bannon; PHP (E-mail) Subject: Re: [PHP] GD At 10:06 Uhr -0500 07.09.2001, Joseph Bannon wrote: >I just installed PHP 4.0.6. > >1) Do I have to down load GD (graphics library) and install it sperately or >is it in 4.0.6 already? >2) Do I have to run anything special during configuration? >3) Do I have to completely re-install PHP and Apache? > >Thanks, > >Joseph Hi Joseph, You have to download GD from http://www.boutell.com/gd/ make sure you have zlib, libjpeg, libpng, and (if you need it) freetype if not compile and install them all... then configure php with #./configure \ --with-gd= \ --with-zlib= \ --with-jpeg-dir= \ --with-png-dir= \ --with-tiff-dir= \ --with-freetype-dir= #make #make install then you will have to restart apache Best regards, Sebastian Wenleder -- 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] clear contents?
Hi everone... I'm having a little problem. The code below pops up a password dialog box where the user types in a username and a password to be able to proceed. However, if the user does not close the browser and goes back to the link, which they pops up the diolog box again and they don't have to type in there username and password again. They are remembered. I would like it so that the user has to type in there username and password any and every time that the diolog box is called on. Doe anyone know how to do this? I tried to clear the contents of PHP_AUTH_USER and PHP_AUTH_PW at the top of the page but that just messed things up. Can someone please help me? -- 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] How do I find out what version of GD I'm running?
with phpinfo it just says GD 1.6 or above. This is on a webhoster. How do I find out what version they're actually running? I tried asking but they're useless... - seb -Original Message- From: Sebastian Wenleder [mailto:[EMAIL PROTECTED]] Sent: 07 September 2001 16:36 To: Joseph Bannon; PHP (E-mail) Subject: Re: [PHP] GD At 10:06 Uhr -0500 07.09.2001, Joseph Bannon wrote: >I just installed PHP 4.0.6. > >1) Do I have to down load GD (graphics library) and install it sperately or >is it in 4.0.6 already? >2) Do I have to run anything special during configuration? >3) Do I have to completely re-install PHP and Apache? > >Thanks, > >Joseph Hi Joseph, You have to download GD from http://www.boutell.com/gd/ make sure you have zlib, libjpeg, libpng, and (if you need it) freetype if not compile and install them all... then configure php with #./configure \ --with-gd= \ --with-zlib= \ --with-jpeg-dir= \ --with-png-dir= \ --with-tiff-dir= \ --with-freetype-dir= #make #make install then you will have to restart apache Best regards, Sebastian Wenleder -- 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] --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.274 / Virus Database: 144 - Release Date: 23/08/2001 -- 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] C-style parameterized macros
Hello, I have noticed that PHP can be used to define constants but not parametrized macros, a feature is is currently lacking. It is possible to use arrays instead with the only disadvantage that array values can be reassigned. I guess this is not a real concern. Does anyone know if parameterized macros will be implemented in future PHP releases? Thanks, Neil -- 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] GD
At 10:06 Uhr -0500 07.09.2001, Joseph Bannon wrote: >I just installed PHP 4.0.6. > >1) Do I have to down load GD (graphics library) and install it sperately or >is it in 4.0.6 already? >2) Do I have to run anything special during configuration? >3) Do I have to completely re-install PHP and Apache? > >Thanks, > >Joseph Hi Joseph, You have to download GD from http://www.boutell.com/gd/ make sure you have zlib, libjpeg, libpng, and (if you need it) freetype if not compile and install them all... then configure php with #./configure \ --with-gd= \ --with-zlib= \ --with-jpeg-dir= \ --with-png-dir= \ --with-tiff-dir= \ --with-freetype-dir= #make #make install then you will have to restart apache Best regards, Sebastian Wenleder -- 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: newbie looking to sync access with MySQL
Thanks for that helpful email george, it's something I've been looking at as well. In a situation I'm tackling now I've rewritten the core part of the access such that it is dependant upon data recieved from the server, rather than the server being dependant upon data from access. So far it appears to be working much better, but I would be interested to know your opinions. Tom - Original Message - From: "George Whiffen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 5:10 PM Subject: [PHP] Re: newbie looking to sync access with MySQL > Tom, > > Every man and his dog seems to have an Access database they want to view > on the web. > > What I usually do for them is : > > a) Tell them to save the data from Access as a text file, comma separated. (It's > a standard Access option). > > b) Give them a web page where they can upload it, ( discussed in the php manual). > > c) Parse the file using parsecsv and store away the bits you want in MySQL. If you > get them to leave the field names on the first line of the file (another standard > Access option), you can do a quick check that all the fields are there and in > the expected place, before you put the data into MySQL. > > d) Serve the web pages from MySQL. > > e) You may still need your Web Data Administration. There's often missing data > that you need for sensible web pages e.g. categories, more user friendly descriptions > of codes etc. > > > >From the customer's point of view the uploads are a manual exercise which doesn't sound > very sexy, and it would probably take them 3-4 minutes every time. > The good thing is that it's all pretty easy, and they should be able to get their > most junior member of staff to do it. They also get the comfort of knowing if anything > went wrong. > > If that's not acceptable, it's more tricky. In principle you could use an > ODBC interface to their Access database to establish a live connection to it > and suck up the data that way, but it's fiddly and much less reliable than > a boring old upload. > > Another option would be to execute the extract and transfer of the data via a batch > job running on their platform. But, personally, I would hate to have to support > that kind of activity. > > The bottom line as far as I'm concerned is that if they insist on holding important > information on a MS platform, they can expect a) not to have a seamless operation, > b) to have to watch out for problems themselves! Once they see how easy an extract/upload > is they probably won't mind anyway. > > Tom Beidler wrote: > > > > I have a potential customer that just called and would like to create a web > > site that would display secure info for their clients. Currently his > > employees are using a flat Access database to add, edit and delete records > > and he would like to keep it that way. > > > > Normally I would create a web manager for them to add, edit and delete the > > MySQL database. Is there an easy, reliable way to sync up Access with MySQL. > > Maybe a nightly script that could upload the contents of Access to MySQL. > > > > Would it be easier to start with ASP and SQL Server? > > > > Thanks, > > Tom > > -- > 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 includes === Dreamweaver library items
Robert, Well, I bet you're getting tired of this thread! So just a few closing remarks: a) Nested Loops - Yup, they're not so common that we can't just fudge about with a bit of embedded html. b) Luggage - I may yet agree with you about the advantages of two neatly packed bags! c) An awkward DreamWeaver/php solution - It seems I'm close to achieving what I set out, it may be functional, but it's not particularly elegant,thats for sure. Here's how it goes : For the Dreamweaver user: - the files on the site targetted by urls are .php templates which remain fully Dreamweaver editable/previewable and link-testable. All the html is in those files. The designer can include any number of Dreamweaver library items and change their names at any time as they like. - the Dreamweaver library files must be synced with the server along with the .php templates, style sheets etc. Provided the designers do that, all pages are guaranteed to have the library code in the current master (server) copy, which can be edited by any means. Designers have to watch out for master copies changing either because of the activity of other designers or programmers of course. For the php programmer: - the main body of php code (queries etc.) is in a per page include, i.e. the "template" reads the code instead of the code reading the template! (That's so the designers can check the links are ok). - the include of the code is added to the top of the designer's template in a php tag. - in the html of the template the progammer adds/checks tags for the php data and control structures i.e. for data or Example of myvar. for repeating or conditional blocks you need start and end tags or at the start and at the end of the block. There are no restrictions on the php you can embed, you can have includes of any depth, functions, whatever. - you can also, if you want, add php to library items without restriction. Noone of that seems to be too bad, but the one special and really horrid extra on each page is to force the substitution of includes for library items. It seems (but I haven't tested it fully), that the code to "top and tail " the actual template html is this : IMMEDIATELY PRIOR TO ACTUAL TEMPLATE HTML/PHP eval(dream_sub(strrev(substr(strrev(substr(<< TEMPLATE HTML/PHP etc. IMMEDIATELY AFTER ACTUAL TEMPLATE HTML/PHP where dream_sub is something like this: - function dream_sub($string) { return(preg_replace('/.*?/' ,'',$string); } (Beware, the regular expression is wrong, I'm still trying to get it to work, ereg_replace was fine but too greedy so I had to switch to preg) That's it. It's not too much code and it is the same every single time, but ugly or what! It could be a bit prettier, but as it's always going to be horrible, I'm tempted to leave it looking horrible, so noone's under any illusions! What we're actually doing is turning the whole of the template html/php into a string via the "heredoc" but while fooling Dreamweaver that we closed the php tags. We strip out the php/comment tags which fool Dreamweaver with a strrev and substr's to save having to store the text and then fooling about, (that could be changed). Then having picked up the template contents we substitute any Dreamweaver library item tags by an include of whatever the library name was. Just in case we have nested library items (I don't know if that's possible with Dreamweaver), we make sure we recursively substitute any library items in the library item files themselves as we bring them in. (That's why we have the dream_sub/implode/file stuff instead of a plain include). I reckon this should work (when I get the b regular expression working!). It should also work reasonably well with any other html editors that respect php tags, and if they have library functionality it shouldn't be too hard to adapt dream_sub for an appropriate effect. At the end of the day, this all seems to be spoiling the Dreamweavers far too much. I've even gone back to calling the pages .php rather than leaving them extensionless, just so that their stupid desktops don't get too confused! So my urls are going to be uglier but I guess it at least means that php gets some credit on the sites! Anyway, it's been very interesting to hear your ideas, and don't be surprised if I give up and switch to FastTemplate! George Robert V. Zwink wrote: > > George Whiffen, > > a) Nested Loops > One problem that I see is that if I have nested loops: > > > {LOOP1_VARIABLE} > > {LOOP2_VARIABLE} > > > > I can assign values and get the predicted result, but if I try to use the > fastTemplate method clear_dynamic("loop2") I do not get the predicted > result. The above situation is rather uncommon, and I work around it by > including HTML code into the php page, and assigning the result to a > fasttemplate v
[PHP] Re: newbie looking to sync access with MySQL
Tom, Every man and his dog seems to have an Access database they want to view on the web. What I usually do for them is : a) Tell them to save the data from Access as a text file, comma separated. (It's a standard Access option). b) Give them a web page where they can upload it, (From the customer's point of view the uploads are a manual exercise which doesn't >sound very sexy, and it would probably take them 3-4 minutes every time. The good thing is that it's all pretty easy, and they should be able to get their most junior member of staff to do it. They also get the comfort of knowing if anything went wrong. If that's not acceptable, it's more tricky. In principle you could use an ODBC interface to their Access database to establish a live connection to it and suck up the data that way, but it's fiddly and much less reliable than a boring old upload. Another option would be to execute the extract and transfer of the data via a batch job running on their platform. But, personally, I would hate to have to support that kind of activity. The bottom line as far as I'm concerned is that if they insist on holding important information on a MS platform, they can expect a) not to have a seamless operation, b) to have to watch out for problems themselves! Once they see how easy an extract/upload is they probably won't mind anyway. Tom Beidler wrote: > > I have a potential customer that just called and would like to create a web > site that would display secure info for their clients. Currently his > employees are using a flat Access database to add, edit and delete records > and he would like to keep it that way. > > Normally I would create a web manager for them to add, edit and delete the > MySQL database. Is there an easy, reliable way to sync up Access with MySQL. > Maybe a nightly script that could upload the contents of Access to MySQL. > > Would it be easier to start with ASP and SQL Server? > > Thanks, > Tom -- 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] GD
I just installed PHP 4.0.6. 1) Do I have to down load GD (graphics library) and install it sperately or is it in 4.0.6 already? 2) Do I have to run anything special during configuration? 3) Do I have to completely re-install PHP and Apache? Thanks, Joseph -- 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]
Fw: [PHP] Re: Suggesting a file name.
This really doesn't work well to say the least... I've had endless problems with it, and basically just using headers there is no great way to to it. The best solution I found is to use the mod_rewrite module in apache to map a url onto the script. - Original Message - From: "Franklin van Velthuizen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, September 07, 2001 4:02 PM Subject: [PHP] Re: Suggesting a file name. > > "Theodore Brinkman" <[EMAIL PROTECTED]> wrote in > message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > I wrote a small script to generate an image file containing a version > number > > for use in some web apps we are coding at work. The problem is, that with > > an up-to-date version of IE, the image shows up and can only be saved as a > > BMP. Older versions don't display it, but prompt for download and save it > > correctly. No problems in Mozilla (or presumably in Netscape 4.7x > either). > > > > Try: > header("Content-Disposition: filename=$filename"); > > / Franklin > > > > -- > 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] Re: how to pass authentication info to SMTP server
"Balaji Ankem" <[EMAIL PROTECTED]> wrote in message 01bc01c137e0$280b0f60$[EMAIL PROTECTED]">news:01bc01c137e0$280b0f60$[EMAIL PROTECTED]... > Hi friends, > I would like to implement sending an e-mail through SMTP server. > > Here my SMTP server needs authentication. > > How to pass the username and password to SMTP server?? > Do something similar: $username = "foo"; $password = "bar"; $fp = fsockopen ($hostname, 110, $errno, $errstr, 30) or die("could not connect"); fwrite($fp, "USER ".$username."\r\n"); fwrite($fp, "PASS ".$password."\r\n"); For more info about the protocol, take a look here: http://www.cis.ohio-state.edu/cgi-bin/rfc/rfc1939.html / franklin -- 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] Re: Suggesting a file name.
"Theodore Brinkman" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I wrote a small script to generate an image file containing a version number > for use in some web apps we are coding at work. The problem is, that with > an up-to-date version of IE, the image shows up and can only be saved as a > BMP. Older versions don't display it, but prompt for download and save it > correctly. No problems in Mozilla (or presumably in Netscape 4.7x either). > Try: header("Content-Disposition: filename=$filename"); / Franklin -- 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] Re: Image manipulation
Adam Plocher wrote: > First of all, is there anyway I could have my script take a full size image > and crop out a chunk of it to be used as a thumbnail - or just simply shrink > the image down to be used as a thumbnail? ImageCopyResized, requires GD. > Also, is there anyway to convert misc image types (gif, bmp, png, etc) into > a jpeg? between png and jpeg with gd at least. for everything else, ImageMagick -- PHP Developer, home: http://www.moijk.net | work: http://www.coretrek.com ImageSY: Get image height | http://www.php.net/manual/en/function.imagesy.php -- 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 complains when using similar_text() as documented.
> On Thu, Sep 06, 2001 at 11:04:09PM -0500, Peter Hutnick wrote: >> http://www.php.net/manual/en/function.similar-text.php states that the >> third argument should be a reference. PHP 4.0.6 complains "Warning: >> Call-time pass-by-reference has been deprecated - argument passed by >> value;" etc. >> >> But that percentage (double) is only available this way . . . >> >> Where am I going wrong? > > This might have something to do with it. From the php.ini: > > allow_call_time_pass_reference = Off > ; whether to enable the ability to force arguments to be ; passed > by reference at function-call time. This method ; is deprecated, > and is likely to be unsupported in future Yes, sorry, I am aware of this. Does this mean that similar_text is deprecated by etension? Is there maybe a FAQ on the whole pass-by-reference issue? -Peter PS: still appriciate CCs, thanks. -Peter -- 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]