php-general Digest 10 May 2005 15:08:42 -0000 Issue 3446
php-general Digest 10 May 2005 15:08:42 - Issue 3446 Topics (messages 214808 through 214840): While and echoing HTML 214808 by: Mark Sargent 214810 by: Prathaban Mookiah 214811 by: Fabian Müller 214813 by: Mark Sargent 214814 by: Mary-Anne Nayler 214815 by: Mary-Anne Nayler 214816 by: darren kirby 214817 by: Mark Sargent 214819 by: Richard Lynch 214821 by: Burhan Khalid 214837 by: Jared Williams Re: Please Ignore 214809 by: Mark Sargent Header location, redirection loses parameters, 214812 by: Olav Draageset 214818 by: Richard Lynch 214822 by: Prathaban Mookiah Re: Wash with SOAP 214820 by: Burhan Khalid using header ('Location:) to pass varaiables 214823 by: Ross 214825 by: Marek Kilimajer 214828 by: Angelo Zanetti strpos with array? 214824 by: Merlin 214826 by: Marek Kilimajer 214827 by: Shaw, Chris - Accenture 214829 by: Burhan Khalid 214833 by: Merlin 214836 by: Merlin Re: A couple questions about templating 214830 by: Rory Browne Re: Accessible HTML - OT 214831 by: Leif Gregory 214840 by: Mikey Editing PDF 214832 by: Sam Smith String manipulation out of the box solution? 214834 by: Merlin Password encryption and password retrieval 214835 by: Deep how to know whether web server of a remote machine is running or not 214838 by: balwant singh yet another php templating question 214839 by: Ryan A 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: php-general@lists.php.net -- ---BeginMessage--- Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..? html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. ---End Message--- ---BeginMessage--- I guess it is the missing semicolon. And you can write: echo trtd? echo $product_type ?/td/tr as simply echo trtd$product_type/td/tr Prathap -- Original Message --- From: Mark Sargent [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 10 May 2005 13:23:51 +0900 Subject: [PHP] While and echoing HTML Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans- serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I
Re: [PHP] While and echoing HTML
I guess it is the missing semicolon. And you can write: echo trtd? echo $product_type ?/td/tr as simply echo trtd$product_type/td/tr Prathap -- Original Message --- From: Mark Sargent [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 10 May 2005 13:23:51 +0900 Subject: [PHP] While and echoing HTML Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans- serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..? html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
Mark Sargent [EMAIL PROTECTED] writes: $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ You should put $i++ into the while loop. And you should add an ; at the end of the echo line as well as at the end of $i++. With kind regards, Fabian Müller -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header location, redirection loses parameters,
I have several URLs that I want to point to the same site with a different parameter. I try to do this by redirecting all to the same location, by ? hader (Location: http://mysite.com/index.php?var1=value1var2=value2;); exit; ? The redirection is done properly, but variables are not sent. Can anyone say what should be done? (some init settings ??) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
Prathaban Mookiah wrote: I guess it is the missing semicolon. And you can write: echo trtd? echo $product_type ?/td/tr as simply echo trtd$product_type/td/tr Prathap -- Original Message --- From: Mark Sargent [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 10 May 2005 13:23:51 +0900 Subject: [PHP] While and echoing HTML Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans- serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..? html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- Hi All, Thanx. I saw the extra echo and removed it. Problem with that code, though. It displays only the 1st record, repeatedly, causing the browser to hang. Can anyone see what is wrong..? Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
oh, and the i++ should be inside the while loop and there is also a missing semi colon after the echo, ie; $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr; $i++ ; } Mark Sargent wrote, On 10/05/05 02:23 PM: Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..? html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
quoth the Mark Sargent: snip html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr You are already in a php block here. Why the '?' ? Try: echo trtd$product_type/td/tr; } $i++ As the error message is trying to tell you, php statements are terminated with semi-colons: $i++; ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. -d -- darren kirby :: Part of the problem since 1976 :: http://badcomputer.org ...the number of UNIX installations has grown to 10, with more expected... - Dennis Ritchie and Ken Thompson, June 1972 pgpVCEzIs6ipf.pgp Description: PGP signature
Re: [PHP] While and echoing HTML
Hi Mark, As far as I can see the only problem is that you have forgotten to add a semicolon after the i++ Cheers, Mary-Anne Mark Sargent wrote, On 10/05/05 02:23 PM: Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..? html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
Mary-Anne Nayler wrote: oh, and the i++ should be inside the while loop and there is also a missing semi colon after the echo, ie; $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr; $i++ ; } Mark Sargent wrote, On 10/05/05 02:23 PM: Hi All, this page, http://www.freewebmasterhelp.com/tutorials/phpmysql/5 has the below code, ? $i=0; while ($i $num) { $first=mysql_result($result,$i,first); $last=mysql_result($result,$i,last); $phone=mysql_result($result,$i,phone); $mobile=mysql_result($result,$i,mobile); $fax=mysql_result($result,$i,fax); $email=mysql_result($result,$i,email); $web=mysql_result($result,$i,web); ? tr tdfont face=Arial, Helvetica, sans-serif? echo $first. .$last; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $phone; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $mobile; ?/font/td tdfont face=Arial, Helvetica, sans-serif? echo $fax; ?/font/td tdfont face=Arial, Helvetica, sans-serifa href=mailto:? echo $email; ?E-mail/a/font/td tdfont face=Arial, Helvetica, sans-serifa href=? echo $web; ?Website/a/font/td /tr ? $i++; } echo /table; which I basically understand, except the html generation. I am trying to create something similiar, although, I think there are some errors in even perhaps my logic..? html body h1centerJumbo Status/center/h1br ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $myrow = mysql_fetch_array($result); $num = mysql_num_rows($result); ? table aligh=center border=2 tr tdProduct Type/td /tr ? $i=0; while ($i $num){ $product_type=mysql_result($result,$i,product_type_detail); echo trtd? echo $product_type ?/td/tr } $i++ ? /table /body /html I get the folowing error, *Parse error*: parse error, unexpected '}', expecting ',' or ';' in */var/www/html/products.php* on line *20 * which is the $i++ section. Cheers. Mark Sargent. Hi All, yes, changed it a little. Works fine now. Suprised at how much I've forgotten about HTML too. Cheers. Mark Sargent. html body h1centerJumbo Status/center/h1br table aligh=center border=2 tr tdProduct Type/td /tr ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); $num = mysql_num_rows($result); for ($i=0; $i$num; $i++){ $myrow = mysql_fetch_array($result); $product_type=mysql_result($result,$i,product_type_detail); echo trtd$product_type/td/tr; } ? /table /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header location, redirection loses parameters,
On Mon, May 9, 2005 3:16 pm, Olav Draageset said: I have several URLs that I want to point to the same site with a different parameter. I try to do this by redirecting all to the same location, by ? hader (Location: http://mysite.com/index.php?var1=value1var2=value2;); exit; ? I would expect it to just work if you spelled 'header' correctly... Are you sure you don't have some kind of mod_rewrite stuff messing you up? Can you surf DIRECTLY to that URL in your browser and get what you expect? The redirection is done properly, but variables are not sent. Can anyone say what should be done? (some init settings ??) AFAIK there is no php.ini setting that would affect/cause this... You could read through all of php.ini.dist (?) and its comments from the CVS source in an hour to be sure. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
On Mon, May 9, 2005 10:57 pm, Mark Sargent said: Thanx. I saw the extra echo and removed it. Problem with that code, though. It displays only the 1st record, repeatedly, causing the browser to hang. Can anyone see what is wrong..? Cheers. Everybody else has told you to move the $i++; inside the while { } loop. I'm not gonna tell you that. I'm gonna tell you to get out a pencil and some paper, and walk through your code, writing down exactly what data goes where, in which variables, on each line. Make yourself a nice big wide columnar sheet of paper tracking each variable. LINE | $db | $result | $myrow | $num | $i | $product_type | 1 2 3 4 5 | db-link | 6 7 || db-result | . . . You need to do this. Trust me. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] While and echoing HTML
Mary-Anne Nayler wrote: Hi Mark, As far as I can see the only problem is that you have forgotten to add a semicolon after the i++ Mark: Since you are not displaying the counter, you really don't need to mess with $i. You can reduce your code to just : ?php $db = mysql_connect(localhost, root, grunger); mysql_select_db(status,$db); $result = mysql_query(SELECT ProductTypes.product_type_detail FROM ProductTypes,$db); ? table aligh=center border=2 tr tdProduct Type/td /tr ?php while($myrow = mysql_fetch_assoc($result)) echo trtd.$row['product_type']./td/tr; } ? /table /body /html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wash with SOAP
Jay Blanchard wrote: It has come to a point where a vendor is requiring that we use SOAP to access a service that they provide, so I need some recommendations... a. Do I build my own request/receipt functions. 2. Do I use something like nusoap or Pears' SOAP classes? Would those of you who are experienced with PHP and SOAP give me your opinions? TVMIA! PHP5 has excellent SOAP capabilities with the built-in SOAP extention. So, if you are using PHP5, you have no worries. Hop over to www.php.net/soap and start browsing the function list. If you are not using PHP5, then either NuSOAP or the PEAR libs will work. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header location, redirection loses parameters,
Are you trying to assign the value value1 to var1 or are you trying to assign the value of the variable value1 to var1? Prathap -- Original Message --- From: Olav Draageset [EMAIL PROTECTED] To: php-general@lists.php.net Sent: Tue, 10 May 2005 00:16:33 +0200 Subject: [PHP] Header location, redirection loses parameters, I have several URLs that I want to point to the same site with a different parameter. I try to do this by redirecting all to the same location, by ? hader (Location: http://mysite.com/index.php?var1=value1var2=value2;); exit; ? The redirection is done properly, but variables are not sent. Can anyone say what should be done? (some init settings ??) Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- End of Original Message --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] using header ('Location:) to pass varaiables
Is it possible to send variables using header() ? I have tried variations on the theme header ('Location: email_confirm.php?email=$email); but nothing seems to work. Ta, Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] strpos with array?
Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example: $replace = array(picture, pics); $pos = strpos ($term, $replace); if ($pos !== false) { $term = str_replace($replace, , $term); echo 'term without the word:'.$term; } This does of course not work since strpos does not take arrays. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using header ('Location:) to pass varaiables
Ross wrote: Is it possible to send variables using header() ? I have tried variations on the theme header ('Location: email_confirm.php?email=$email); but nothing seems to work. I don't know what you tried, but the above results in parse error. Try: header (Location: email_confirm.php?email=$email); email_confirm.php: echo $_GET['email']; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos with array?
Merlin wrote: Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example: $replace = array(picture, pics); $pos = strpos ($term, $replace); if ($pos !== false) { $term = str_replace($replace, , $term); echo 'term without the word:'.$term; } This does of course not work since strpos does not take arrays. Thank you for any help, Merlin http://www.php.net/array_search -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] strpos with array?
Hello, Have you tried using array_keys or array_search for finding an occurrence in an array? HTH. Chris. -Original Message- From: Merlin [mailto:[EMAIL PROTECTED] Sent: 10 May 2005 11:11 To: php-general@lists.php.net Subject: [PHP] strpos with array? * This e-mail has been received by the Revenue Internet e-mail service. * Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example: $replace = array(picture, pics); $pos = strpos ($term, $replace); if ($pos !== false) { $term = str_replace($replace, , $term); echo 'term without the word:'.$term; } This does of course not work since strpos does not take arrays. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php This message has been delivered to the Internet by the Revenue Internet e-mail service * -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] using header ('Location:) to pass varaiables
try this header(Location: email_confirm.php?email=.$email); exit(); Angelo Zanetti Z Logic www.zlogic.co.za [c] +27 72 441 3355 [t] +27 21 469 1052 Ross wrote: Is it possible to send variables using header() ? I have tried variations on the theme header ('Location: email_confirm.php?email=$email); but nothing seems to work. Ta, Ross -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos with array?
Merlin wrote: Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example: $replace = array(picture, pics); $pos = strpos ($term, $replace); //if ($pos !== false) { if (in_array($term,$replace)) { $term = str_replace($replace, , $term); echo 'term without the word:'.$term; } http://www.php.net/in_array -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A couple questions about templating
This has all been done before, and in a number of ways. If you really *must* build your own templating class, go and thoroughly review the code of those that already exist: Smarty, Savant, paTemplate, FastTemplate, etc. Figure out how each solved the problems. Then determine if you can improve upon their solutions. This has all been done before, and I'm assuming that the James knows, and has seen that before, since he used the same common method names, as is in many php templating systems. $class-assign has been used in any templating system I've ever seen(although to be honest I haven't seen that many). I don't think the fact that it has been done before should inhibit him from doing it again. Carrying out the process, is one of the most educational ways, and perhaps one of the most enlightening ways to see how a process works. I'm not sure how many lines of code are in Savant, paTemplate, or FastTemplate, etc, but smarty has way too many to be used as a learning tool, and there are times, when you want raw speed, that can only be delivered via minimal, specialist code. Smarty is also too complicated to be used by someone without good knowledge of templating, and one of the best ways to understand it is to write your own IMHO. I think this question, whilst centred around templating, offers opportunities for topics that aren't directly related to templating, and perhaps PHP Programming in General. One particular area of potential interest is dynamic code generation. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- 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
Re: [PHP] Accessible HTML - OT
Hello Mary-Anne, Monday, May 9, 2005, 5:15:27 PM, you wrote: MAN Check out Joe Clarkes website: http://joeclark.org. Joe is an MAN expert in web accessibility issues. I'm not claiming to be even remotely as good as Joe, but looking at his site, I didn't see much in the way of helpful examples (maybe I didn't look hard enough). Recently I decided to write a tutorial on Web Accessibility and XHTML 1.0 Strict so that I could learn them. If you're interested, it's at: http://www.devtek.org/test Cheers, Leif Gregory -- TB Lists Moderator (and fellow registered end-user) PCWize Editor / ICQ 216395 / PGP Key ID 0x7CD4926F Web Site http://www.PCWize.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Editing PDF
I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos with array?
Burhan Khalid wrote: Merlin wrote: Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example: $replace = array(picture, pics); $pos = strpos ($term, $replace); //if ($pos !== false) { if (in_array($term,$replace)) { $term = str_replace($replace, , $term); echo 'term without the word:'.$term; } http://www.php.net/in_array Thank you! That was exactly what I was searching for. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] String manipulation out of the box solution?
Hi there, I am writing an internal full text search engine and do have trouble in outputting the text in an apropriate way. Problem is that if there is more than one word I cant handle the text cropping. For example: Search term: php germany Text from database: There is no such great language than php. Amongh those countries using this language is Germany with a good percentage of users. Text output should be: ...language than php. Amongh... language is Germay with a good... Similar to the way google does it. I tried it now with a couple of ways but failed for most (I tried with strpos and substr). Is there a solution out of the box with php, or maybe anybody knows a good script which does that. This does sound like a standard feature to me. Thank you for any help, Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Password encryption and password retrieval
Hi evryone, I want to implement a site where i would like to encrypt the password of the users and store it into mysql database. My question is that , In case if the user has forgotten the password how can he retrieve the password(which is already encrypted and stored...the user should be able to get the decrypted password). Also which encryption method would you recommend. ie. md5,crypt, etc Thanx, ..Deeps.. Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] strpos with array?
Burhan Khalid wrote: Merlin wrote: Hi there, I am wondering if there is a function (I could not find) which does the same thing like strpos does, but with an array. For example: $replace = array(picture, pics); $pos = strpos ($term, $replace); //if ($pos !== false) { if (in_array($term,$replace)) { $term = str_replace($replace, , $term); echo 'term without the word:'.$term; } http://www.php.net/in_array Actually this did not solve the problem, since this function is searching for the exact phrase, but not within a string. I solved it that way: // try pictures $replace = array(pictures, picture, bilder, bild, pic, pics, pix); foreach($replace AS $try){ $pos = strpos ($term, $try); if ($pos !== false) { $term = str_replace($try, , $term); #echo 'yes'.$term.$pos; exit; HEADER(Location:/index.php?search_for=.$term.); exit; } } Maybe it will be useful for somebody else. Merlin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] While and echoing HTML
I guess it is the missing semicolon. And you can write: echo trtd? echo $product_type ?/td/tr as simply echo trtd$product_type/td/tr I prefer echo 'trtd', $product_type, '/td/tr'; No string concatenation, or variable replacement required. Jared -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] how to know whether web server of a remote machine is running or not
Hi, I want to make a page (on a webserver) which will be redirected to another page on another webserver and hence i want to know whether the another webserver is running or not so that if the webserver is not running it do something else. is there any method to know whether the other webserver is running or not. your help will be appreciated. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] yet another php templating question
Hey, Since we are caught up in the templating season, I think its time for this one; We have just finished designing the software blueprint for a new PHP product, we usually used the include() method :-) to template U/I's for the clients but this one seems a bit bigger... I really like Smarty we and use it for our templating needs, but it just seems a bit too much to bundle Smarty with our software to the end user/client (esp since Smarty would be many times bigger than our scripts) I have searched google and the classes site to find templating solutions, fast template looks good but from the forums i have seen its not extremly dependableany suggestions? Links to would be appreciated, I have no plans of writing a new templating system just for this. Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.7 - Release Date: 5/9/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Accessible HTML - OT
Thanks to everybody for their comments, I now have more than enough ammo to justify our decisions. Regards, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password encryption and password retrieval
Hi You are doing the right thing storing passwords encrypted! You may use any of the one way digest like secure hash 1 (sha1) or md5 or a combination to generate a hash. In case your user forgets his password, there is no way to reconstruct it. You need to provide an interface where the user can enter their email and the script sends a message to the user with a token. Afterwards, this token is used as one time password to login and change the password. Regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/E$ d-(---)+ s:(+): a--(-)? C$(+++) UL$ P-(+)++ L+++$ E---(-)@ W++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e$@ h++(*) r--++ y--() -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to know whether web server of a remote machine is running or not
On 5/10/05, balwant singh [EMAIL PROTECTED] wrote: is there any method to know whether the other webserver is running or not. There are lots of methods: system( 'telnet hostname 80' ); fopen(); fsockopen(); Curl. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to know whether web server of a remote machine is running or not
Try connecting to it on port 80, the default for web servers. You can actually play around by connecting to a webserver (or mail server) through telnet. On the command line just type telnet website.com 80. If the server is up, you should be able to interact with the webserver. Type something and press return. If you didn't type a valid command, you'll get some html code back. You should be able to do something like this with all the commands in php, I have looked into which ones. On May 10, 2005, at 7:59 AM, balwant singh wrote: Hi, I want to make a page (on a webserver) which will be redirected to another page on another webserver and hence i want to know whether the another webserver is running or not so that if the webserver is not running it do something else. is there any method to know whether the other webserver is running or not. your help will be appreciated. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password encryption and password retrieval
I want to implement a site where i would like to encrypt the password of the users and store it into mysql database. My question is that , In case if the user has forgotten the password how can he retrieve the password(which is already encrypted and stored...the user should be able to get the decrypted password). Once encrypted that's it. The user can't get it back. Best thing is to ask them to verify additional information and then send a randomly generated passwort to the email address *you* have on file for that user. They can then change it when they login. Also which encryption method would you recommend. ie. md5,crypt, etc of those two, md5. search the net for discussions about md5 vs sha1... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Password encryption and password retrieval
On Tuesday 10 May 2005 16:05, Deep wrote: Hi evryone, I want to implement a site where i would like to encrypt the password of the users and store it into mysql database. My question is that , In case if the user has forgotten the password how can he retrieve the password(which is already encrypted and stored...the user should be able to get the decrypted password). The user won't be able to retrieve it's password if you want your application to be secure. The best practice is to flush the password and let the user reactivate it's account by providing him a temporary password. Also which encryption method would you recommend. ie. md5,crypt, etc Thanx, ..Deeps.. Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpkngZA6f5uq.pgp Description: PGP signature
Re: [PHP] how to know whether web server of a remote machine is running or not
On Tuesday 10 May 2005 14:59, balwant singh wrote: Hi, I want to make a page (on a webserver) which will be redirected to another page on another webserver and hence i want to know whether the another webserver is running or not so that if the webserver is not running it do something else. Check the remote server's waiting port - if it's opened the server is working, if it's not the server is not working. is there any method to know whether the other webserver is running or not. your help will be appreciated. with best wishes balwant -- Cyberly yours, Petar Nedyalkov Devoted Orbitel Fan :-) PGP ID: 7AE45436 PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436 pgpGrByPxcqlC.pgp Description: PGP signature
Re: [PHP] how to know whether web server of a remote machine is running or not
Hello balwant, Tuesday, May 10, 2005, 5:59:15 AM, you wrote: b is there any method to know whether the other webserver is running b or not. http://us2.php.net/fsockopen You'll be doing what's termed an HTTP Ping. You make a socket connection to the other server, perform a GET request on a page (preferably small), examine the returned headers for a Status 200 (which means OK). If you get that, the webserver responded and served up the page. You might just be able to do a HEAD request, but I haven't tried it. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC5 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
Sam, I'm not an expert in the area but from what I've seen in the past you might want to look into using LaTex or something similar from the command line. There might be a way to edit the PDF directly from PHP but I wouldn't know where to tell you to start. For that matter I'm not even certain LaTex would be the answer ;-) but since no one has responded to you yet I thought that might be a good place for you to start looking. Good luck! -Joe www.joewollard.com http://www.joewollard.com Sam Smith wrote: I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks
[PHP] Miami PHP Prorgammer Needed!
You or someone you know maybe interested in the programming position we have available. We have the need for a part time / possibly contract PHP programmer, with full time potential. We are looking for people that can work in our Miami office (even contractors), so please do not try and sell us your services if the location is a problem. Our development environment is Linux, apache, PHP, mysql. Knowledge of the Smarty template system and Pear:DB are also required. We are looking for a self managed person who is organized and detailed in following through a project from start to finish, and completing it within reasonable time limits. Experience developing relational DB's and not just simple lookups of a DB is required, classes, functions and oops are part of the expected knowledge. Please send your resume, links to your work with an explanation of how much of the project you were responsible for and contact information ( phone email ) to Joey at web56.net. Thanks Joey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] how to know whether web server of a remote machine is running or not
In addition to the valid suggestions thus far, another option which may suit your purpose is to display an image from webserver2 in the page on webserver1. You can put a JavaScript redirection in the image's onload event. -Original Message- From: Brent Baisley [mailto:[EMAIL PROTECTED] Sent: 10 May 2005 15:44 To: balwant singh Cc: php-general@lists.php.net Subject: Re: [PHP] how to know whether web server of a remote machine is running or not Try connecting to it on port 80, the default for web servers. You can actually play around by connecting to a webserver (or mail server) through telnet. On the command line just type telnet website.com 80. If the server is up, you should be able to interact with the webserver. Type something and press return. If you didn't type a valid command, you'll get some html code back. You should be able to do something like this with all the commands in php, I have looked into which ones. On May 10, 2005, at 7:59 AM, balwant singh wrote: Hi, I want to make a page (on a webserver) which will be redirected to another page on another webserver and hence i want to know whether the another webserver is running or not so that if the webserver is not running it do something else. is there any method to know whether the other webserver is running or not. your help will be appreciated. with best wishes balwant -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Brent Baisley Systems Architect Landover Associates, Inc. Search Advisory Services for Advanced Technology Environments p: 212.759.6400/800.759.0577 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun Microsystems, 3Com GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001 2000' REGISTERED COMPANY ** CONFIDENTIALITY NOTICE: This Email is confidential and may also be privileged. If you are not the intended recipient, please notify the sender IMMEDIATELY; you should not copy the email or use it for any purpose or disclose its contents to any other person. GENERAL STATEMENT: Any statements made, or intentions expressed in this communication may not necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content herein may be held binding upon Gamma Global (UK) Ltd or any associated company unless confirmed by the issuance of a formal contractual document or Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com EOE ** ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] yet another php templating question
Hi Ryan, Tuesday, May 10, 2005, 11:48:39 PM, you wrote: RA Hey, RA Since we are caught up in the templating season, I think its time for this RA one; RA We have just finished designing the software blueprint for a new PHP RA product, RA we usually used the include() method :-) to template U/I's for the RA clients but RA this one seems a bit bigger... RA I really like Smarty we and use it for our templating needs, but it just RA seems a bit RA too much to bundle Smarty with our software to the end user/client (esp RA since RA Smarty would be many times bigger than our scripts) RA I have searched google and the classes site to find templating solutions, RA fast template looks good but from the forums i have seen its not extremly RA dependableany suggestions? RA Links to would be appreciated, I have no plans of writing a new templating RA system RA just for this. RA Thanks, RA Ryan You are quite welcome to have a look at my template processor, there is the start of some documentation at http://kwiktemplates.com/ The actual code is very small and it runs pretty quick, so no need to cache anything for most sites. I have been using it now for a couple of years and it hasn't let me down :) -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] apache2/php file manager: security suggestions
Hi, I've written a web based file manager using PHP and running on an apache 2 server. Before putting it on a live webserver i'd like to get some security suggestions. Desired Goals: 1. Read, write text files from a web browser. 2. Files should be owned by me so as not to be readable\writable to other webserver users or their scripts. Will running in safe mode allow my file manager to read\write files as me and not as apache or the UID of apache? If i keep my data directory outside of apache's document root, will this prevent remote viewing of it? If i keep my PHP scripts out of document root, will they be hidden from remote viewers? My likely webtree directory strutcure is this: Document Root: /var/www/html/myWebsite PHP Scripts: /var/www/php/myWebsite My data the file manager will access: /var/www/data/myWebsite All three directories will be owned by my user id. Apache will be configured to run scripts from the scripts dir. The data dir will be opened with open_baseDir. I will set up .htaccess on the data directory. Combine this with safe mode, and will i have the desired effect? Thanks, -brett -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] number format?
I have a number like -56.98 I need to convert it to -5698. I tried --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.859 / Virus Database: 585 - Release Date: 2/14/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: yet another php templating question
* Ryan A [EMAIL PROTECTED]: Since we are caught up in the templating season, I think its time for this one; We have just finished designing the software blueprint for a new PHP product, we usually used the include() method :-) to template U/I's for the clients but this one seems a bit bigger... I really like Smarty we and use it for our templating needs, but it just seems a bit too much to bundle Smarty with our software to the end user/client (esp since Smarty would be many times bigger than our scripts) I have searched google and the classes site to find templating solutions, fast template looks good but from the forums i have seen its not extremly dependableany suggestions? Links to would be appreciated, I have no plans of writing a new templating system just for this. I'm not sure how big Savant is, but it's one that's often favorably reviewed. I believe the website is http://www.phpsavant.org/ PEAR has a couple of template solutions, but I'm not hear too much about them, good or bad. Another one I've seen favorable review on is patTemplate, from the PHP Tools site: http://www.php-tools.net/ -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A couple questions about templating
* Rory Browne [EMAIL PROTECTED]: This has all been done before, and in a number of ways. If you really *must* build your own templating class, go and thoroughly review the code of those that already exist: Smarty, Savant, paTemplate, FastTemplate, etc. Figure out how each solved the problems. Then determine if you can improve upon their solutions. This has all been done before, and I'm assuming that the James knows, and has seen that before, since he used the same common method names, as is in many php templating systems. $class-assign has been used in any templating system I've ever seen(although to be honest I haven't seen that many). I don't think the fact that it has been done before should inhibit him from doing it again. Carrying out the process, is one of the most educational ways, and perhaps one of the most enlightening ways to see how a process works. I agree -- that's why the statement then determine if you can improve upon their solutions. This wasn't a, you won't be able to, but more of a, look for places where you feel it could be done better type of statement. Templating is tricky. It adds overhead on the processing end, but increases developer/designer efficiency. Finding a happy medium is the challenge. -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
This isn't *quite* editing, but I have had success using FPDF (http://www.fpdf.org/) for PDF generation. There is an extension class called FPDI (http://fpdi.setasign.de/) that allows you to import an existing PDF as a template, and you could add text over it. Hope this helps. Keith From: Sam Smith [EMAIL PROTECTED] Date: 2005/05/10 Tue AM 08:36:13 EDT To: PHP php-general@lists.php.net Subject: [PHP] Editing PDF I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks -- 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
[PHP] Re: Password encryption and password retrieval
Usually passwords are encrypted using one-way algorithms. Of course, there are two-way algorithms which can be reversed, but time and experience has shown that not to be necessary for user passwords. A one-way algorithm is much like the modulus operation: 15 % 4 gives you 3 but even if you know the result and the divider, there is no way you can guess that 15 was the original number. One-way encryption algorithms do something like this, they loose some information in the process so the original cannot be recovered (no decryption) even though the encryption process is perfectly predictable and reproducible. Though the impossibility of recovery can be seen as a drawback it also means that the system administrator nor the programmer can figure out the passwords, thus, my password is safe, even from the administrator or his/her newbie junior assistant who dreams with becoming a famous hacker. Thus, if a user gets his/her password lost, you e-mail a new and urge him/her to change it ASAP. Satyam Deep [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi evryone, I want to implement a site where i would like to encrypt the password of the users and store it into mysql database. My question is that , In case if the user has forgotten the password how can he retrieve the password(which is already encrypted and stored...the user should be able to get the decrypted password). Also which encryption method would you recommend. ie. md5,crypt, etc Thanx, ..Deeps.. Yahoo! India Matrimony: Find your life partner online Go to: http://yahoo.shaadi.com/india-matrimony -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with regex: breaking strings down to 'words' and 'phrases'
Hi All, I'd very much appreciate some help building a regular expression for preg_match_all that can differentiate between 'words' and 'phrases'. For example, say I have a string that contains: 'this is an example of a phrase' I'd like to be able to break that down to: this is an example of a phrase My current preg_match_all regex: preg_match_all('([\w\-]+|[\(]|[\)])',this is an \example of a phrase\',$arr); returns the following: Array ( [0] = Array ( [0] = this [1] = is [2] = an [3] = example [4] = of [5] = a [6] = phrase ) ) Note: I'm using this to break elements of a string down to build an sql string, which is why I'm looking for ( and ) characters (ie the [\(]|[\)] part of the regex) and maintaining them in the array. A real-world example of the the value being supplied to the regex might be completed and January 2005 and not (store or online) etc. I already have the logic to handle and, or, not and () but haven't been able to figure out how to maintain substrings in quotes as a single value in the array. Any help appreciated! Much warmth, Murray
Re: [PHP] number format?
Hello Dustin, Tuesday, May 10, 2005, 9:34:10 AM, you wrote: D I have a number like -56.98 D I need to convert it to -5698. I tried ?php $num = -56.98; $newNum = str_replace(.,,$num); echo newNum = . $newNum; $add50 = $newNum + 50; echo brAdd50 = . $add50; $sub50 = $newNum -50; echo brSub50 = . $sub50; ? If you still need to do math on it, just remember you don't have a decimal anymore. See example above. Make sure you do any math you need to do before the str_replace. If you're just displaying it, then no problem. -- Leif (TB lists moderator and fellow end user). Using The Bat! 3.5 Return RC5 under Windows XP 5.1 Build 2600 Service Pack 2 on a Pentium 4 2GHz with 512MB -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: number format?
Dustin Wish wrote: I have a number like -56.98 I need to convert it to -5698. I tried ?php $num = -56.98; $conv = $num * 100; /** -5698 */ ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] number format?
Dustin Wish wrote: I have a number like -56.98 I need to convert it to -5698. I tried You tried what? Multiplying it by 100? -- John C. Nichel berGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] include remote class
im doing include('http://www.mysite.com/class.php'); and then i create new instance but i get error - cannot instantiate non-existant class how can i get this remotely hosted class file to be defined? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with regex: breaking strings down to 'words' and 'phrases'
On Wed, 11 May 2005, Murray @ PlanetThoughtful wrote: Hi All, I'd very much appreciate some help building a regular expression for preg_match_all that can differentiate between 'words' and 'phrases'. For example, say I have a string that contains: 'this is an example of a phrase' I'd like to be able to break that down to: this is an example of a phrase I haven't thought this through fully, but what if you exploded the string on into an array. Then loop through the array and for every even element, explode on a space, otherwise just store the whole string into the new array. -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with regex: breaking strings down to 'words' and 'phrases'
On Wed, 11 May 2005, Murray @ PlanetThoughtful wrote: Hi All, I'd very much appreciate some help building a regular expression for preg_match_all that can differentiate between 'words' and 'phrases'. For example, say I have a string that contains: 'this is an example of a phrase' I'd like to be able to break that down to: this is an example of a phrase I haven't thought this through fully, but what if you exploded the string on into an array. Then loop through the array and for every even element, explode on a space, otherwise just store the whole string into the new array. I think I *may* have solved this at my end. The following statement seems to work: preg_match_all('/([\w\-]+?|[(]|[)]|\.+\)/U',strtoupper($prep_sql),$sqlarr) ; I need to test it out with a whole series of different possible combinations to see if it behaves the way I want it to, but so far the results are good. If anyone can see any flaws, I'd love to know about them! Many thanks, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to know whether web server of a remote machine is running or not
On Tue, 2005-05-10 at 08:33, Greg Donald wrote: On 5/10/05, balwant singh [EMAIL PROTECTED] wrote: is there any method to know whether the other webserver is running or not. There are lots of methods: system( 'telnet hostname 80' ); fopen(); fsockopen(); Curl. Hi, You may also want to know if php is running OK too. Crackers will typically knock out php, and then the usual web server tests work, and your php website(s) will not. I suppose a curl script would figure that out. TTYL, Blair. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Exec don't work
Hi! I using php version 4.3.10. I have a script that used the exec function. Well it script only work from shell, but not work form web browser. My php.ini: safe_mode Off Off safe_mode_exec_dir no valueno value Have somebody experience in this problem? Regards, JP -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
Sam Smith wrote: I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks it's a compressed pdf. make uncompressed pdf and you should see the raw text -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] how to know whether web server of a remote machine is running or not
On 5/10/05, Blair Lowe [EMAIL PROTECTED] wrote: Crackers will typically knock out php Did you have some statistics or is this just your own experience/assumption? I may as well switch to mod_ruby if they attack mod_php more often than not. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A couple questions about templating
What is the purpose of your templating system? And what does it solve? These questions are the ones I'd ask myself if I was creating one. However, there are a lot of them out there so does your templating system solve a problem and is a solution? or just yet another templating class? As its well known templates are made for several reasons such as separating server-side and client-code, separating designers and developers work in team environment, theme able and multy layout and language systems... and a lot more that could me mentioned. I've personally used the HTML_Template_IT package from pear along with Smarty. And now I'm back to normal HTML including for small projects that have a short life cycle, for longer life cycle projects I'd use the IT package. Will never use smarty again; it just makes another layer in the programming not in the system in other words, it becomes another language to add to your programming instead of being a component/tier though it provides much more flexibility than the any other package available. There are a number of articles on Templating I've selected a very criticizing article to share that lives at www.phppatterns.comhttp://www.phppatterns.com. I so much agree with him. At the same time I see a big need for templating. Here is the link to the article. http://phppatterns.com/index.php/article/articleview/4/1/1/ Hope that helps. Regards, M.Saleh.EG http://M.Saleh.EG +971-50-4779817
Re: [PHP] yet another php templating question
Hey, You are quite welcome to have a look at my template processor, there is the start of some documentation at http://kwiktemplates.com/ Thanks Tom, will have a look at it, very gererious of you. Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A couple questions about templating
clip Templating is tricky. It adds overhead on the processing end, but increases developer/designer efficiency. Finding a happy medium is the challenge. /clip Yep, the last medium I found could communicate with the spirits fine...but she was real unhappy with life in general :-p Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] numbers as strings
Normally it truncates the leading zeros if there are any. I will try your method when I get a moment. got switched on project. Rory Browne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] For the most part you can simply treat them as strings. What is happening that shouldn't be happening, or what should be happening, but isn't? let us say $a = 1; $b = 2; $c = 0; $str_a = (string)$a; $str_b = $b I would like to be able to $str = $c.$a.$b; Does that not work? What happens when you do that? Personally I'd use $str = $c$a$b; to result with $str = 012; I tried: [EMAIL PROTECTED] ~]$ cat test.php ?php $a = 1; $b = 2; $c = 0; $str = $c . $a . $b; echo $str; ? [EMAIL PROTECTED] ~]$ php -q test.php 012 is there something that I have missed or I guess the question should be what did I miss -- 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
[PHP] dio_read timeout?
I'm using dio_read to read data from a serial port via a php cli script, this works great. However I'm unable to get dio_read to timeout if there's no data to read. No matter how I formulate the while loop, set_time_out, etc I can't seem to get it to stop reading and move on. Anyone have a work around or ideas? Example snippet, where $fd is a valid file descriptor. function readData($fd) { $startTime=microtime(); $endTime=$startTime+'.02'; $data=null; $i=0; #while($startTime $endTime){ while($i 5) { $data.=dio_read($fd); if($data) { echo Here's some data: $data\n; break; } $i++; } } //end function -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exec don't work
On 5/10/05, Juan Pablo Herrera [EMAIL PROTECTED] wrote: Hi! I using php version 4.3.10. I have a script that used the exec function. Well it script only work from shell, but not work form web browser. My php.ini: safe_mode Off Off safe_mode_exec_dir no valueno value Have somebody experience in this problem? Is it possible your mod_php is using a different php.ini than your cli php? I use system() instead of exec(), I find it's rare than I don't want to capture the resulting output of my commands. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
Also keep in mind that any graphics in the PDF, even an uncompressed one, will show up encoded... Base64 or UTF or whatever PDFs use. I also remember reading once that there's data at the end of the PDF that gives a pointer to where in the PDF certain data is. That if you add/remove stuff from the PDF itself that you need to update those pointers. I believe that only pertained to encoded and embedded graphics data, not text and whatnot. We use PDFLib at work. Basically you start with a blank form (all pre-constructed and layed out) and just overlay text and graphics with it. You're not really altering what's there as much as generating a new PDF with some additional stuff slapped over what was there in a layer or something. Sorry to be so vague.. but wanted to pass on that info in case it helped avoid a pitfall somewhere. Good luck! -TG = = = Original message = = = Sam Smith wrote: I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks it's a compressed pdf. make uncompressed pdf and you should see the raw text ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include remote class
On 5/10/05, Andy Sandvik [EMAIL PROTECTED] wrote: im doing include('http://www.mysite.com/class.php'); and then i create new instance but i get error - cannot instantiate non-existant class how can i get this remotely hosted class file to be defined? If it's a PHP file sitting on a web server I doubt you will get at the actual source using that method. Usually when you want to show the source of a PHP file you configure the web server to show .phps files as PHP source. For Apache a line like this works: AddType application/x-httpd-php-source .phps Also.. I'd just download the class file and read it from the local file system. There's a lot of overhead in including a PHP file remotely everytime your script runs. Even if you just cache the file every so often it'd still be way better than a direct call every time. I could be wrong but I doubt the class file is changing so much so often that you need a realtime include() like that. -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Templating systems for single developers?
Hi All, Given that templating seems to be a hot topic at the moment, I'm wondering if anyone here uses templating in a single developer environment, and why if so? I've looked at various template systems from time-to-time but I've always come away thinking, 'yep, I can see the point in a team environment, particularly one that mixes designers and coders, but what would be the benefit to a lone developer like me?' So, if anyone out there uses a templating system (ie Smarty, PHPSavant etc) and they don't work in a team environment, I'd love to hear what benefits you derive from so doing. Much warmth, Murray -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing PDF
Sam Smith wrote: I have an existing PDF file that I want to add text to or make changes to text with data from an HTML form via PHP. The PDF looks like this: 20 0 obj/Length 5586/Filter[/ASCII85Decode/FlateDecode]stream 8;X-DgMYb:(An746bc%oU,Mo*Snfn`(:.P:CnHNZLL%2;CCTp,[EMAIL PROTECTED]'+2VqIkV -$2%Ipq]A aoW]SN?epNo... That is, not in plain text. If I wanted to add text to the PDF, e.g., Mr. Jones, where the heck would it go and what would it look like? Thanks it's a compressed pdf. make uncompressed pdf and you should see the raw text Got it. In the distiller settings file: /CompressPages false thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] numbers as strings
Just as a note I had a bit to test and your version works $str = $c$a$b; does return 012 all I was getting was 12 after looking at the manual I see that PHP was evaluating each piece as a number so it expected that the built variable would be a number. Rory Browne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] For the most part you can simply treat them as strings. What is happening that shouldn't be happening, or what should be happening, but isn't? let us say $a = 1; $b = 2; $c = 0; $str_a = (string)$a; $str_b = $b I would like to be able to $str = $c.$a.$b; Does that not work? What happens when you do that? Personally I'd use $str = $c$a$b; to result with $str = 012; I tried: [EMAIL PROTECTED] ~]$ cat test.php ?php $a = 1; $b = 2; $c = 0; $str = $c . $a . $b; echo $str; ? [EMAIL PROTECTED] ~]$ php -q test.php 012 is there something that I have missed or I guess the question should be what did I miss -- 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
[PHP] Header Location redirection parameters fail to redirect
I want url mysite.no to redirect to mysite.com with parameters lang=no and ctry=no, but the parameters do not follow the redirection. mysite.no/index.php is ? Header ('Location: http://mysite.com/index.php?lang=noctry=no' ) ; exit; ? mysite.com/index.php is ? echo h3mysite.com Homepage /h3 ; $lang = $_REQUEST['lang']; $ctry = $_REQUEST['ctry']; echo Country= $ctry br Language= $lang; ? When I browse mysite.no mysite.com homepage is shown with lang and ctry as blank When I browse mysite.com/index.php?lang=noctry=no parameters lang and ctry are set to no as I wish I have the server on my own laptop where I also do the browsing. I use PHP 4.2.2 I kindly got some answers yesterday that do not seem to solv the question so I have made myself more specific. Do anyone have a clue why the parameters are stripped from the redirection? (I am not very trained, but as far as I know the parameters should be redirected??!!) Thanks Olav -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A couple questions about templating
On 5/10/2005 11:15:47 PM, [EMAIL PROTECTED] wrote: snip Yep, the last medium I found could communicate with the spirits fine... but she was real unhappy with life in general /snip LOL! ... now that's not PHP talk =P Strange, from the time I joined this list I keep hearing about PHP... PHP this and PHP that... I wonder when people are going to start talking about PSP and effects of it on users like me who have been using it for years... Cheers, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.308 / Virus Database: 266.11.8 - Release Date: 5/10/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: A couple questions about templating
Okay well I see I have reopened the can of worms lol. This has all been done before, and I'm assuming that the James knows, and has seen that before, since he used the same common method names, as is in many php templating systems. $class-assign has been used in any templating system I've ever seen(although to be honest I haven't seen that many). I don't think the fact that it has been done before should inhibit him from doing it again. Carrying out the process, is one of the most educational ways, and perhaps one of the most enlightening ways to see how a process works. Rory you are my hero! you took the words right out of my mouth, and yes, I am looking to create a small basic one that isn't bloated with useless features. Basically variable replacement mostly. Anyways, I restructered my code, and as far as I can see there is nothing wrong with the code, except for that it simply doesn't work :) I'm probably missing something blatently obvious but I'll post it and maybe someone can spot why this isn't working. Here be the code: ?php class mm { // // PRIVATE CLASS VARIABLES // var $_file; var $_template; var $_var; var $_value; // // CLASS CONSTRUCTOR // function mm() { $this-_var = array(); $this-_value = array(); } // // ASSIGN A VARIABLE // function assign($var,$value) { if (isset($var) isset($value)) { $this-_var[] = $var; $this-_value[] = $value; } } // // RUN THE WEBPAGE // function run($template) { if (isset($template)) { $this-_template = 'tpl/' . $template . '.tpl'; if (file_exists($this-_template)) { $file = fopen($this-_template,'r'); $this-_file = fread($file,filesize($this-_template)); fclose($file); $this-_file = str_replace('{' . $this-_var . '}',$this-_value,$this-_file); print($this-_file); } else { print('pTemplate File Does Not Exists/p'); } } else { print('pTemplate is not sent/p'); exit; } } } ? The page that run's the script simply looks like this: ?php // // LOAD THE TEMPLATING CLASS // require_once('tpl.php'); $mm = new mm(); // // SET CONTENT // $sitename = 'Calgary Outdoor Paintball League raquo; Under Heavy Developement'; $header = 'Welcome to the Calgary Outdoor Paintball League\'s Official Website'; // // RUN THE PAGE // $mm-assign('sitename',$sitename); $mm-assign('header',$header); $mm-run('index'); ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] fgets fails after fopen succeeds
Summary: fopen returns a file handle, yet fgets doesn't want to read it. I've scoured google, php.net http://php.net, phpfreaks, usenet, etc. It seems to work elsewhere. My setup: Apache 2.0.47 PHP/5.0.4 Windows 2000 The call: make_link_list(index); (the file exists for fopen(), and actually errors if I add characters to break it) My Source Code: ?php function make_link_list($name=) { print $_SERVER['DOCUMENT_ROOT'].'/outside/'.$name.'.txt'; ? ul ? $fh=fopen($_SERVER['DOCUMENT_ROOT'].'/outside/'.$name.'.txt', 'r+') || die(Cannot open file); for ($line = fgets($fh, 1000); 0 ! feof($fh); $line = fgets($fh)) { $line = trim($line); if(strlen($line) 0) { print 'li' . $line ./li\n; } } ? /ul ? fclose($fh); } ? Output: C:/Program Files/Apache Group/Apache2/htdocs/youmightbe/outside/index.txt *Warning*: fgets(): supplied argument is not a valid stream resource in *C:\Program Files\Apache Group\Apache2\htdocs\youmightbe\outside.php* on line *11* *Warning*: fclose(): supplied argument is not a valid stream resource in *C:\Program Files\Apache Group\Apache2\htdocs\youmightbe\outside.php* on line *20*
Re: [PHP] Templating systems for single developers?
I use Smarty and am the lone developer. Why - Easiest to give an example that I did. I have my site with 7 pages. Each page has a minimum of 4 templates for it (though 6 is the average). Time goes on and I decided I wanted to completely change the look of my site (currently can't handle the increasing amount of data and pages easily) and make it xhtml compliant. Rewrite the CSS and modify the templates to allow for the new changes. Site revamped and xhtml compliant in less then a week. Couldn't do that as quickly if I wasn't on a templating system. Maybe next time I overhaul the site I will work toward making it more accessible. Murray @ PlanetThoughtful wrote: Hi All, Given that templating seems to be a hot topic at the moment, I'm wondering if anyone here uses templating in a single developer environment, and why if so? I've looked at various template systems from time-to-time but I've always come away thinking, 'yep, I can see the point in a team environment, particularly one that mixes designers and coders, but what would be the benefit to a lone developer like me?' So, if anyone out there uses a templating system (ie Smarty, PHPSavant etc) and they don't work in a team environment, I'd love to hear what benefits you derive from so doing. Much warmth, Murray -- Respectfully, Ligaya Turmelle Life is a game so have fun -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about acessing databases and formatting output
On Mon, May 09, 2005 at 10:41:22PM +0530, bala chandar wrote: On 5/9/05, The Doctor [EMAIL PROTECTED] wrote: On Mon, May 09, 2005 at 08:19:47PM +0530, bala chandar wrote: Hi, On 5/9/05, The Doctor [EMAIL PROTECTED] wrote: On Mon, May 09, 2005 at 08:29:34AM +0530, bala chandar wrote: On 5/9/05, bala chandar [EMAIL PROTECTED] wrote: Hi On 5/9/05, The Doctor [EMAIL PROTECTED] wrote: On Sun, May 08, 2005 at 01:49:08PM -0600, The Doctor wrote: On Sun, May 08, 2005 at 08:56:25PM +0530, bala chandar wrote: On 5/8/05, The Doctor [EMAIL PROTECTED] wrote: On Thu, May 05, 2005 at 05:49:38AM -0600, The Doctor wrote: On Thu, May 05, 2005 at 10:11:14AM +0530, bala chandar wrote: hi, On 5/5/05, The Doctor [EMAIL PROTECTED] wrote: This is probably easy, but how does one access a database, mysql or oracle or postgresql, and present the data in a tabular format? -- check out http://in2.php.net/mysql Looks good to me. So far so good except my blobs are appearing as is instead of as an interpret item. What next? -- what are you storing in BLOB? First a .tgf and then a jpg. hey, check out this. this might help you http://www.zend.com/zend/trick/tricks-sept-2001.php http://forum.100megswebhosting.com/archive/index.php/t-2971.html Is their a way to embed the third column? And what changes do I need to make to the php code? Seems to be correct. Here is what I think: All the non-blobs are working fine; it is the blobs that are turning up as text instead of data. Can you not tell the PHP scripts the following: if a blob then present the data as binary else present the text endif ? I think you cannot judge the content of the blob. for text use the data type text instead of blob Can you please clarify? kindly check this link http://forums.devshed.com/archive/t-63144/UserContributed-PHP-Mysql-and-Images I shall read closely. Today I did generate a script, but I am lacking the fact that I cannot tell the script not to treat the blob differetly: ? session_start(); ? html head titledb -- query_1/title meta name=generator content=PHP Generator Wizard /head style type=text/css body { background-color: #FF; color: #004080; font-family: Arial; font-size: 12px; } .bd { background-color: #FF; color: #004080; font-family: Arial; font-size: 12px; } .tbl { background-color: #FF; } a:link { color: #FF; font-family: Arial; font-size: 12px; } a:active { color: #FF; font-family: Arial; font-size: 12px; } a:visited { color: #800080; font-family: Arial; font-size: 12px; } .hr { background-color: #336699; color: #FF; font-family: Arial; font-size: 12px; } a.hr:link { color: #FF; font-family: Arial; font-size: 12px; } a.hr:active { color: #FF; font-family: Arial; font-size: 12px; } a.hr:visited { color: #FF; font-family: Arial; font-size: 12px; } .dr { background-color: #FF; color: #00; font-family: Arial; font-size: 12px; } .sr { background-color: #CF; color: #00; font-family: Arial; font-size: 12px; } /style table width=100% tr td width=5% /td td bgcolor=#e0e0e0 /td td width=5% /td td width=80% valign=top ? $conn = connect(); $showrecs = 100; $pagerange = 10; $a = @$HTTP_GET_VARS[a]; $recid = @$HTTP_GET_VARS[recid]; $page = @$HTTP_GET_VARS[page]; if (!isset($page)) $page = 1; switch ($a) { case view: viewrec($recid); break; default: select(); break; } mysql_close($conn); ? /td/tr/table /html ? function select() { global $showrecs; global $page; $res = sql_select(); $count = mysql_num_rows($res); if ($count % $showrecs != 0) { $pagecount = intval($count / $showrecs) + 1; } else { $pagecount = intval($count / $showrecs); } $startrec = $showrecs * ($page - 1); @mysql_data_seek($res, $startrec); $reccount = min($showrecs * $page, $count); $fields = array (catno, name1, structure); ? table class=bd border=0 cellspacing=1 cellpadding=4 trtdTable: query_1/td/tr trtdRecords shown: ? echo $startrec + 1 ? - ? echo $reccount ? of ? echo $count ?/td/tr /table hr size=1 noshade ? showpagenav($page, $pagecount); ? br table class=tbl border=0 cellspacing=1 cellpadding=5width=100% tr ? reset($fields); foreach($fields as $val){ ? td class=hr? echo $val ?/td
[PHP] Session cookies in firefox
I'm using php sessions with cookies. I realized that Firefox shared cookies between different instances (unlike IE that when someone open a new bank window a new session is created). Has anyone found a solution to this problem? Maybe detecting the new instance and generating a new session id. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Session cookies in firefox
I'm using php sessions with cookies. I realized that Firefox shared cookies between different instances (unlike IE that when someone open a new bank window a new session is created). Has anyone found a solution to this problem? Maybe detecting the new instance and generating a new session id. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exec don't work
On Tue, May 10, 2005 1:42 pm, Greg Donald said: I use system() instead of exec(), I find it's rare than I don't want to capture the resulting output of my commands. I use exec() instead of system() I find it's rare that I don't want to capture the resulting output (arg 2) and do something intelligent if the OS returns an error (arg 3) :-) -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] fgets fails after fopen succeeds
Printing $fh printed a 1. My original file mode was just r, I changed to r+ to see if I'd get permissions problems. The file handle seems to be fine. fgets just doesn't like it. The 0 !feof() was a commenting out of the for loop to prevent the fgets from running so that I so print the $fh. This is an adaptation of the following code, which works fine on another Windows 2000/Apache setup. Irony is, the original code doesn't work when ported. I think I'm missing something in setup or permissions. ? $page=$_GET['page']; print 'new_pages/'.$page.'.txt'; $fh = fopen('./new_pages/'.$page.'.txt', 'rt'); ? ul ? for ($line = fgets($fh); ! feof($fh); $line = fgets($fh)) { $line = trim($line); if(strlen($line) 0) { print 'li' . $line ./li\n; } } ? /ul ? fclose($fh); ?
Re: [PHP] fgets fails after fopen succeeds
On Tue, May 10, 2005 1:34 pm, Thomas Powell said: Summary: fopen returns a file handle, yet fgets doesn't want to read it. I've scoured google, php.net http://php.net, phpfreaks, usenet, etc. It seems to work elsewhere. My setup: Apache 2.0.47 PHP/5.0.4 Windows 2000 The call: make_link_list(index); (the file exists for fopen(), and actually errors if I add characters to break it) My Source Code: ?php function make_link_list($name=) { print $_SERVER['DOCUMENT_ROOT'].'/outside/'.$name.'.txt'; ? ul ? $fh=fopen($_SERVER['DOCUMENT_ROOT'].'/outside/'.$name.'.txt', 'r+') || die(Cannot open file); I don't think you want || here -- The operator precedence of = and || and OR are what's biting you in the butt, almost for sure. echo fh is $fhhr /\n; If that doesn't print out Resource #1 (or some other number) then you've got it wrong, and you might as well ignore the rest of this script until it's right. Also, it's probably REALLY BAD SECURITY that the PHP user can write (r+) a file inside your DOCUMENT_ROOT!!! Move the file somewhere else, outside the web tree, and give yourself a config file to set the path for easy changing/installing. for ($line = fgets($fh, 1000); 0 ! feof($fh); $line = fgets($fh)) { Dunno what the 0 is about, but it don't belong there when you're done, of course... $line = trim($line); if(strlen($line) 0) { print 'li' . $line ./li\n; } } ? /ul ? fclose($fh); } ? Output: C:/Program Files/Apache Group/Apache2/htdocs/youmightbe/outside/index.txt *Warning*: fgets(): supplied argument is not a valid stream resource in *C:\Program Files\Apache Group\Apache2\htdocs\youmightbe\outside.php* on line *11* *Warning*: fclose(): supplied argument is not a valid stream resource in *C:\Program Files\Apache Group\Apache2\htdocs\youmightbe\outside.php* on line *20* -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] number format?
Hi, Wednesday, May 11, 2005, 1:34:10 AM, you wrote: DW I have a number like -56.98 DW I need to convert it to -5698. I tried DW --- DW Outgoing mail is certified Virus Free. DW Checked by AVG anti-virus system (http://www.grisoft.com). DW Version: 6.0.859 / Virus Database: 585 - Release Date: 2/14/2005 Here is a little function I use to take care of all combination of inputs: function dollars2cents($value){ $value = sprintf(%0.2f,trim($value)); list($a,$b) = explode('.',$value); if(floatval($value)0) $b = $b*-1; return intval($a)*100 + intval($b); } -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] include remote class
On Tue, May 10, 2005 10:10 am, Andy Sandvik said: im doing include('http://www.mysite.com/class.php'); and then i create new instance but i get error - cannot instantiate non-existant class how can i get this remotely hosted class file to be defined? If you surf to that URL, do you see PHP source, or do you see HTML/nothing? You may want to use .phps to get source, or .inc if mysite.com is configured to serve those up as PHP. You also have to make sure class.php is actually valid code... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] String manipulation out of the box solution?
On Tue, May 10, 2005 5:58 am, Merlin said: I am writing an internal full text search engine and do have trouble in outputting the text in an apropriate way. Problem is that if there is more than one word I cant handle the text cropping. For example: Search term: php germany Text from database: There is no such great language than php. Amongh those countries using this language is Germany with a good percentage of users. Text output should be: ...language than php. Amongh... language is Germay with a good... Similar to the way google does it. I tried it now with a couple of ways but failed for most (I tried with strpos and substr). Is there a solution out of the box with php, or maybe anybody knows a good script which does that. This does sound like a standard feature to me. Here's a quickie, untested, and probably with some kind of logic errors, or at least things not quite what you want. $fulltext = There is no such great language than php. Amongh those countries using this language is Germany with a good percentage of users.; $words = explode( , php germany); $snippets = ''; while (list(, $word) = each($words)){ if (!stristr($snippets, $word)){ //skip this if we already got the word. $start = strpos($fulltext, $word); if ($start !== false){ $end = $start + strlen($word); $jumpback = strpos(' ', $fulltext, $start - 20); $jumpforward = strpos(' ', $fulltext, $end + 20); $snippet = substr($fulltext, $jumpback, $jumpforward); $snippets .= $snippet ; } } } reset($words); while (, $word) = each($words)){ $snippets = str_replacei($word, b$word/b, $snippets); } echo $snippets; To Do: Might wanna store an array of start/end numbers for snippets, then sort by start, then combine those that overlap one end to the next start, *THEN* combine those snippets, so you don't have snippets out or order, nor overlapping. Still, I got ya started... -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Templating systems for single developers?
On Tue, 2005-05-10 at 17:17, Murray @ PlanetThoughtful wrote: Hi All, So, if anyone out there uses a templating system (ie Smarty, PHPSavant etc) and they don't work in a team environment, I'd love to hear what benefits you derive from so doing. I do for as many projects as possible. Nothing like sharing custom tags across projects. Also something you can't do in PHP is include source code with a function definition that has already been defined which as many PHP developers will attest to, causes problems when importing 3rd party code. With custom tags I can override an existing tag of the same space/name with different functionality by assigning the compiler with the tag to override a higher precedence in the configuration. Additionally I can create custom tags that output other custom tags or standard tags since evaluation is recursive (at compile time NOT run-time). Also some of the sites I manage are in the hundreds of pages and having the template engine index the site's searchable content via a custom tag is quite convenient. search:public Blah blah blah blah. /search:public Custom tags aren't just for content replacement as you can see, they can provide meta functionality at arms length. Also I like the convenience and clarity of using static accumulators to accumulate content that will be flushed into a pre-defined position. For instance a template like the following: html head jinn:accumulatorFlush name=javascript/ jinn:accumulatorFlush name=javascript dynamic=true/ /head body Blh. /body /html And then a source file which will be expanded into the above main layout template: jinn:accumulate name=javascript script type=text/javascript language=javascript !-- // /* Some funky javascript or whatever have you. */ // -- /script /jinn:accumulate p Blah blah blah blah. Blah blah. Something funky with javascript. /p As you saw in the main template declaration there were two flushes, one is static and occurs at compile time saving any run-time overhead, the other is dynamic and occurs at run-time (which is useful if your code needs to output javascript). Anyways, there's way more to all this than I can usually think of when people ask. Experience, mine in particular, leads me to prefer the template approach over the PHP approach. And then again my own template approach over the smarty approach :) Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Exec don't work
On 5/10/05, Richard Lynch [EMAIL PROTECTED] wrote: I use exec() instead of system() I find it's rare that I don't want to capture the resulting output (arg 2) and do something intelligent if the OS returns an error (arg 3) For some reason I always thought exec() only took a single argument. That 3rd argument will come in handy now that I know about it. Learn something new everyday. :) -- Greg Donald Zend Certified Engineer http://destiney.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] base64_encode in URLs
Hey just curious if it's okay to encode variables that are passed in URLs with base64_encode??? since, I am going to pass a email address in the URL, I would like to protect the email address from typical people -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] protect your CSS files, and possibly other extenstions as well...
I recently discovered a php method to hide text-based files from remote users while allowing access to your internal pages and scripts. You can take advantage of this technique as well to protect your artistic rights: There are two variants: one for php scriptss and their included counterparts and another for 'stand-alone' files that are refered to within your own html -- such as *.css and *.js that can be link'd or src'd via html tags -- PHP SCRIPTs: master pages: (index.php, gallery.php, ...) ?php // this is placed before any other includes define('SOME_CONSTANT','secret_string'); ? included pages: (header.php, menu.php, ...) ?php // this is placed before any other includes require_once('include_path/check_constant.inc'); ? 'include_path/check_constant.inc': ?php /* * PHP Internal Inclusion Verification v1.0 * Author: Tim Maynard, aka: Kit DeKat (kitdekat) (c)09-MAY-2005 * E-mail: [EMAIL PROTECTED] */ $const = get_defined_constants(); if( !isset($const[SOME_CONSTANT]) || ($const[SOME_CONSTANT] != 'secret_string') ) { header('Status: 404 Not Found'); header('HTTP/1.1 404 Not Found'); // the following is my path to the standard Apache2 error documents which // i feel that the standard docs are the best to hide that fact that the // file was ever there, versus a custom error implying you're covering it readfile('http://'.$_SERVER[SERVER_NAME].'/error/HTTP_NOT_FOUND.html.var'); exit(); } ? -- This should hide all the includes, configs, etc.. files that you have lying around. I should hope that you already have the following somewhere in your http.conf file to protect from direct-remote downloads -- this snippet will protect against files ending in '.inc' and '.inc.php', modify to suit your site: Files ~ \.inc(\.php)?$ Order allow,deny Deny from all Satisfy All /Files -- CSS and JS files: First, you will need to tell php to parse these files, which can be done again by editing your httpd.conf files to add the extensions desired to the php list: AddType application/x-httpd-php .php .phtml .php3 .css .js You will take a performance hit for adding the parser to more pages, but I think its worth the gain in security and your general sanity and well-being. now that php is parsing these files, add the following to the top of each: ?php /* * PHP Internal Inclusion Verification v1.0 * Author: Tim Maynard, aka: Kit DeKat (kitdekat) (c)09-MAY-2005 * E-mail: [EMAIL PROTECTED] */ if( !isset( $_SERVER[HTTP_REFERER]) || !strpos($_SERVER[HTTP_REFERER],$_SERVER[SERVER_NAME]) ) { header('Status: 404 Not Found'); header('HTTP/1.1 404 Not Found'); readfile('http://'.$_SERVER[SERVER_NAME].'/error/HTTP_NOT_FOUND.html.var'); exit(); } ? This is very similar code to the php-scripts, but the change is that it is not looking for the constant anymore (since that doesn't exist once the page is in hte browser), but makes sure that the server calling the file is itself and not a remote call from an address bar. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Strange characters
I have a question about an odd phenomenon. It doesn't have much to do with PHP except that I used strtr to solve it, and it maybe that the problem is being caused by a setting in PHP, but I would like to get some more background info as to why this is happening. On a typical Windows system, most applications use the windows-1252 character set. Linux uses UTF-8 or Unicode. The former being an 8 bit set and the latter being a 16 bit set. Well I have a form on a website that has to be able to take in text from MSWord and Notepad and the like. If someone has been using Autoformating in MS Word, the special characters get translated into a UTF-8 equivalent. What's odd is that these 8 bit windows characters become 24 bit combinations, I think. When I look at the characters in hex they are represented by 3 numbers first one always being 0xE2. Why is there an 0xE2 beginning the character combination and why does PHP translate these characters this way? Is there something you can do to minimize them besides writing some kind of character scrubber? Thanks, Carl