php-general Digest 12 May 2002 10:20:39 -0000 Issue 1340
Topics (messages 97166 through 97211): an sql_layer 97166 by: http://www.promoozz.org [*] 97171 by: Austin Marshall PHP Hosting ... 97167 by: Tim Thorburn PHP 5?? 97168 by: Tim Thorburn 97169 by: Rasmus Lerdorf RE:[PHP]PHP Hosting.... 97170 by: r Re: Using function in PHP script n DOCROOT in PHP script in subfolder 97172 by: Phil Powell PHP can't access txt files (but TCL can..??) 97173 by: Phil Powell 97174 by: Lars Torben Wilson 97175 by: Phil Powell read all files in directory 97176 by: Andreas Indahl 97177 by: Rasmus Lerdorf 97178 by: Stuart Dallas 97180 by: Lars Torben Wilson 97181 by: olinux 97183 by: Lars Torben Wilson Re: Best way for date/time 97179 by: olinux Re: MySQL and RH 7.2 97182 by: David Freeman Send html email 97184 by: Alex Shi 97185 by: Nookie 97186 by: Liam MacKenzie 97187 by: Michael Geier 97189 by: Alex Shi 97201 by: Miguel Cruz preg_grep Help (Regular expresion) 97188 by: Brian C. Doyle Authentication with register_globals OFF 97190 by: Mike P 97192 by: Stuart Dallas 97193 by: Mike P Printing line "x" in a file 97191 by: Andrew Conner 97202 by: Miguel Cruz 97204 by: Austin Gonyou Serialize/URLencode query... 97194 by: Glenn Sieb 97196 by: John Holmes 97199 by: Glenn Sieb Yahoo/Cobalt servers/PHP 97195 by: Todd Cary 97197 by: John Holmes 97198 by: Austin Marshall Re: setcookie() 97200 by: Miguel Cruz [FYI] DNS resolver library 97203 by: Moriyoshi Koizumi .vcf files and PHP Email Form(Newbie) 97205 by: webmaster.tececo.com 97206 by: Miguel Cruz 97210 by: webmaster.tececo.com Variable Prob 97207 by: Jason Soza 97208 by: Miguel Cruz 97209 by: Jason Soza Sending Html Pages 97211 by: Salman Ahmed Administrivia: To subscribe to the digest, e-mail: [EMAIL PROTECTED] To unsubscribe from the digest, e-mail: [EMAIL PROTECTED] To post to the list, e-mail: [EMAIL PROTECTED] ----------------------------------------------------------------------
--- Begin Message ---i'm sweating on this one : function sql_fetch_row($res, $nr) { global $dbtype; switch ($dbtype) { case "MySQL": $row = mysql_fetch_row($res); return $row; break;; ... } it iz used in a php_layer.php from phpnuke, but somehow it gives errors... if i put a "@" like this: $row = @mysql_fetch_row($res); i get no errors, but no result either. Where stands the @ for? I can't find any info on thizz, what's wrong? [ProMoozz signature script initiated] [Sharon equalzz Hitler] [msg written - msg read] [ProMoozz signature script terminated] http://www.kotbelasting.be - http://www.kotbelasting.be--- End Message ---
--- Begin Message ---Http://Www.Promoozz.Org wrote: > i'm sweating on this one : > > function sql_fetch_row($res, $nr) > { > global $dbtype; > switch ($dbtype) { > > case "MySQL": > $row = mysql_fetch_row($res); > return $row; > break;; > ... > } > > it iz used in a php_layer.php from phpnuke, but somehow it gives errors... if i put >a "@" like this: > > $row = @mysql_fetch_row($res); > > i get no errors, but no result either. Where stands the @ for? I can't find any info >on thizz, what's wrong? > > [ProMoozz signature script initiated] > [Sharon equalzz Hitler] > [msg written - msg read] > [ProMoozz signature script terminated] > http://www.kotbelasting.be - http://www.kotbelasting.be > First off, anyone using phpnuke is on their own, try phpnuke.org for help. But an @ before a function suppresses error messages, it doesn't make errors go away, so it's doing precisely what it is supposed to. I also see two ;'s in a row, perhaps that is the problem, or perhaps the query was bad and that renders fetch_row useless. We or anyone would have a far better chance of helping out if you explained what the error is... it will be alot easier than debunking the code of phpnuke on our own.--- End Message ---
--- Begin Message ---Hi, I've about had it with my current hosting company as they've turned off SSH for the past month due to "security reasons" which means I can no longer add/remove tables from my MySQL database. Looking at two other hosting companies - SBC Webhosting - www.webhosting.com and Verio - www.verio.com Does anyone here use either of these companies? If so, could you please let me know your opinions of each? Thanks -Tim--- End Message ---
--- Begin Message ---Hi, In my seemingly never ending search for a decent hosting company, I've contacted some customer service people from Verio who tell me a very interesting story ... they're currently upgrading their PHP to version 5 ... which I find odd as there's only mention of 4.2.0 on php.net ... So my question is, was the guy I was talking to knowledgeable of inside things, or did he not have a clue what he was talking about? Thanks -Tim--- End Message ---
--- Begin Message ---He has no clue. There is no PHP 5. The next version will be 4.2.1 next week and probably 4.3 after that. -Rasmus On Sat, 11 May 2002, Tim Thorburn wrote: > Hi, > > In my seemingly never ending search for a decent hosting company, I've > contacted some customer service people from Verio who tell me a very > interesting story ... they're currently upgrading their PHP to version 5 > ... which I find odd as there's only mention of 4.2.0 on php.net ... > > So my question is, was the guy I was talking to knowledgeable of inside > things, or did he not have a clue what he was talking about? > > Thanks > -Tim > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---Hey Tim, I'm using 321go.biz for my hosting needs. Not a single problem so far and around 30-90 minutes for each support question to be solved which i think is pretty good. They are slightly expensive though but i joined for the Java part, got PHP free! Now that i'm into PHP I see they also offer PHP Jpeg support.... Anyway, hope that was helpful. Cheers. -R.--- End Message ---
--- Begin Message ---Found a MUCH MUCH simpler solution that works across the board.. change $HTTP_HOST to $DOCUMENT_ROOT and it works! Phil "Analysis & Solutions" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Phil: > > On Fri, May 10, 2002 at 08:01:46PM -0400, Phil Powell wrote: > > > > How do I fix this problem? I do not want to duplicate the PHP script per > > folder as there will be an enormous amount of dynamically-created subfolders > > and I will have to copy a version per folder. I want to be able to use the > > one PHP script in the DOCROOT for every PHP script in every subfolder, how > > is this done? > > Have a file in each directory called, for the sake of example, > "directory.inc" In that file, set a variable called, "$root" The > value of it should be the relative path used to find the root > directory, eg "../../". This will vary depending on the directory > depth. Each script on your site then should have > "require('./directory.inc');" at the top. Now, you'll always know > where to find the root. This also makes things easy to move from one > server to another in the future. > > Another way to do this is to use the auto_prepend_file setting to > include your file that has the function in it. > http://www.php.net/manual/en/configuration.php#ini.auto-prepend-file > > Enjoy, > > --Dan > > -- > PHP classes that make web design easier > SQL Solution | Layout Solution | Form Solution > sqlsolution.info | layoutsolution.info | formsolution.info > T H E A N A L Y S I S A N D S O L U T I O N S C O M P A N Y > 4015 7 Av #4AJ, Brooklyn NY v: 718-854-0335 f: 718-854-0409--- End Message ---
--- Begin Message ---TCL 1, PHP 0 Ok, I am frustrated.. here is my code and this portion has to be done in PHP. I have a frame that can only be accessed if 1 of 2 things occur: 1) if $HTTP_REFERER has a specific value 2) if your nickname passed in the query string is found in the existing nicknames.txt file found in /chat/nicknames.txt Here is the code: <? // Security measure to prevent bookmarking of page unless nickname exists in nicknames.txt $contents = ""; if (!preg_match("/\bchat_process_nickname\b/i", $HTTP_REFERER)) { $canAccessChatroom = 1; if (strlen($nickname) < 2) $canAccessChatroom = 0; if (!file_exists($DOCUMENT_ROOT . "/chat/nicknames.txt")) $canAccessChatroom = 0; if ($canAccessChatroom == 1) { $fileID = fopen($DOCUMENT_ROOT. "/chat/nicknames.txt", r) or die ("could not open file"); if (!$fileID) { $canAccessChatroom = 0; } else { $contents = fread($fileID); fclose($fileID); } } if ($canAccessChatroom == 1 && strlen($contents) == 0) $canAccessChatroom = 0; if ($canAccessChatroom == 1 && !preg_match("/[a-zA-Z0-9_\-]+/", $contents)) $canAccessChatroom == 0; if ($canAccessChatroom == 1) { if (!preg_match("/\b$nickname\b/i", $contents)) $canAccessChatroom == 0; } if ($canAccessChatroom == 0) { echo "<meta http-equiv=Refresh content='1;URL=http://" . $SERVER_NAME . "/chat/chat_login.php'>\n"; echo "<script>\n<!--\n location.href='http://" . $SERVER_NAME . "/chat/chat_login.php';\n\/\/-->\n</script>\n"; } } ?> No matter what I do, however, the file cannot be accessed if it exists and causes damage galore. Can anyone out there help me figure out what I did wrong; I'm completely stumped and may have to rewrite this portion of the chatroom in TCL, all of my TCL scripts have had NO problems whatsoever accessing the txt files. Phil--- End Message ---
--- Begin Message ---On Sat, 2002-05-11 at 14:53, Phil Powell wrote: > TCL 1, PHP 0 > > Ok, I am frustrated.. here is my code and this portion has to be done in > PHP. I have a frame that can only be accessed if 1 of 2 things occur: > > 1) if $HTTP_REFERER has a specific value > 2) if your nickname passed in the query string is found in the existing > nicknames.txt file found in /chat/nicknames.txt > > Here is the code: Notes: o What version of PHP? o Is register_globals on or off? i.e. are you sure $DOCUMENT_ROOT has a value and that you're not trying to open '/chat/nicknames.txt'? o Quote the 'r' in the fopen() call. o Try this all with error_reporting(E_ALL) and fix (not with '@') everything it complains about. o Your second regex checks that $contents contains at least one alpha- numeric or an underscore or a hyphen. Looks like it should be checking that the string contains *only* those characters. o fread() takes 2 parameters, not one. o 'damage galore' doesn't tell us anything. What *exactly* is the current result of running the below? > <? > // Security measure to prevent bookmarking of page unless nickname exists > in nicknames.txt > $contents = ""; > if (!preg_match("/\bchat_process_nickname\b/i", $HTTP_REFERER)) { > $canAccessChatroom = 1; > if (strlen($nickname) < 2) $canAccessChatroom = 0; > if (!file_exists($DOCUMENT_ROOT . "/chat/nicknames.txt")) > $canAccessChatroom = 0; > if ($canAccessChatroom == 1) { > $fileID = fopen($DOCUMENT_ROOT. "/chat/nicknames.txt", r) or die ("could > not open file"); > if (!$fileID) { > $canAccessChatroom = 0; > } else { > $contents = fread($fileID); > fclose($fileID); > } > } > if ($canAccessChatroom == 1 && strlen($contents) == 0) $canAccessChatroom > = 0; > if ($canAccessChatroom == 1 && !preg_match("/[a-zA-Z0-9_\-]+/", > $contents)) $canAccessChatroom == 0; > if ($canAccessChatroom == 1) { > if (!preg_match("/\b$nickname\b/i", $contents)) $canAccessChatroom == 0; > } > if ($canAccessChatroom == 0) { > echo "<meta http-equiv=Refresh content='1;URL=http://" . $SERVER_NAME . > "/chat/chat_login.php'>\n"; > echo "<script>\n<!--\n location.href='http://" . $SERVER_NAME . > "/chat/chat_login.php';\n\/\/-->\n</script>\n"; > } > } > ?> > > No matter what I do, however, the file cannot be accessed if it exists and > causes damage galore. Can anyone out there help me figure out what I did > wrong; I'm completely stumped and may have to rewrite this portion of the > chatroom in TCL, all of my TCL scripts have had NO problems whatsoever > accessing the txt files. > > Phil -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506--- End Message ---
--- Begin Message ---Swell, I found the error, and it was a STUPID one.. I misconfigured fread()! Thanx though Phil TCL 1, PHP 2 ----- Original Message ----- From: "Lars Torben Wilson" <[EMAIL PROTECTED]> To: "Phil Powell" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, May 11, 2002 6:13 PM Subject: Re: [PHP] PHP can't access txt files (but TCL can..??) > On Sat, 2002-05-11 at 14:53, Phil Powell wrote: > > TCL 1, PHP 0 > > > > Ok, I am frustrated.. here is my code and this portion has to be done in > > PHP. I have a frame that can only be accessed if 1 of 2 things occur: > > > > 1) if $HTTP_REFERER has a specific value > > 2) if your nickname passed in the query string is found in the existing > > nicknames.txt file found in /chat/nicknames.txt > > > > Here is the code: > > Notes: > > o What version of PHP? > o Is register_globals on or off? i.e. are you sure $DOCUMENT_ROOT > has a value and that you're not trying to open '/chat/nicknames.txt'? > o Quote the 'r' in the fopen() call. > o Try this all with error_reporting(E_ALL) and fix (not with '@') > everything it complains about. > o Your second regex checks that $contents contains at least one alpha- > numeric or an underscore or a hyphen. Looks like it should be > checking that the string contains *only* those characters. > o fread() takes 2 parameters, not one. > o 'damage galore' doesn't tell us anything. What *exactly* is the > current result of running the below? > > > <? > > // Security measure to prevent bookmarking of page unless nickname exists > > in nicknames.txt > > $contents = ""; > > if (!preg_match("/\bchat_process_nickname\b/i", $HTTP_REFERER)) { > > $canAccessChatroom = 1; > > if (strlen($nickname) < 2) $canAccessChatroom = 0; > > if (!file_exists($DOCUMENT_ROOT . "/chat/nicknames.txt")) > > $canAccessChatroom = 0; > > if ($canAccessChatroom == 1) { > > $fileID = fopen($DOCUMENT_ROOT. "/chat/nicknames.txt", r) or die ("could > > not open file"); > > if (!$fileID) { > > $canAccessChatroom = 0; > > } else { > > $contents = fread($fileID); > > fclose($fileID); > > } > > } > > if ($canAccessChatroom == 1 && strlen($contents) == 0) $canAccessChatroom > > = 0; > > if ($canAccessChatroom == 1 && !preg_match("/[a-zA-Z0-9_\-]+/", > > $contents)) $canAccessChatroom == 0; > > if ($canAccessChatroom == 1) { > > if (!preg_match("/\b$nickname\b/i", $contents)) $canAccessChatroom == 0; > > } > > if ($canAccessChatroom == 0) { > > echo "<meta http-equiv=Refresh content='1;URL=http://" . $SERVER_NAME . > > "/chat/chat_login.php'>\n"; > > echo "<script>\n<!--\n location.href='http://" . $SERVER_NAME . > > "/chat/chat_login.php';\n\/\/-->\n</script>\n"; > > } > > } > > ?> > > > > No matter what I do, however, the file cannot be accessed if it exists and > > causes damage galore. Can anyone out there help me figure out what I did > > wrong; I'm completely stumped and may have to rewrite this portion of the > > chatroom in TCL, all of my TCL scripts have had NO problems whatsoever > > accessing the txt files. > > > > Phil > > > -- > Torben Wilson <[EMAIL PROTECTED]> > http://www.thebuttlesschaps.com > http://www.hybrid17.com > http://www.inflatableeye.com > +1.604.709.0506 > >--- End Message ---
--- Begin Message ---Hi! How can I read all files in a directory, when I don't know which files are there? Sincerely Andreas Indahl--- End Message ---
--- Begin Message ---See http://php.net/readdir for a full example. On Sun, 12 May 2002, Andreas Indahl wrote: > Hi! > > How can I read all files in a directory, when I don't know which files are > there? > > Sincerely > Andreas Indahl > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >--- End Message ---
--- Begin Message ---On Sun, 12 May 2002 00:39:21 +0200, you wrote: >How can I read all files in a directory, when I don't know which files are >there? http://www.php.net/manual/en/class.dir.php -- Stuart--- End Message ---
--- Begin Message ---On Sat, 2002-05-11 at 15:39, Andreas Indahl wrote: > Hi! > > How can I read all files in a directory, when I don't know which files are > there? > > Sincerely > Andreas Indahl Try some of the examples from the manual: http://www.php.net/manual/en/function.opendir.php http://www.php.net/manual/en/class.dir.php Cheers, Torben -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506--- End Message ---
--- Begin Message ---$dirPath = "C:\somepath"; $dhandle = opendir($dirPath); while ($filename = readdir($dhandle)) { echo $filename . "<br>"; }// end read filenames --- Andreas Indahl <[EMAIL PROTECTED]> wrote: > Hi! > > How can I read all files in a directory, when I > don't know which files are > there? > > Sincerely > Andreas Indahl > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com--- End Message ---
--- Begin Message ---On Sat, 2002-05-11 at 15:52, olinux wrote: > $dirPath = "C:\somepath"; > $dhandle = opendir($dirPath); > > while ($filename = readdir($dhandle)) { This will bail on the first directory entry which has a name which evaluates to false. Try it after 'touch 0' in the directory you're scanning....the examples in the manual show how to do it safely. > echo $filename . "<br>"; > > }// end read filenames -- Torben Wilson <[EMAIL PROTECTED]> http://www.thebuttlesschaps.com http://www.hybrid17.com http://www.inflatableeye.com +1.604.709.0506--- End Message ---
--- Begin Message ---Have a look at ADDDATE() and SUBDATE() mysql> SELECT DATE_ADD("1997-12-31 23:59:59", -> INTERVAL 1 DAY); -> 1998-01-01 23:59:59 DATE_FORMAT(date,format) will also be very helpful to use in your queries, allowing you to return your mysql date in a human friendly format of choice. http://www.mysql.com/doc/D/a/Date_and_time_functions.html olinux --- John Fishworld <[EMAIL PROTECTED]> wrote: > Okay so I've then got > > 2002-05-08 > and whats then the best way to manipulate it > regarding > plus 3 days or plus 4 weeks ? > > > > > > > lol ! no thats not what I meant ! > > > what's best to put into MySQL > > > datetime from MySQL > > > now() > > > or from php date ! > > > > > > Regarding the format - its a german site so not > expecting many yanks > there > > > ! > > > > Sorry :) > > > > In that case it's best to stick to mysql's native > format. > > > > -- > > Jason Wong -> Gremlins Associates -> > www.gremlins.com.hk > > Open Source Software Systems Integrators > > * Web Design & Hosting * Internet & Intranet > Applications Development * > > > > /* > > I use not only all the brains I have, but all > those I can borrow as well. > > -- Woodrow Wilson > > */ > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: > http://www.php.net/unsub.php > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > __________________________________________________ Do You Yahoo!? LAUNCH - Your Yahoo! Music Experience http://launch.yahoo.com--- End Message ---
--- Begin Message ---> I tried "locate" and "find" and both come up empty for mysqladmin. > Am I missing something stupid here? How did you install it? Did you build from source or use rpm's? If you installed from rpm's which ones did you install? From memory there's about four rpm's that you'll need to have everything. Mysqladmin, again from memory, is in one of the '-client' rpm's. CYA, Dave--- End Message ---
--- Begin Message ---Hi! How can I send a html email with just the build-in function mail()? Is this required to put some infomation in "header" field? Thanks in advance! Alex--- End Message ---
--- Begin Message ---On Sunday 12 May 2002 02:00, Alex Shi wrote: > Hi! > > How can I send a html email with just the build-in function mail()? > Is this required to put some infomation in "header" field? Thanks > in advance! > > Alex mail("[EMAIL PROTECTED]",$subject,$content,"Content-type: text/html"); Greeitngs, Szymon Kosok--- End Message ---
--- Begin Message ---RTFM http://www.php.net/manual/en/function.mail.php ----- Original Message ----- From: "Alex Shi" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Sunday, May 12, 2002 10:00 AM Subject: [PHP] Send html email Hi! How can I send a html email with just the build-in function mail()? Is this required to put some infomation in "header" field? Thanks in advance! Alex -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---While I understand the necessity in not answering every question that a newbie may post, a more pleasant approach would have been: "the following is documented at http://www.php.net/manual/en/function.mail.php" or "see the Content-Type: header for instructions on how to do this". Do you think someone who won't read the docs, or search the archives, prior to the question understands what RTFM means? My recommendation: http://phpmailer.sourceforge.net While this is not using the mail() function, it is a more robust, more functional method of sending mail, including multi-part, SMTP-Auth, attachments, etc, that works with a variety of MTAs including Sendmail, Qmail, and direct SMTP transport. -- Michael Geier CDM Sports, Inc. - Systems Administrator email: [EMAIL PROTECTED] Quoting Liam MacKenzie <[EMAIL PROTECTED]>: > RTFM > http://www.php.net/manual/en/function.mail.php > > > > ----- Original Message ----- > From: "Alex Shi" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Sunday, May 12, 2002 10:00 AM > Subject: [PHP] Send html email > > > Hi! > > How can I send a html email with just the build-in function mail()? > Is this required to put some infomation in "header" field? Thanks > in advance! > > Alex > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > ------------------------------------------------- This mail sent through CDM Sports Webmail.--- End Message ---
--- Begin Message ---Thanks for all of you who answered my question. But another of my stupid question is: what is RTFM? Alex "Michael Geier" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > While I understand the necessity in not answering every question that a newbie > may post, a more pleasant approach would have been: > > "the following is documented at http://www.php.net/manual/en/function.mail.php" > or > "see the Content-Type: header for instructions on how to do this". > > Do you think someone who won't read the docs, or search the archives, prior to > the question understands what RTFM means? > > My recommendation: http://phpmailer.sourceforge.net > While this is not using the mail() function, it is a more robust, more > functional method of sending mail, including multi-part, SMTP-Auth, > attachments, etc, that works with a variety of MTAs including Sendmail, Qmail, > and direct SMTP transport. > > -- > Michael Geier > CDM Sports, Inc. - Systems Administrator > email: [EMAIL PROTECTED] > > Quoting Liam MacKenzie <[EMAIL PROTECTED]>: > > > RTFM > > http://www.php.net/manual/en/function.mail.php > > > > > > > > ----- Original Message ----- > > From: "Alex Shi" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Sunday, May 12, 2002 10:00 AM > > Subject: [PHP] Send html email > > > > > > Hi! > > > > How can I send a html email with just the build-in function mail()? > > Is this required to put some infomation in "header" field? Thanks > > in advance! > > > > Alex > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > ------------------------------------------------- > This mail sent through CDM Sports Webmail.--- End Message ---
--- Begin Message ---On Sat, 11 May 2002, Alex Shi wrote: > Thanks for all of you who answered my question. But another of > my stupid question is: what is RTFM? RTFM == Read The Flurking Manual miguel--- End Message ---
--- Begin Message ---Hello all, I have a file that has ip address in it.. I need to pull those ip addresses out. Currently I am trying: $ips=preg_grep("/^([0-9]+)\.([0-9]+)\.([0-9]+)\.([0-9]+)/",$file); print_r(array_values ($ips)); And well i am getting nothing! Anyone?--- End Message ---
--- Begin Message ---OK, this is an "authentication with PHP newbie" question... Env: WinNT 4.0, SP6a PHP 4.2.0 Apache 2.0.36 MySQL 4.0.1 Development/sandbox Trying to get accustomed to PHP 4.2.0 and PHP's preference for register_globals off, I have register_globals off. However, when I try to use $PHP_AUTH_USER and $PHP_AUTH_PW, my script fails (attempting to validate username and password credectials against MySQL...no error message and my login failure message does not show up, even after three unsuccessful challenge responses. When I set register_globals on, I am successful in gaining authorization (ie, the header('WWW-Auth....' is correct, the script works, the MySQL connection works and the query works). How, then do I define th $PHP_AUTH_USER and $PHP_AUTH_PW variables up front with register_globals off? The docs offer nothing that has led me to a logical answer. TIA!! Mike =====>script copied below <?php // Check to see if $PHP_AUTH_USER already contains info if(!isset($PHP_AUTH_USER)) { // If empty, send header causing dialog box to appear header('WWW-Authenticate: Basic realm="Authentication Area"'); header('HTTP/1.0 401 Unauthorized'); echo "You can't get in!"; exit; } elseif(isset($PHP_AUTH_USER)){ // If non-empty, check the database for matches // connect to MySQL $db=mysql_pconnect("host", "username", "password") or die("Unable to connect to database."); // select database on MySQL server mysql_select_db("mydb",$db) or die("Unable to select database."); // Formulate the query $sql = "SELECT username, password FROM auth WHERE username='$PHP_AUTH_USER' AND password='$PHP_AUTH_PW'"; // Execute the query and put results in $result $result = mysql_query($sql); // Get number of rows in $result. 0 if invalid, 1 if valid. $num = mysql_numrows($result); if($num != "0") { echo "<P>You are authorized!</p>"; exit; } else{ header('WWW-Authenticate: Basic realm="Authentication Area""'); header('HTTP/1.0 401 Unauthorized'); echo "You need to login with correct credentials."; exit; } } ?>--- End Message ---
--- Begin Message ---On Sat, 11 May 2002 21:21:27 -0400, you wrote: >Trying to get accustomed to PHP 4.2.0 and PHP's preference for >register_globals off, I have register_globals off. > >However, when I try to use $PHP_AUTH_USER and $PHP_AUTH_PW, my script fails >(attempting to validate username and password credectials against MySQL...no >error message and my login failure message does not show up, even after >three unsuccessful challenge responses. > >When I set register_globals on, I am successful in gaining authorization >(ie, the header('WWW-Auth....' is correct, the script works, the MySQL >connection works and the query works). > >How, then do I define th $PHP_AUTH_USER and $PHP_AUTH_PW variables up front >with register_globals off? They are in the $_SERVER superglobal. Change your references to them to... $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] You might want to read up on what register_globals actually does since it's clear that you don't fully understand it yet: http://www.php.net/manual/en/security.registerglobals.php -- Stuart--- End Message ---
--- Begin Message ---Thanks, Stuart. I'll admit I don't "fully" I understand register_globals. Beyond that, I am sure I am not clear on the value of NOT using register_globals. I am wading through the docs constantly. Haven't quite finished. Regardless, thanks for the assist. Mike ----- Original Message ----- From: "Stuart Dallas" <[EMAIL PROTECTED]> To: "Mike P" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Saturday, May 11, 2002 10:03 PM Subject: Re: [PHP] Authentication with register_globals OFF On Sat, 11 May 2002 21:21:27 -0400, you wrote: >Trying to get accustomed to PHP 4.2.0 and PHP's preference for >register_globals off, I have register_globals off. > >However, when I try to use $PHP_AUTH_USER and $PHP_AUTH_PW, my script fails >(attempting to validate username and password credectials against MySQL...no >error message and my login failure message does not show up, even after >three unsuccessful challenge responses. > >When I set register_globals on, I am successful in gaining authorization >(ie, the header('WWW-Auth....' is correct, the script works, the MySQL >connection works and the query works). > >How, then do I define th $PHP_AUTH_USER and $PHP_AUTH_PW variables up front >with register_globals off? They are in the $_SERVER superglobal. Change your references to them to... $_SERVER['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_PW'] You might want to read up on what register_globals actually does since it's clear that you don't fully understand it yet: http://www.php.net/manual/en/security.registerglobals.php -- Stuart--- End Message ---
--- Begin Message ---I have a script where I need to get the text from line number "$line" in file "$filename" then save it to a var ($text) and then print it. For example, in the file lamb.txt (just an example file): "Mary was a little lamb, whose fleece was as white as snow." I need to get line number 3 ("fleece") and print it ("print $text"). How would I go about this? Andrew Conner (All apologies if this messes up and does a multi-post)--- End Message ---
--- Begin Message ---On Sat, 11 May 2002, Andrew Conner wrote: > I have a script where I need to get the text from line number "$line" in > file "$filename" then save it to a var ($text) and then print it. For > example, in the file lamb.txt (just an example file): > "Mary was > a little lamb, whose > fleece > was as > white as snow." > I need to get line number 3 ("fleece") and print it ("print $text"). > How would I go about this? fopen() the file and call fgets() three times. The return from the third fgets call will contain the third line (including the terminating newline, so strip() it if you don't want that). miguel--- End Message ---
--- Begin Message ---On Sun, 2002-05-12 at 00:10, Miguel Cruz wrote: > On Sat, 11 May 2002, Andrew Conner wrote: > > I have a script where I need to get the text from line number > "$line" in > > file "$filename" then save it to a var ($text) and then print it. > For > > example, in the file lamb.txt (just an example file): > > "Mary was > > a little lamb, whose > > fleece > > was as > > white as snow." > > I need to get line number 3 ("fleece") and print it ("print > $text"). > > How would I go about this? > Perhaps you might say, using a for loop, with x=$somelineno, type of format might be the easiest way to do this from user input or some such thing. > fopen() the file and call fgets() three times. The return from the > third > fgets call will contain the third line (including the terminating > newline, > so strip() it if you don't want that). > > miguel > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- Austin Gonyou Systems Architect, CCNA Coremetrics, Inc. Phone: 512-698-7250 email: [EMAIL PROTECTED] "One ought never to turn one's back on a threatened danger and try to run away from it. If you do that, you will double the danger. But if you meet it promptly and without flinching, you will reduce the danger by half." Sir Winston Churchill--- End Message ---
signature.asc
Description: This is a digitally signed message part
--- Begin Message ---I'd like to pass a bunch of variables to another PHP page for processing there... I think serialize() and urlencode() will do what I'm looking for.. can I pass multiple strings through this? I'm also not clear on how I can decode the separate strings out... Can someone point me in the right direction? Thanks, everyone! Glenn --- The original portions of this message are the copyright of the author (c)1998-2002 Glenn E. Sieb. ICQ UIN: 300395 IRC Nick: Rainbear "All acts of Love and Pleasure are Her rituals"-Charge of the Goddess--- End Message ---
--- Begin Message ---You should use sessions. All you have to do is call session_start() at the beginning of your code. Then, any variable you want to save to the session, you simply use: $_SESSION["name"] = $name; Then, on the next page, call session_start() again, and you'll have the value of $name from the previous page in the variable $_SESSION["name"] It's a little different if you're not using PHP 4.2, so read the manuals on sessions... ---John Holmes... > -----Original Message----- > From: Glenn Sieb [mailto:[EMAIL PROTECTED]] > Sent: Saturday, May 11, 2002 7:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Serialize/URLencode query... > > I'd like to pass a bunch of variables to another PHP page for processing > there... I think serialize() and urlencode() will do what I'm looking > for.. > can I pass multiple strings through this? I'm also not clear on how I can > decode the separate strings out... > > Can someone point me in the right direction? > > Thanks, everyone! > Glenn > > --- > The original portions of this message are the copyright of the author > (c)1998-2002 Glenn E. Sieb. ICQ UIN: 300395 IRC Nick: Rainbear > "All acts of Love and Pleasure are Her rituals"-Charge of the Goddess > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php--- End Message ---
--- Begin Message ---At 12:11 AM 5/12/2002 -0700, John Holmes posted the following... >You should use sessions. All you have to do is call session_start() at >the beginning of your code. Then, any variable you want to save to the >session, you simply use: That did the trick! Thanks for the explanation, John! Now I have a nifty script that reads the variables from my MSSQL query script, and creates a MS Excel file using the data without having to have a separate Excel-creating script for every page... :))))) This rocks! Thanks again, John! Glenn (I could post the code from that script, as well, if people would like to see it..?) --- The original portions of this message are the copyright of the author (c)1998-2002 Glenn E. Sieb. ICQ UIN: 300395 IRC Nick: Rainbear "All acts of Love and Pleasure are Her rituals"-Charge of the Goddess--- End Message ---
--- Begin Message ---One of my clients signed up for service at Yahoo for space on a Cobalt server. The specs say that it has Php and Interbase. I go to the server and do a phpinfo() and find out that Interbase is not compiled into PHP but MySQL is. Then I find out that MySQL is *not* installed on the server. Am I missing something here? If one wants to have dynamic pages and uses PHP, then *some* DB has to be available, correct? Todd -- Todd Cary Ariste Software 2200 D Street Extension Petaluma, CA 94952 707-773-4523 [EMAIL PROTECTED]--- End Message ---
--- Begin Message ---> Am I missing something here? If one wants to have dynamic pages and uses > PHP, > then *some* DB has to be available, correct? Ideally, yes, you'd want a database. But you could do it with text files... ---John Holmes...--- End Message ---
--- Begin Message ---Todd Cary wrote: > One of my clients signed up for service at Yahoo for space on a Cobalt server. > The specs say that it has Php and Interbase. I go to the server and do a > phpinfo() and find out that Interbase is not compiled into PHP but MySQL is. > Then I find out that MySQL is *not* installed on the server. > > Am I missing something here? If one wants to have dynamic pages and uses PHP, > then *some* DB has to be available, correct? > > Todd > > -- > Todd Cary > Ariste Software > 2200 D Street Extension > Petaluma, CA 94952 > 707-773-4523 > [EMAIL PROTECTED] > > A DB isn't required for a dynamic site, but it certainly makes things easier. But a database does not have to be installed on the server for you to make use of a database. Since the mysql support is built-in, you can make use of the mysql_connect,mysql_query,etc... functions to connect to an external database.--- End Message ---
--- Begin Message ---On Sat, 11 May 2002, jtjohnston wrote: > This is a bug "Feature/Change Request" I made to: > http://bugs.php.net/bug.php?id=17158 > > setcookie() states "cookies must be sent before any other headers > are sent (this is a restriction of cookies, not PHP). > > I argue this is a restriction of PHP, not cookies. It's a benefit of PHP. Unlike certain other languages, PHP gives you finer control over how things are sent. The side-effect of this is that you are able to attempt things that don't make sense and can't work. If you want to use setcookie() anywhere within your PHP program, then just call ob_start() at the top of your code and go to town. miguel--- End Message ---
--- Begin Message ---Hello, I wrote a DNS resolver library in pure PHP script. The library can be run both on windows and on *nix variants. (I have not tested on BeOS) The package contains a wrapper library that provides almost the same functionality of getmxrr() and checkdnsrr(), so if you would like to run PHP scripts that uses these functions on win32 platforms, it may help you. If you are interested, please visit http://phpresolver.sourceforge.net/ Thanks -- Moriyoshi Koizumi--- End Message ---
--- Begin Message ---I want to create an e-mail form that writes a (person's name).vcf(vCard) file and attaches it to the message. This would allow me to eaisly add people to my address book. The source of a sample .vcf(vCard) file is shown below: BEGIN:VCARD VERSION:2.1 N:Harrison;JJ FN:Harrison, JJ ORG:TecEco Pty. Ltd.;IT TITLE:Webmaster ADR;WORK:;;497 main road Glenorchy;Hobart;Tasmania;7010;Australia LABEL;WORK;ENCODING=QUOTED-PRINTABLE:497 main road Glenorchy=0D=0AHobart, Tasmania 7010=0D=0AAustralia ADR;HOME:;;12 Harbinger Lane Austin's Ferry;Hobart;Tasmania;7011;Australia LABEL;HOME;ENCODING=QUOTED-PRINTABLE:12 Harbinger Lane Austin's Ferry=0D=0AHobart, Tasmania 7011=0D=0AAustralia X-WAB-GENDER:2 URL;WORK:http://www.tececo.com EMAIL;PREF;INTERNET:[EMAIL PROTECTED] REV:20020512T063717Z END:VCARD Does anyone have any ideas or know of a pre-built script to do this? Thanks, JJ Harrison [EMAIL PROTECTED] www.tececo.com--- End Message ---
--- Begin Message ---Use any of about 10 billion available MIME mail classes/functions (or write your own; there's really nothing to it) and attach the vcard as content-type: text/x-vcard. miguel On Sun, 12 May 2002 [EMAIL PROTECTED] wrote: > I want to create an e-mail form that writes a (person's name).vcf(vCard) > file and attaches it to the message. This would allow me to eaisly add > people to my address book. > > The source of a sample .vcf(vCard) file is shown below: > BEGIN:VCARD > VERSION:2.1 > N:Harrison;JJ > FN:Harrison, JJ > ORG:TecEco Pty. Ltd.;IT > TITLE:Webmaster > ADR;WORK:;;497 main road Glenorchy;Hobart;Tasmania;7010;Australia > LABEL;WORK;ENCODING=QUOTED-PRINTABLE:497 main road Glenorchy=0D=0AHobart, > Tasmania 7010=0D=0AAustralia > ADR;HOME:;;12 Harbinger Lane Austin's Ferry;Hobart;Tasmania;7011;Australia > LABEL;HOME;ENCODING=QUOTED-PRINTABLE:12 Harbinger Lane Austin's > Ferry=0D=0AHobart, Tasmania 7011=0D=0AAustralia > X-WAB-GENDER:2 > URL;WORK:http://www.tececo.com > EMAIL;PREF;INTERNET:[EMAIL PROTECTED] > REV:20020512T063717Z > END:VCARD > > Does anyone have any ideas or know of a pre-built script to do this? > > Thanks, > > JJ Harrison > [EMAIL PROTECTED] > www.tececo.com > >--- End Message ---
--- Begin Message ---I don't have much experiance with MIME. where could I find a tutorial or ready made class? ----- Original Message ----- From: "Miguel Cruz" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Sunday, May 12, 2002 4:41 PM Subject: Re: [PHP] .vcf files and PHP Email Form(Newbie) > Use any of about 10 billion available MIME mail classes/functions (or > write your own; there's really nothing to it) and attach the vcard as > content-type: text/x-vcard. > > miguel > > On Sun, 12 May 2002 [EMAIL PROTECTED] wrote: > > I want to create an e-mail form that writes a (person's name).vcf(vCard) > > file and attaches it to the message. This would allow me to eaisly add > > people to my address book. > > > > The source of a sample .vcf(vCard) file is shown below: > > BEGIN:VCARD > > VERSION:2.1 > > N:Harrison;JJ > > FN:Harrison, JJ > > ORG:TecEco Pty. Ltd.;IT > > TITLE:Webmaster > > ADR;WORK:;;497 main road Glenorchy;Hobart;Tasmania;7010;Australia > > LABEL;WORK;ENCODING=QUOTED-PRINTABLE:497 main road Glenorchy=0D=0AHobart, > > Tasmania 7010=0D=0AAustralia > > ADR;HOME:;;12 Harbinger Lane Austin's Ferry;Hobart;Tasmania;7011;Australia > > LABEL;HOME;ENCODING=QUOTED-PRINTABLE:12 Harbinger Lane Austin's > > Ferry=0D=0AHobart, Tasmania 7011=0D=0AAustralia > > X-WAB-GENDER:2 > > URL;WORK:http://www.tececo.com > > EMAIL;PREF;INTERNET:[EMAIL PROTECTED] > > REV:20020512T063717Z > > END:VCARD > > > > Does anyone have any ideas or know of a pre-built script to do this? > > > > Thanks, > > > > JJ Harrison > > [EMAIL PROTECTED] > > www.tececo.com > > > >--- End Message ---
--- Begin Message ---Argh! I hate it when one little annoying thing starts up right when I think I have the coding finished! I have the following code: if($last_name) { printf("%s %s's<br><b>%s</b><br>%s\n</td>",$first_name,$last_name,$year,$color); } else { printf("%s's<br><b>%s</b><br>%s\n</td>",$first_name,$year,$color); } So if the person has a last name in the database, print "John Doe's 1990 Red" and if they don't, print "John's 1990 Red". This is in a while() statement, and it works except that on one particular query, the last record that comes up has a NULL value for the last name, but rather than printing $first_name's it prints $first_name $last_name using the last name of the previous record! Am I missing something there? Do I need to clear out a variable somewhere? It seems like since $last_name isn't even called in the else statement, it shouldn't even be showing up! Jason Soza--- End Message ---
--- Begin Message ---It would seem the only way this could happen is if $last_name evaluates to true. Two suggestions: 1) Make some extra change in one of the printf statements so you can see which one is really being called. 2) If that doesn't illuminate anything, show a little more code. miguel On Sat, 11 May 2002, Jason Soza wrote: > Argh! > > I hate it when one little annoying thing starts up right when I think I have > the coding finished! I have the following code: > > if($last_name) { > printf("%s > %s's<br><b>%s</b><br>%s\n</td>",$first_name,$last_name,$year,$color); > } else { > printf("%s's<br><b>%s</b><br>%s\n</td>",$first_name,$year,$color); > } > > So if the person has a last name in the database, print "John Doe's 1990 > Red" and if they don't, print "John's 1990 Red". > > This is in a while() statement, and it works except that on one particular > query, the last record that comes up has a NULL value for the last name, but > rather than printing $first_name's it prints $first_name $last_name using > the last name of the previous record! > > Am I missing something there? Do I need to clear out a variable somewhere? > It seems like since $last_name isn't even called in the else statement, it > shouldn't even be showing up! > > Jason Soza > > >--- End Message ---
--- Begin Message ---Thanks for the debugging tip... Seems that the 'else' statement wasn't being called at all, so for some reason $last_name was evaluating to true even though there's a NULL entry for that record/field. I used a different query, where a person with a NULL last_name showed up first, and the 'else' statement still wasn't being called but there was no $last_name showing. Anyway, I added "ORDER BY last_name" to my mysql_query() statement and for some reason the 'else' statements started working. Any ideas on why that would be? I'm glad it works now, but I'm a little confused as to why it works. Thanks again. -----Original Message----- From: Miguel Cruz [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 11, 2002 11:06 PM To: Jason Soza Cc: [EMAIL PROTECTED] Subject: Re: [PHP] Variable Prob It would seem the only way this could happen is if $last_name evaluates to true. Two suggestions: 1) Make some extra change in one of the printf statements so you can see which one is really being called. 2) If that doesn't illuminate anything, show a little more code. miguel On Sat, 11 May 2002, Jason Soza wrote: > Argh! > > I hate it when one little annoying thing starts up right when I think I have > the coding finished! I have the following code: > > if($last_name) { > printf("%s > %s's<br><b>%s</b><br>%s\n</td>",$first_name,$last_name,$year,$color); > } else { > printf("%s's<br><b>%s</b><br>%s\n</td>",$first_name,$year,$color); > } > > So if the person has a last name in the database, print "John Doe's 1990 > Red" and if they don't, print "John's 1990 Red". > > This is in a while() statement, and it works except that on one particular > query, the last record that comes up has a NULL value for the last name, but > rather than printing $first_name's it prints $first_name $last_name using > the last name of the previous record! > > Am I missing something there? Do I need to clear out a variable somewhere? > It seems like since $last_name isn't even called in the else statement, it > shouldn't even be showing up! > > Jason Soza--- End Message ---
--- Begin Message ---Hi, I am trying to send html pages via email, that is instead of sending plain text format to the client I am trying to send Rich Text using mail function of PHP. At first I was sending -------------------------- Hello Bob, Thanks for downloading this from my site -------------------------- BUT for Rich Text I am doing -------------------------- <!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.0 Transitional//EN'> <html> <head> <meta content="text/html; charset=iso-8859-1" http-equiv="Content-Type"> </head> <body> <div align="left"> <table border="0" cellpadding="10" cellspacing="0" width="500"> <tr> <td> <font face="Verdana" size="2"> Hi, <br> Thanks for downloading this from my site </font> </td> </tr> </body> </html> -------------------------- But what happens is instead of sending html page it sends as a text with all code displayed as it is without being parsed. Please tell what can I do to send rich text emails as the this one u are reading to the clients using PHP mail function. Kind Regards Salman--- End Message ---