php-general Digest 23 Feb 2007 11:16:28 -0000 Issue 4641
php-general Digest 23 Feb 2007 11:16:28 - Issue 4641 Topics (messages 249259 through 249277): can this be fone with PHP? 249259 by: Bruce Gilbert 249261 by: Jon Anderson 249270 by: tedd 249274 by: Haydar Tuna Re: [PHP-DEV] PHP 4.4.6 RC1 Released 249260 by: Edin Kadribasic Re: Session problems with 4.4.5? 249262 by: steve Re: Safari 2.0.4 / PHP 4.3.7 / Apache 2.0.44 Isuue with HTTP Headers 249263 by: steve Re: Which version of phpmyadmin is stable for php 5.1.6 and FC6 System 249264 by: Jürgen Wind Capture the whole URL 249265 by: Ken Kixmoeller -- reply to ken.kixmoeller.com 249266 by: Jochem Maas 249271 by: tedd 249272 by: Jim Lucas 249273 by: Haydar Tuna Is php_manual_prefs.exe broken? 249267 by: Daevid Vincent PHP + SQL.. 249268 by: Liz Kim 249269 by: Robert Cummings Re: Enable login prompt with main page of phpmyadmin 249275 by: Haydar Tuna Re: JPG Not supported on my server, but GDlib enabled? 249276 by: Haydar Tuna Q: Logical assignment with strstr( ) 249277 by: rgx.gmx.de 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--- I have created forms with PHP where the information in the fields is sent via sendmail to an email, but is there a way to have the information extracted and a pdf form created when the user hits the submit button? -- ::Bruce:: ---End Message--- ---BeginMessage--- Bruce Gilbert wrote: I have created forms with PHP where the information in the fields is sent via sendmail to an email, but is there a way to have the information extracted and a pdf form created when the user hits the submit button? Yep, probably. See http://www.php.net/manual/en/ref.pdf.php jon ---End Message--- ---BeginMessage--- At 2:59 PM -0500 2/22/07, Bruce Gilbert wrote: I have created forms with PHP where the information in the fields is sent via sendmail to an email, but is there a way to have the information extracted and a pdf form created when the user hits the submit button? -- ::Bruce:: Sure -- see: http://xn--nvg.com/pdf tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com ---End Message--- ---BeginMessage--- Hello, You can use the fpdf free package. I have used this PDF package in my many project. It's very easy to use and free:) www.fpdf.org -- Haydar TUNA Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net Bruce Gilbert [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have created forms with PHP where the information in the fields is sent via sendmail to an email, but is there a way to have the information extracted and a pdf form created when the user hits the submit button? -- ::Bruce:: ---End Message--- ---BeginMessage--- Hi, Windows build is available at: http://downloads.php.net/edink/php-4.4.6RC1-Win32.zip Edin Derick Rethans wrote: Hello! I packed PHP 4.4.6RC1 today, which you can find here: http://downloads.php.net/derick/ This release candidate addresses an issues that unfortunately crept into PHP 4.4.5: - Fixed segfault in ext/session when register_globals=On. (Tony) And some other issues: - Fixed bug #40578 (imagettftext() multithreading issue). (Tony) - Fixed bug #40502 (ext/interbase compile failure). (Tony) - Fixed bug #40286 (PHP fastcgi with PHP_FCGI_CHILDREN don't kill children when parent is killed). (Dmitry) It also updates the PCRE library to version 7.0. Please test it carefully, and report any bugs in the bug system. If everything goes well, we can release it somewhere at the end of next week. regards, Derick ---End Message--- ---BeginMessage--- Yes... I think the test version of it goes out today. On 2/22/07, alex handle [EMAIL PROTECTED] wrote: On 2/16/07, Jochem Maas [EMAIL PROTECTED] wrote: Ken Williams wrote: Is anyone else having problems with session in 4.4.5? I'm under apache 1.3.27 in linux 2.4.34 and all my web sites break under 4.4.5. As soon as a page tries to register a session variable with session_register apache will segfault. Has worked perfectly fine for the past 2 years and like 10 version of PHP 4.4.X. segfault probably indicates problem. goto bugs.php.net and file a bug with details about your machine and a small reproduce script. side note: use of session_register() is not recommended - reading the following page may help you understand why, help you work around your current problem and hopefully get you on the path of using $_SESSION: http://php.net/session_register [EMAIL PROTECTED] -- PHP
[PHP] Q: Logical assignment with strstr( )
Dear list, strstr returns a string (in case the needle is found), but a boolean if there is no needle in the haystack. I am trying to make a readable evaluation of some tests, but this fails to work as supposed because of - undefined results when ORing strings with possible string (?) - use of bitwise OR operator (|) where I am uncertain if I can write anything like $a ||= $b; Please read this snippet and tell me your ideas ;) Thanks Ralf $oLen = strlen ($commentary); $isSpam = ! strstr($_POST['Name'], ); $isSpam |= strlen (str_replace(http://,,$commentary)) $oLen; $isSpam |= strstr($_POST['Name'],@); $isSpam |= stristr($_POST['Name'],Casino); //My next trial will be to add is_string( ...) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Q: Logical assignment with strstr( )
On Fri, 2007-02-23 at 12:24 +0100, [EMAIL PROTECTED] wrote: Dear list, strstr returns a string (in case the needle is found), but a boolean if there is no needle in the haystack. I am trying to make a readable evaluation of some tests, but this fails to work as supposed because of - undefined results when ORing strings with possible string (?) - use of bitwise OR operator (|) where I am uncertain if I can write anything like $a ||= $b; Please read this snippet and tell me your ideas ;) Thanks Ralf ?php $oLen = strlen( $commentary ); $isSpam = strstr( $_POST['Name'], ' ' ) === false; $isSpam |= strlen( str_replace( 'http://', '', $commentary ) ) $oLen; $isSpam |= strstr( $_POST['Name'], '@' ) !== false; $isSpam |= stristr( $_POST['Name'], 'Casino' ) !== false; ? 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
[PHP]Transform a block of code in PHP
how to transform a block of code in html to php?? for example this, p STRONGP.M.R. Leiria /STRONG - STRONG Produtos para Mec. e Racionalização Informática, Lda./STRONGbr Av. Dr. Francisco Sá Carneiro nº 1448 2415-376 Leiriabr Telefones: 244850010 Fax: 244850019br E-mail: A href=mailto:[EMAIL PROTECTED]/A A href=mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]/A Url: A href=http://www.pmrleiria.pt/; http://www.pmrleiria.pt//Abr A onclick=window.open('local.htm','Localização da PMR','');return false;href=local.htm target=_parent STRONGVer Mapa da Localização/STRONG/A /P Pnbsp;/P P STRONGP.M.R./STRONG - STRONGProdutos para Mecanização e Racionalização Informática, Lda./STRONGbr Rua Sarmento de Beires nº 23-B 1900-410 Lisboabr Telefones: 218472590/1/2 Fax: 2184472589br E-mail:A href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED] /A /P Pnbsp;/P P STRONGSISPOR /STRONG - STRONGSistemas, Programação e Organização Informática,Lda./STRONGbr Rua Arquitecto Cassiano Barbosa,44 Escritório nº4 4100-009 Portobr Telefones: 226105257/59 Fax: 226105262BR E-mail: A href=mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]/A Url: A href=http://www.sispor.com/; http://www.sispor.com//Abr /p help me please in this journey /mrpostiga
Re: [PHP]Transform a block of code in PHP
Helder Lopes wrote: how to transform a block of code in html to php?? HTML to PHP? You having a laugh? What are you actually trying to achieve? -Stut for example this, p STRONGP.M.R. Leiria /STRONG - STRONG Produtos para Mec. e Racionalização Informática, Lda./STRONGbr Av. Dr. Francisco Sá Carneiro nº 1448 2415-376 Leiriabr Telefones: 244850010 Fax: 244850019br E-mail: A href=mailto:[EMAIL PROTECTED]/A A href=mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]/A Url: A href=http://www.pmrleiria.pt/; http://www.pmrleiria.pt//Abr A onclick=window.open('local.htm','Localização da PMR','');return false;href=local.htm target=_parent STRONGVer Mapa da Localização/STRONG/A /P Pnbsp;/P P STRONGP.M.R./STRONG - STRONGProdutos para Mecanização e Racionalização Informática, Lda./STRONGbr Rua Sarmento de Beires nº 23-B 1900-410 Lisboabr Telefones: 218472590/1/2 Fax: 2184472589br E-mail:A href=mailto:[EMAIL PROTECTED][EMAIL PROTECTED] /A /P Pnbsp;/P P STRONGSISPOR /STRONG - STRONGSistemas, Programação e Organização Informática,Lda./STRONGbr Rua Arquitecto Cassiano Barbosa,44 Escritório nº4 4100-009 Portobr Telefones: 226105257/59 Fax: 226105262BR E-mail: A href=mailto:[EMAIL PROTECTED] [EMAIL PROTECTED]/A Url: A href=http://www.sispor.com/; http://www.sispor.com//Abr /p help me please in this journey /mrpostiga -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]Transform a block of code in PHP
I assume you mean you want to hold that html in a variable? Use a heredoc.
Re: [PHP] Capture the whole URL
On Feb 22, 2007, at 10:26 PM, tedd wrote: Print out these three and you'll see your problem. $_SERVER['SERVER_NAME'] $_SERVER['QUERY_STRING'] $_SERVER['REQUEST_URI'] Thanks, Tedd - - REQUEST_URI still generates a Undefined Index error SERVER_NAME on my testing server returns its IP ***QUERY_STRING*** is the one I wanted. I didn't see it (but then again, I am working through the worst head cold I have had in years. My head is a solid block. Watta pain.) Many thanks. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capture the whole URL
On Feb 23, 2007, at 12:18 AM, Jim Lucas wrote: diddly.com?id=fredtotal=goof First of forgoing the http:// missing, this still isn't a qualified URL Yeah, I was just giving an example of what I wanted. echo $_SERVER['REQUEST_URI']; and see what it returns I said in the post, it returns an error: Undefined index. I wonder if this doesn't work on a Wintel server? Is it supposed to return the whole thing? if for some odd reason that doesn't work try: echo $_SERVER ['QUERY_STRING']; Yes, thanks, that gave me what I wanted, or at least it will together with 'PHP_SELF' that part of the URL that I wasn't getting otherwise. show us an example of the script that generates the error I was testing just with simple echo statements. Looks like you either typed this pretty fast or maybe you had a few typo's. Review your code and check that you are using underscores and not hyphens. Yes, sorry -- I was both in a hurry (wife gently beckoning me to get moving) and drugged up. My code was syntacticly correct. Thank you for your help, Jim. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capture the whole URL
On Feb 22, 2007, at 4:33 PM, Jochem Maas wrote: do a var_dump($_SERVER); or phpinfo(); to see what you do have available. 'REQUEST_URI' doesn't show. Now I see the line in the documentation that says You may or may not find any of the following elements... How do I find out whether QUERY_STRING will work on the working server? I'll do some searching, but is anyone aware of a resource that tells which server hardware/software supports which ones? H... it might be smarter to use the $_GET's to recreate the string if these things are inconsistent. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] phpmyadmin for FC6
Dear All, Which version of phpMyadmin are you using with FC6 ? Edward. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpmyadmin for FC6
[EMAIL PROTECTED] wrote: Dear All, Which version of phpMyadmin are you using with FC6 ? Edward. Always the latest. cajb. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpmyadmin for FC6
# [EMAIL PROTECTED] / 2007-02-23 21:23:37 +0800: Which version of phpMyadmin are you using with FC6 ? none -- How many Vietnam vets does it take to screw in a light bulb? You don't know, man. You don't KNOW. Cause you weren't THERE. http://bash.org/?255991 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] phpmyadmin for FC6
cajbecu wrote: [EMAIL PROTECTED] wrote: Dear All, Which version of phpMyadmin are you using with FC6 ? Edward. Always the latest. cajb. Hello, For phpMyAdmin-2.10.0-rc1, http://192.168.0.1/error.php?lang=zh-TWdir=ltrtype=%E9%8C%AF%E8%AA%A4error= phpMyAdmin - error For phpMyAdmin-2.9.2, When I try to modify a record set, display from IE : tbl_replace.php: Missing parameter: goto (FAQ 2.8) ./Documentation.html#faqmissingparameters http://192.168.0.1/Documentation.html#faqmissingparameters Here are a few points to check: * In config.inc.php, try to leave the $cfg['PmaAbsoluteUri'] #cfg_PmaAbsoluteUri directive empty. See also FAQ 4.7 #faq4_7. But the default is empty. * Maybe you have a broken PHP installation or you need to upgrade your Zend Optimizer. See http://bugs.php.net/bug.php?id=31134. How to Upgrade Zend Optimizer ? * If you are using Hardened PHP with the ini directive varfilter.max_request_variables set to the default (200) or another low value, you could get this error if your table has a high number of columns. Adjust this setting accordingly. (Thanks to Klaus Dorninger for the hint). The php is come from FC 6 System. * In the php.ini directive arg_separator.input, a value of ; will cause this error. Replace it with ;. Just try to modify the config and restart the web service, but still problem. * If you are using Hardened-PHP http://www.hardened-php.net/, you might want to increase request limits http://www.hardened-php.net/hphp/troubleshooting.html. No. Edward.
Re: [PHP] Capture the whole URL
On Feb 23, 2007, at 7:46 AM, tedd wrote: On Feb 22, 2007, at 10:26 PM, tedd wrote: Print out these three and you'll see your problem. $_SERVER['SERVER_NAME'] $_SERVER['QUERY_STRING'] $_SERVER['REQUEST_URI'] Thanks, Tedd - - REQUEST_URI still generates a Undefined Index error SERVER_NAME on my testing server returns its IP ***QUERY_STRING*** is the one I wanted. I didn't see it (but then again, I am working through the worst head cold I have had in years. My head is a solid block. Watta pain.) Many thanks. Ken Ken: As per my understanding, the $_SERVER['REQUEST_URI'] should give you something -- after all, it's from where the request came from (i.e., your app). In your code, simply do a print_r($_SERVER) and see what happens. I did this (actually a var_dump) and $_SERVER['REQUEST_URI'] doesn't show up at all. See my message replying to Jochem. Thanks for your code. I'll check it out. Ken -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Option Value
On my form I have several drop down menus. They all work and display the corrent values. However, I would like the initial display of the form to show each dropdown as blank. $q_status = SELECT * FROM status_codes ORDER BY status_description; $r_status = mssql_query($q_status) or die(mssql_error()); while ($rec_status = mssql_fetch_assoc($r_status)) $status[] = $rec_status; foreach ($status as $s) { if ($s['status_code'] == $_POST['status']) echo OPTION value=\{$s['status_code']}\ SELECTED{$s['status_description']}/OPTION\n; else echo OPTION value=\{$s['status_code']}\{$s['status_description']}/OPTION\n; } Any suggestions on how to make my initial display of the field blank without having to add a blank row to my table?
Re: [PHP] Option Value
On 2/23/07, Dan Shirah [EMAIL PROTECTED] wrote: On my form I have several drop down menus. They all work and display the corrent values. However, I would like the initial display of the form to show each dropdown as blank. $q_status = SELECT * FROM status_codes ORDER BY status_description; $r_status = mssql_query($q_status) or die(mssql_error()); while ($rec_status = mssql_fetch_assoc($r_status)) $status[] = $rec_status; foreach ($status as $s) { if ($s['status_code'] == $_POST['status']) echo OPTION value=\{$s['status_code']}\ SELECTED{$s['status_description']}/OPTION\n; else echo OPTION value=\{$s['status_code']}\{$s['status_description']}/OPTION\n; } Any suggestions on how to make my initial display of the field blank without having to add a blank row to my table? Meaning: you want the select box to show as a default value a blank line but have the remaining data items from the db still in the drop-down list? Then you want to use the selected attribute on a blank line. Plenty of examples available. David
Re: [PHP] Option Value
2007. 02. 23, péntek keltezéssel 10.10-kor Dan Shirah ezt írta: On my form I have several drop down menus. They all work and display the corrent values. However, I would like the initial display of the form to show each dropdown as blank. $q_status = SELECT * FROM status_codes ORDER BY status_description; $r_status = mssql_query($q_status) or die(mssql_error()); while ($rec_status = mssql_fetch_assoc($r_status)) $status[] = $rec_status; foreach ($status as $s) { if ($s['status_code'] == $_POST['status']) echo OPTION value=\{$s['status_code']}\ SELECTED{$s['status_description']}/OPTION\n; else echo OPTION value=\{$s['status_code']}\{$s['status_description']}/OPTION\n; } Any suggestions on how to make my initial display of the field blank without having to add a blank row to my table? echo a blank option before the others greets Zoltán Németh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Option Value
Also, if you want to get into the habit of writing valid xhtml, use lowercase and selected=selected
Re: [PHP] Option Value
Thank you George, that is what I was referring to. I had been placing the echo OPTION value=\\/OPTION\n; inside of my loop..which of course returned a blank after every valid selection. TGIF! Thanks all. On 2/23/07, Dave Goodchild [EMAIL PROTECTED] wrote: Also, if you want to get into the habit of writing valid xhtml, use lowercase and selected=selected
Re: [PHP] Re: JPG Not supported on my server, but GDlib enabled?
Haydar Tuna wrote: Hello, Firstly, you should download latest GD library and Jpeg library and then you should compile your GD with jpeg enabled option and then compile AFAIC it is much better to used the version of GD bundled with the php source, which means the relevant configure option would be: '--with-gd' as opposed to: '--with-gd=/path/to/libs' jpeg. After this step, you can compile Apache and PHP. In PHP installation, you should use such as --with-gd=/usr/local option for gd library and such as --with-jpeg-dir option for jpeg library. If you use --with-gd option without not write any folder name , PHP will use default GD folder ( extension directory). http://www.libgd.org/Downloads ftp://ftp.uu.net/graphics/jpeg/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: When to use exception, or When not to use exception
Hello, You can use the following tutorial for error handling in PHP :) http://www.devshed.com/c/a/PHP/Error-Handling-in-PHP-Introducing-Exceptions-in-PHP-5/ -- Haydar TUNA Republic Of Turkey - Ministry of National Education Education Technology Department Ankara / TURKEY Web: http://www.haydartuna.net js [EMAIL PROTECTED], haber iletisinde sunlari yazdi:[EMAIL PROTECTED] Hello list, Recently I upgraded my dev environment and started to use PHP5 at last! Compared with the former one, PHP5 rocks in many ways. So I love it so much, but sadly, I don't exactly know when to use exception. I'm never used to use Java, or languages that support exceptin so I have to learn the usage.. So, my question is When to use, or when not to use exception? Now I'm using exception in 99% to handle errors because it's easier and cleaner. The only problem I have using exception instead of normal if-error-then method is that I have to define logs of Exception-derived classes to effectively handling erros. It's cumbersome but not so bad compared with traditional error handling. Any suggestions, personal guidelines, tutoriral, documentation would be greatly appriciated. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: JPG Not supported on my server, but GDlib enabled?
Thanks for your help. Though, a tech guy from hosting company fixed this. And I didn't need to mess around. ;) Thanks. -afan Haydar Tuna wrote: Hello, Firstly, you should download latest GD library and Jpeg library and then you should compile your GD with jpeg enabled option and then compile AFAIC it is much better to used the version of GD bundled with the php source, which means the relevant configure option would be: '--with-gd' as opposed to: '--with-gd=/path/to/libs' jpeg. After this step, you can compile Apache and PHP. In PHP installation, you should use such as --with-gd=/usr/local option for gd library and such as --with-jpeg-dir option for jpeg library. If you use --with-gd option without not write any folder name , PHP will use default GD folder ( extension directory). http://www.libgd.org/Downloads ftp://ftp.uu.net/graphics/jpeg/ -- 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] Magic Quotes
I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Any ideas? thanks
Re: [PHP] Magic Quotes
Liz Kim wrote: I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Turning off magic quotes doesn't repair the data already in your database. It sounds like data has previously been inserted into the database after having been escaped twice. You can examine a few records and check whether this is the case. If this is what has happened, I suggest writing a simple utility to repair all of the data in the database (running stripslashes() should do the trick), then you won't have to worry about it again. Hope that helps. Chris -- Chris Shiflett http://shiflett.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic Quotes
On 2/23/07, Liz Kim [EMAIL PROTECTED] wrote: I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Any ideas? thanks What's it look like in the database? David
[PHP] Getting Similar rows from db
Hi. I need a script that selects all similar rows from a database. Like only the id would differ, but other fields would be the same as other rows's fields. I don't know if there is such a mysql statement like SELECT SIMILAR ... Please assist me with using the right mysql statement or using php to get similar rows from the db. Thanks *STILL Learning* -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting authentication information from apache
Hello, I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); None of these work. Has anyone done this?? Thanks, Ryan
RE: [PHP] Getting Similar rows from db
[snip] I need a script that selects all similar rows from a database. Like only the id would differ, but other fields would be the same as other rows's fields. I don't know if there is such a mysql statement like SELECT SIMILAR ... Please assist me with using the right mysql statement or using php to get similar rows from the db. [/snip] See http://www.mysql.com/like -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] getting authentication information from apache
Hello, I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); echo $HTTP_SERVER_VARS['PHP_AUTH_USER']; echo $_SERVER['REMOTE_USER']; None of these work (all of the variables are empty). Has anyone done this?? Thanks, Ryan
RE: [PHP] Getting Similar rows from db
-Original Message- From: Jay Blanchard [mailto:[EMAIL PROTECTED] Sent: Friday, February 23, 2007 1:51 PM To: Wikus Möller; php-general@lists.php.net Subject: RE: [PHP] Getting Similar rows from db [snip] I need a script that selects all similar rows from a database. Like only the id would differ, but other fields would be the same as other rows's fields. I don't know if there is such a mysql statement like SELECT SIMILAR ... Please assist me with using the right mysql statement or using php to get similar rows from the db. [/snip] See http://www.mysql.com/like -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Assume you have the following data: ID FirstName LastName 1 John Doe 2 John Doe 3 Jack Black 4 Adam Jones 5 Sally Smith The following query: SELECT COUNT(ID) AS NumRecords, FirstName, LastName FROM MyTable GROUP BY FirstName, LastName HAVING COUNT(ID) 1; Would produce the following result: NumRecords FirstName LastName 2 John Doe HTH, Brad -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
Ryan wrote: Hello, I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); does this offer any clue?: var_dump($_ENV, $_SERVER); None of these work. Has anyone done this?? Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Getting Similar rows from db
I don't think there's a way to do it with SQL in MySQL. Jay's talking about a substring search within a field and what you really want is to know if two whole rows (multiple columns) within a database are similar or not. You could pull in all the data and use PHP to figure out what's similar (bulky, brute force and potentially system resource hoggish) You could try using a little logic to whittle it down to a few columns that you suspect may be similar. Like if you're looking for duplicate contacts, you might check for duplicate phone numbers: select Phone, count(*) from contacts group by Phone having count(*) 1 (something like that.. syntax may be off a little) Or may check addresses: select Address, SUBSTRING(Address, 1, 5), count(*) from contacts group by SUBSTRING(Address, 1, 5) having count(*) 1 You could get really crazy and use SOUNDEX(CONCAT(col1, col2, col3, col4)) and see if you get any duplicate entries. No idea how well that'd work, but SOUNDEX is made for doing a basic comparison of two things to see if they're similar. Maybe not as good as some other similar string comparisons in PHP, but not all of them are available in MySQL. In PHP, see soundex(), metaphone(), similar_text() and levenshtein() for more information about similar string testing. -TG = = = Original message = = = [snip] I need a script that selects all similar rows from a database. Like only the id would differ, but other fields would be the same as other rows's fields. I don't know if there is such a mysql statement like SELECT SIMILAR ... Please assist me with using the right mysql statement or using php to get similar rows from the db. [/snip] See http://www.mysql.com/like ___ 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
[PHP] Re: Magic Quotes
##ORIGINAL I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Any ideas? thanks ##END ORIGINAL If data stored in database has escape character '\' then use stripslashes() If your want to turn off automatic escaping then turn off these directive magic_quotes_gpc magic_quotes_runtime magic_quotes_sybase -- Regards Fahad Pervaiz www.ecommerce-xperts.com (Shopping Cart, Framework for Multilingual Web Sites and Web Designs)
Re: [PHP] Re: Magic Quotes
On Sat, 2007-02-24 at 00:42 +0500, Fahad Pervaiz wrote: ##ORIGINAL I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Any ideas? thanks ##END ORIGINAL If data stored in database has escape character '\' then use stripslashes() If your want to turn off automatic escaping then turn off these directive magic_quotes_gpc magic_quotes_runtime magic_quotes_sybase He said he disabled 3 magic quote directives. In your response I notice you list exactly 3 directives. I wonder if they're the same three he said he disabled :| 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
[PHP] Size Limit PHP + MSSQL
Is there size limit for select queries in php? I am trying to grab a very long string that exists in the database. When I do a select and print it out, php keep truncating the string - only outputing the first half or so when the string is too long. I have checked the actual database and the string is complete. I havent gone as far as checking the actual length of the string and the length that is being printed.. Any ideas why php keep truncating my data? I've tested it with asp and it successfully outputs the complete data... Thank you!
Re: [PHP] Getting Similar rows from db
On Fri, February 23, 2007 12:35 pm, Wikus Möller wrote: I need a script that selects all similar rows from a database. Like only the id would differ, but other fields would be the same as other rows's fields. I don't know if there is such a mysql statement like SELECT SIMILAR ... Please assist me with using the right mysql statement or using php to get similar rows from the db. The most common way to do this is to do a self join where you essentially compare TWO copies of the same table with itself: SELECT a.id, b.* FROM your_table AS a, your_table AS b WHERE a.id b.id AND a.field1 = b.field1 AND a.field2 = b.field2 AND a.field3 = b.field3 . . . The restriction of a.id b.id is so you only get notified ONCE about each duplicate -- Take that out, and you get told that A and B are similar, and that B and A are similar, which is rarely, if ever, useful. WARNING: On a moderate sized table, this can bring your database server to its knees in a hurry... E.g., take a couple thousand rows, do a self-join, and you're trying to process MILLIONS of records. This usually swaps out to disk, and slogs the whole machine unless you're on a dedicated server. At least, that was my experience. Since this question usually arises after somebody has screwed up and inserted duplicate records, if you're in that situation, I'd also highly recommend that you figure out exactly how that happened, and make sure it can't happen again, because weeding out the duplicates after the fact is error-prone and gets expensive fast. :-) To bring this on-topic then, it's sometimes better to: A) Write a script in PHP to process one record at a time, searching for duplicates for that record, and then sleep for a second or three. B) Write a PHP web interface to allow humans to merge duplicates or similar records, where they already know what the duplicates are from stumbling across them. This is probably the ONE INSTANCE where you actually should violate the rule about not showing the internal ID to the end user... :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Magic Quotes
On Fri, February 23, 2007 12:04 pm, Liz Kim wrote: I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Here's one possible scenario: You *USED* to have Magic Quotes GPC on *AND* you were using an escape function such as addslashes or mysql_real_escape_string. So, in essence, you double escaped your data, and your database has BAD DATA in it. To explain double escaped... The whole point of this escaping business is to give the MySQL parser valid data to read in. Correct Escaping: ORIGINAL DATAESCAPED DATAMYSQL STORES O'Brien O\'BrienO'Brien Double Escaped: ORIGINAL DATADOUBLE ESCAPED DATA MYSQL STORES O'Brien O\\\'Brien O\'Brien Pretty much, if you ever used the function stripslashes you probably had double escaped data and never realized it. You've got a big mess on your hands, as the data stored by MySQL is not what it should be, and you'll have to find that data, stripslashes it once, and put it back in correctly, with just ONE escape mechanism (mysql_real_escape_string, ideally). About the only bright side is that calling stripslashes an extra time rarely, if ever, will cause a problem. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Magic Quotes
I've got all three Magic Quote directives turned off... When I use sql query to grab any string from a database, it still spits out the \ in front of the special characters.. Any ideas? thanks ##END ORIGINAL If data stored in database has escape character '\' then use stripslashes() One other possible scenario: You *think* you've turned off all those Magic Quote things, but you are using PHP as a Module, and forgot to re-start Apache, so you really didn't turn them off. Confirm 100% sure with ?php phpinfo();? that Magic Quotes really really are OFF. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Option Value
On Fri, February 23, 2007 9:10 am, Dan Shirah wrote: On my form I have several drop down menus. They all work and display the corrent values. However, I would like the initial display of the form to show each dropdown as blank. [snip] Any suggestions on how to make my initial display of the field blank without having to add a blank row to my table? Just hard-code a blank OPTION in the HTML after the SELECT, but before the PHP to dump out the other options: SELECT NAME=whatever OPTION VALUE=-- Select Choice --/OPTION ?php /* your posted code goes here */ ? /SELECT Presentation Purists will claim this is wrong, I suspect, since it hard-codes the one special value for nothing selected but there it is. I personally have less trouble with this method than the other half-dozen I tried over the years. YMMV IANAL NAIAA -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]Transform a block of code in PHP
On Fri, February 23, 2007 6:12 am, Helder Lopes wrote: how to transform a block of code in html to php?? for example this, I'm not sure I understand the question... Look for the parts that repeat, and re-factor them as a loop through some kind of data storage such as a database? Or perhaps you are just looking for the 'heredoc' language construct? http://us2.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Size Limit PHP + MSSQL
There are two settings in php.ini mssql.textsize and mssql.textlimit. When tese are set to -1 (default) the values used are configured on the server and is usually 4k. - Frank Is there size limit for select queries in php? I am trying to grab a very long string that exists in the database. When I do a select and print it out, php keep truncating the string - only outputing the first half or so when the string is too long. I have checked the actual database and the string is complete. I havent gone as far as checking the actual length of the string and the length that is being printed.. Any ideas why php keep truncating my data? I've tested it with asp and it successfully outputs the complete data... Thank you! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Q: Logical assignment with strstr( )
On Fri, February 23, 2007 5:24 am, [EMAIL PROTECTED] wrote: strstr returns a string (in case the needle is found), but a boolean if there is no needle in the haystack. As the manual suggests, using the === operator to check for FALSE is probably the best way. I am trying to make a readable evaluation of some tests, but this fails to work as supposed because of - undefined results when ORing strings with possible string (?) - use of bitwise OR operator (|) where I am uncertain if I can write anything like $a ||= $b; Please read this snippet and tell me your ideas ;) Thanks Ralf $oLen = strlen ($commentary); $isSpam = ! strstr($_POST['Name'], ); $isSpam |= strlen (str_replace(http://,,$commentary)) $oLen; $isSpam |= strstr($_POST['Name'],@); $isSpam |= stristr($_POST['Name'],Casino); Using |= directly on these things is probably going to get ugly quickly, as you will probably need something more like: $isSpam |= (strstr($_POST['Name'],'@')===false ? 1:0); Stepping back from the minutae of coding style... Writing your own spam filter is probably a Bad Idea, as re-inventing this particular wheel is far more effort than you have yet realized, and PHP is almost certainly the wrong weapon in the first place... I say this, having attempted to do it myself. :-) Install Spam Assassin or something similar, and get way better results. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
Jochem, Hmm, not sure what I'm looking for, but from what I've read, the REMOTE_USER should contain this informaion, mine seems to be empty. array(30) { . . . [REMOTE_USER]= string(0) . . Thanks, Ryan On 2/23/07, Jochem Maas [EMAIL PROTECTED] wrote: Ryan wrote: Hello, I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); does this offer any clue?: var_dump($_ENV, $_SERVER); None of these work. Has anyone done this?? Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP + SQL..
On Thu, February 22, 2007 7:53 pm, Liz Kim wrote: When I try to get a really long string and print it out on a website, it tends to stop in the middle of the string. Is this some sort of a limitation that I can change? It's probably a limit on the number of characters that can be stored in your database datatype. So it's not getting lost when you display it -- It never got into the DB in the first place. You may be able to re-configure your DB to change the limit for TEXT (which I assume you are using) but there may also be a pre-existing LONGTEXT which has an even higher limit, or you may need to go for a BLOB which has an even higher limit (often the limit there is the size of your hard drive). Better than all of that, however, is to take a step back and consider if cramming such a large chunk of data into your database is really the correct solution. Unless you are actually doing a DB search, sort, or other SQL operation on that field, you would be better off storing it in a file on the hard drive, and leaving the DB operations in the DB, and the large-file operations in the highly-optimized, more mature, and customized db solution specifically designed for large file managements. (aka, your file system) It's also possible that your datatypes are correct, but the QUERY size is limited. This is unlikely given your description, but it's the NEXT problem you are going to run into, and is even more tricky to solve unless you have complete control over your environment (dedicated servers). You'll have to do more research about the database you are using -- and further questions in this arena really belong on that database's mailing list, rather than here, as PHP is almost certainly not involved, really, in the problem. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Capture the whole URL
On Thu, February 22, 2007 4:26 pm, Ken Kixmoeller -- reply to [EMAIL PROTECTED] wrote: Hey - - I must be missing something, but in a URL such as: diddly.com?id=fredtotal=goof $_SERVER['PHP-SELF'] gives me the diddley.com part. I want to capture the whole URL. The documentation makes it seem like $_SERVER['REQUEST_URI'] is supposed to do that, but I get an Undefined Index error. Do I have to enable this somehow? I realize that I could recreate the rest of the URL from $_GET's, but I'd rather not if I don't have to. Anytime you need to know what's available to you from PHP variables and settings, throw a ?php phpinfo();? into the page, and surf to it again. Then search for the answer you want, and see what variable holds it. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can this be fone with PHP?
On Thu, February 22, 2007 1:59 pm, Bruce Gilbert wrote: I have created forms with PHP where the information in the fields is sent via sendmail to an email, but is there a way to have the information extracted and a pdf form created when the user hits the submit button? Yes. To just generate a PDF on the fly from FORM (or database) data: http://php.net/pdf To create a PDF that actually *is* a FORM of sorts: http://php.net/fdf I'd recommend trying the first one out and see if that will work, before diving into the more complicated FDF stuff. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Safari 2.0.4 / PHP 4.3.7 / Apache 2.0.44 Isuue with HTTP Headers
On Thu, February 22, 2007 10:05 am, Ron Stiemer wrote: Hi everyone, got a really strange thing going on on a client website, the website outputs the whole http headers after every 2nd reload in safari, also in FF on Windows, but only after much much more relaods...here is a scrrenshot: http://www.waldhaeusl.com/downloads/bug/http_header.png any ideas what the problem could be, i checked if there are any used socket connections, but nothing there...maybe an apache issue ? Take the browsers out of the equation, and play with wget and ab to log what your server actually sends out. Or maybe even write a PHP script with curl to duplicate any sort of cookie/session/login details that are involved, to be sure you are doing what a browser does. If it's sending a BLANK LINE before the HTTP headers, or duplicating the headers with a BLANK LINE in between, well, there ya go. Find out why it's doing that. If your server is spitting out exactly what it should spit out, then you have a browser bug. Here are some odds, made up by me, on the spot: Browser bug: 1 in 1,000,000 Apache bug: 1 in 10,000,000 Your bug: extremely likely :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I force my script to exit after 5 seconds?
On Thu, February 22, 2007 9:06 am, Aaron Gould wrote: So, my question is: how can I force this script to stop after 5 seconds has elapsed? Here's the script: Inlined code might work... $fp = fsockopen('192.168.3.25', 10001, $errno, $errstr, 5); if (!$fp) { echo 'Error...'; } else { $command = KPRINT\r\n; fwrite($fp, $command); $last_data = time(); while (!feof($fp)) { $buffer = fgets($fp, 1024); if (strlen($buffer)) $last_data = time(); if (time() - $last_data 5){ fclose($fp); exit; } } fclose($fp); } -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] registered globals on localhost (apache)
On Thu, February 22, 2007 7:40 am, Ross wrote: I have my RG's switched off in my local .ini but I am tinkering about with oscommerce. php_value register_globals on I tried to change add this line to the .htaccess file in the catalog folder but still gives the error Server Requirement Error: register_globals is disabled in your PHP configuration. This can be enabled in your php.ini configuration file or in the .htaccess file in your catalog directory. Can I change the RG settings in tis way on my localhost? Yes, maybe, if in httpd.conf you allowed yourself to AllowOverride correctly. You can use ?php phpinfo();? in the sub-directory to see if the Local value is changed from the Master (local ~= .htaccess) Local would also reflect any ini_set() calls made before phpinfo(), but that's kind of useless for magic_quotes, which takes its action long before any ini_set() could possibly have any effect. NOTE: If software required register_globals ON, perhaps one should simply not use that software. JMHO. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Installing Apache + PHP on Windows
Can you get to /info.php WITHOUT the extra stuff on the end?... If not, get that fixed first. On Thu, February 22, 2007 7:34 am, Eli wrote: Hi, I installed apache v2.2.4 and PHP v5.2.1 on Windows XP. I try to use URLs like /info.php/virtual/path but I get error 404 all the time. I've also tried to set AcceptPathInfo for the vhosts directory. Directory /my_vhosts_dir Options Indexes FollowSymLinks AcceptPathInfo On Order Deny,Allow Allow from all /Directory but this keeps failing. What's wrong? How can I fix it? -thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
Jochem, Hmm, not sure what I'm looking for, but from what I've read, the REMOTE_USER should contain this informaion, mine seems to be empty. array(30) { . . . [REMOTE_USER]= string(0) . . Thanks, Ryan On 2/23/07, Jochem Maas [EMAIL PROTECTED] wrote: Ryan wrote: Hello, I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); does this offer any clue?: var_dump($_ENV, $_SERVER); None of these work. Has anyone done this?? Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] remote file time -small issue
On Thu, February 22, 2007 2:34 am, SJAMHO DBMS wrote: I have a problem with the attached file. Run it or see it here: http://www.sjamho.com/update/remote.php The issue is: the timestamps are shown for every file in a subdirectory, but never for a file in the root of a domain. Can anyone tell me why? Yes. The URLs in question don't provide a Last-modified: header. localhost junk # wget --server-response http://www.pitpass.com/forum/viewforum.php | head -n 40 --15:10:58-- http://www.pitpass.com/forum/viewforum.php = `viewforum.php' Resolving www.pitpass.com... 64.62.155.120 Connecting to www.pitpass.com|64.62.155.120|:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Date: Fri, 23 Feb 2007 21:11:52 GMT Server: Apache/1.3.34 (Unix) PHP/4.4.2 X-Powered-By: PHP/4.4.2 Set-Cookie: forum_data=a%3A2%3A%7Bs%3A11%3A%22autologinid%22%3Bs%3A0%3A%22%22%3Bs%3A6%3A%22userid%22%3Bi%3A-1%3B%7D; expires=Sat, 23 Feb 2008 21:11:52 GMT; path=/forum/; domain=pitpass.com Set-Cookie: forum_sid=f5caf540f60eb89ce67a0672d7bffef7; path=/forum/; domain=pitpass.com Cache-Control: private, pre-check=0, post-check=0, max-age=0 Expires: 0 Pragma: no-cache Content-Type: text/html X-Cache: MISS from www.pitpass.com Connection: close Length: unspecified [text/html] Excellent question, by the way! I believe that if Last-modified is not provided, you can safely assume that the page is dynamic, or should be treated as such -- I.e., the page will be different every time you view it, in theory. Unless you are pounding the same page more than once per second, you could probably just store time() as the Last-modified in that case, and move on with life. Or you could leave it as 0 and know that that means that the page had no Last-modified header. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOM Element default ID attribute
On Wed, February 21, 2007 11:44 pm, Eli wrote: Peter Lauri wrote: This was not clear for me, do you mean: a peter = a id=peter No. Let me try to be more clear.. Say you got the element elem key=peter , then I want the DOMDocument to automatically convert the 'key' attribute to an ID-Attribute, as done with DOMElement::setIdAttribute() function. The ID-Attribute is indexed and can be quickly gotten via DOMDocument::getElementById() function. I'm trying to avoid looping on all nodes overriding the importNode() and __construct() methods of DOMDocument. Are the keys guaranteed to be unique? If not, you can't do that, because the IDs have to be unique, no? I suspect you'll simply have to walk the whole thing and do it the hard way, if it's even a Good Idea... You might be better off taking a step back and asking the list how they solved whatever problem you're trying to solve with auto-generating the IDs, as there may be a Better Way... -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
On Wed, February 21, 2007 1:01 pm, Ryan wrote: I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); None of these work. Has anyone done this?? If the answer you are seeking isn't available in: ?php phpinfo();? run on the page where you are trying to do this, then you probably can't get the answer you want. Running http://php.net/ldap to re-connect and re-authenticate will probably be fairly cheap, since LDAP is supposed to be pretty dang fast in the first place, and whatever caching is going on for the LDAP or OS calls behind LDAP virtually guarantees that the data you want is in RAM. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Zend question
On Wed, February 21, 2007 12:40 pm, Brian Dunning wrote: I have eAccelerator on my server. I want to use Zend Guard. Anyone know if I'll need to lose eAccelerator and switch to Zend Optimizer? Assuming Zend Guard is the encryptor code-obfuscator product, I believe the answer is: YES. However, you really should address this question to the Zend employees who are paid to answer it. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with directory listing code
On Wed, February 21, 2007 10:41 am, Joker7 wrote: Hi - I'm having a bit of a problem with this directory listing code, found it some time ago and have been modifying it.I have run up against one or two problems. 1\ How can I make it not list its self 2\ Is there away to specify what files it list 3\add a more clear back button My php is not that good and I have hit a wall so any help would be appreciated. Chris ?php $allow_parent = false; $path=$_GET[path]; $SCRIPT_NAME=getenv(SCRIPT_NAME); if (!isset($path)) { $path = ./; } if (strstr($path,..)) { echo h2No path!/h2; exit; } $base_dir = getcwd(); chdir($path); $current_dir = getcwd(); $directory = dir(./); $directories_array = array(); $files_array = array(); while ($file = $directory-read()) { //I think you want this: if ($file === '.' || $file === '..') continue; if (is_dir($file) AND $file != .) { $directories_array[] = $file; } if (is_file($file)){ $files_array[] = $file; } } $directory-close(); echo ; echo table width=100% border=0 cellspacing=0 cellpadding=0; echo thName/thth width=50Size/thth width=70Date/th/tr; sort($directories_array); foreach($directories_array as $value) { if ($value==..) { $new_path=strrev(substr(strstr(substr(strstr(strrev($path),/),1),/),1)); } else { $new_path=$path.$value; } if (($value != ..) OR ($base_dir != $current_dir)) { echo trtdfont face=Verdana size=1a href=\$SCRIPT_NAME?path=.urlencode($new_path./).\b$value/b/a/font/tdtd/tdtdfont face=Arial size=1.gmdate(M Y,filemtime($value))./font/td/tr; } elseif ($allow_parent == true) { echo trtd/tdtd/tdtd/td/tr; } } sort($files_array); foreach($files_array as $value) { if($value != basename($SCRIPT_NAME) or $path!=./) { $filesize=filesize($value); if ($filesize 1073741823) { $filesize = sprintf(%.1f,($filesize/1073741824)). GB; } elseif ($filesize 1048575) { $filesize = sprintf(%.1f,($filesize/1048576)). MB; } elseif ($filesize 1023) { $filesize = sprintf(%.1f,($filesize/1024)). kB; } else{ $filesize = $filesize. byte; } echo trtdfont face=Verdana size=1i$value/i/font/tdtdfont face=Arial size=1$filesize/font/tdtdfont face=Arial size=1.gmdate(M Y,filemtime($value))./font/td/tr; } } echo /table; echo ; echo ; ? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting authentication information from apache
Richard, I looked at phpinfo() as you said, same thing... _SERVER[REMOTE_USER]no value You may be right, this may not be available, but I don't want to keep throwing a login screen in front of users for no apparent reason. Thanks, Ryan On 2/23/07, Richard Lynch [EMAIL PROTECTED] wrote: On Wed, February 21, 2007 1:01 pm, Ryan wrote: I'm new to php and I have am running php on apache. I already have ldap authentication set up in apache would rather not create a separate system for php. What would be ideal would be to get the current authenticated user from the apache environment. At this point I'm grabbing at straws, but so far I've tried $ret = apache_getenv(LDAP_USER); echo $ret; echo $_SERVER['REMOTE_USER']; echo $_SERVER['PHP_AUTH_DIGEST']; $ret = apache_getenv('PHP_AUTH_DIGEST'); None of these work. Has anyone done this?? If the answer you are seeking isn't available in: ?php phpinfo();? run on the page where you are trying to do this, then you probably can't get the answer you want. Running http://php.net/ldap to re-connect and re-authenticate will probably be fairly cheap, since LDAP is supposed to be pretty dang fast in the first place, and whatever caching is going on for the LDAP or OS calls behind LDAP virtually guarantees that the data you want is in RAM. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing compiled code on the server
On Wed, February 21, 2007 8:52 am, Brian Dunning wrote: I have a few scripts that I want to protect from the prying eyes of even people with root access to my server. The best suggestion I've heard is to store only the compiled version on the server itself. I have no idea how to do this or how those scripts would be called. Can anyone point me to a good starting place? There are products/projects such as that Prioblender (?) thing, and Zend has one which was once called Zend Encoder but got re-named by Marketing to, maybe, Zend Guard (?). Basically, if somebody has root access, though, them having access to your PHP script should be awfully low on the worry list... :-) Assuming this is somebody you actually WANT to have root on your box, then a good clear contract with them regarding the use of the source is probably more important than trying to obfuscate it. Any determined individual can reverse-engineer it no matter how you obfuscate it, so you need that contract anyway. Once you have the clear contract, whether they just steal it as source, or reverse engineer it, you are in the same boat. So you're only keeping the honest people honest with an ill-designed lock to add the obfuscation. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How to call image from mySql to php file
On Wed, February 21, 2007 8:26 am, Chris Carter wrote: I have a field in database called logos which has one value images/logos/some_logo.jpg In my php I am trying to call it in my php file as image. With this code. $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno'; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $logos=mysql_result($result,$i,logos); echo div p $logos /p /div; ?/div But getting errors. What is the way to call image in php file from the database. I know that this is a very basic question but first time for me. I ignored this in the begining but now its right infront of me. Your goal is to get valid HTML to be output, that does what you want. Use View Source in your browser to see what you have. Does this look like valid HTML: p images/logos/some_logo.jpg /p that does what you want? How could you change your source to make it look like valid HTML that does what you want? Hint: You need an IMG tag somewhere. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php and .net webservice
On Wed, February 21, 2007 7:32 am, Arno Coetzee wrote: I have a php client that needs to interact with a .net web service. The method I call returns a strongly typed dataset (some or other .net object). I cannot seem to get my php client to understand what this dataset is. I can see the information with a tcpdump, but for the life of me I cant get php to display the results returned. Any pointers? Use http://php.net/var_dump a lot? Show us your code so we aren't guesing about what you are doing? Avoid .net like the plague? :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anti-spam GD security image code validation
On Wed, February 21, 2007 7:17 am, Bare wrote: Ok, I could store actual security code in a hidden text field of the form, but then it wold be visible to spam bots, isn't it? Google for CAPTCHA to find a zillion solutions, and read them. But you are on the right track, and your assumptions about hidden text fields are correct. If, however, you store an ID for the user, such as with http://php.net/session_start and then store the correct answer on the SERVER where they cannot get it, in, say $_SESSION, then you can check their answer with the correct one, without actually exposing it to them. Unless, of course, they want to write an OCR routine to examine the pixels of your CAPTCHA, and defeat it that way. Which means that any CAPTCHA that isn't going to be too tricky for humans can be beat by the computer, if somebody wants to badly enough. CAPTCHA also has serious accessiblity issues. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New Menu Bar - Can people test it for me?
On Wed, February 21, 2007 6:12 am, Scott Gunn wrote: http://www.thebigspider.co.uk/test/menu.html I'm going to write some php code which will build this menu from an XML file. Before I do, I want to know what sort of browser compatibility it has? could you guys test it and let me know if it worked ok and looked like the preview picture? If your on IE7 or Firefox2 and it works please don't email back as I know these work fine. http://browsercam.com/ There are probably other similar solutions. PS I'll tell you for free, without even checking, that it probably doesn't work in lynx. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] save email in original layout
http://php.net/mysql_real_escape_string is the only thing you need to worry about as far as MySQL is concerned. Translating from Email newlines to HTML newlines to OS newlines is another kettle of fish... Email newlines are SUPPOSED to be \n, except that some ancient Windows MTAs insisted on using \r\n and... So I'm concerned to see the \r in the emails, as they shouldn't be there... And, of course, if you display this to a browser, you would need something like: echo nl2br(htmlentities($email)); to give the appearance of line-breaks in HTML. To send it back out as email, with a real MTA, you'll probably need to replace the \r\n with \n, though the real MTA might even be smart enough to do that, knowing that it came from a broken MTA in the first place. Did I just confuse email headers (\n only) with the body (\r\n) again? I do that all the time... Experimentation or reading RFCs will straighten you out on this one, though you're always at the mercy of the MTAs involved, which may or may not be doing it right... You also might as well prepare now for the Outlook users who will insist on using ASCII control characters for things like quote marks because they want those curly quotes that DO NOT WORK for anybody other than MS users... There's several solutions at http://str_replace for that one. On Wed, February 21, 2007 12:11 am, Richard Kurth wrote: I need to save an email in a mysql database so that it retains it's original layout so the example below Hello , Do you dream of a better life? Do you wish you had financial stability and freedom? Would you like to be your own boss? would look like this when the file is saved \r\n Hello ,\r\n\r\n\r\n Do you dream of a better life? Do you wish you had financial stability and freedom? Would you like to be your own boss? how do I insert all the line spaces like above -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] New To PHP
On Tue, February 20, 2007 7:11 pm, Larry Chu wrote: I am new to php and was trying to view the code below. I do see in my browser the question that is being asked, but for some reason the answer is not displayed. I am copying this from a book and am sure I have typed everything as it should be typed. Can you please tell mw what might be wrong? Thank you. html headbasefont face=Arial/head body h2Q: This Creature can change color to blend in with its surroundings. What is its name?/h2 ?php // print output echo 'h2iA: Chameleon/i/h2'; ? /body /html If you do View Source in your browser, do you see the ?php bit? If so, then you have not installed PHP correctly. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] css in mail()
On Wed, February 21, 2007 3:46 am, Sancar Saran wrote: Hi, Actual was this !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd; html head meta http-equiv=content-type content=text/html; charset=utf-8 / meta name=description content= / meta name=keywords content= / titleTitle/title /head style type=apstext/cssaps ... It's entirely possible the PHP 'mail' command now adds the various MIME headers and whatnot to make this work, but it sure didn't used to... Or maybe they went and simplified the whole MIME mess since I last looked and now you don't need those 'boundary' things to get a valid HTML email. You still have the issue of spam filters catching it as HTML email, so losing audience share to that I know I see a TON of email that starts off with html in the actual email. Actually, I don't really see it, as I hit 'delete' automatically at that point. -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printer functions
On Tue, February 20, 2007 7:57 am, Leslie Aguilera wrote: I am having problems with the printer functions, I have a touch screen pos system and it works very fine, all prints works ok on receipt, ticket printers, now the problem I am having is getting it to work on a lan, with 2 computer 4 printers, if I send information to from A to computer B which have a printer I getting a printer error, does not work: $handle = printer_open(\\Desktop\Cocina en Desktop); Since \ is a special character in PHP strings, try: Desktop\\Cocina en Desktop as the printer name. works: $handle = printer_open(Cocina); but printer show a error printing message What error message? can anyone help me with this? -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] anti-spam GD security image code validation
At 3:59 PM -0600 2/23/07, Richard Lynch wrote: CAPTCHA also has serious accessiblity issues. CAPTCHA does have its problems, but those problems can be lessened. The main problem is how does one identify a user from a computer AND make the technique accessible at the same time. As we previously discussed, my current experiment (link below) apparently does this for the visually impaired. It could be coupled with other techniques to make it more accessible for other disabilities as well. In any event, I have the site up for review by a couple of disability newsletters -- we'll see what they think. http://www.sperling.com/examples/captcha/ As always, I am open to suggestion and comment. Cheers, tedd -- --- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] New Menu Bar - Can people test it for me?
Very nice - sorta. It doesn't work for me in IE6, but does work in FF2. -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, February 23, 2007 2:03 PM To: Scott Gunn Cc: php-general@lists.php.net Subject: Re: [PHP] New Menu Bar - Can people test it for me? On Wed, February 21, 2007 6:12 am, Scott Gunn wrote: http://www.thebigspider.co.uk/test/menu.html I'm going to write some php code which will build this menu from an XML file. Before I do, I want to know what sort of browser compatibility it has? could you guys test it and let me know if it worked ok and looked like the preview picture? If your on IE7 or Firefox2 and it works please don't email back as I know these work fine. http://browsercam.com/ There are probably other similar solutions. PS I'll tell you for free, without even checking, that it probably doesn't work in lynx. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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] New Menu Bar - Can people test it for me?
I like it, but it's pretty image intensive. - Craige On 2/23/07, Daevid Vincent [EMAIL PROTECTED] wrote: Very nice - sorta. It doesn't work for me in IE6, but does work in FF2. -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, February 23, 2007 2:03 PM To: Scott Gunn Cc: php-general@lists.php.net Subject: Re: [PHP] New Menu Bar - Can people test it for me? On Wed, February 21, 2007 6:12 am, Scott Gunn wrote: http://www.thebigspider.co.uk/test/menu.html I'm going to write some php code which will build this menu from an XML file. Before I do, I want to know what sort of browser compatibility it has? could you guys test it and let me know if it worked ok and looked like the preview picture? If your on IE7 or Firefox2 and it works please don't email back as I know these work fine. http://browsercam.com/ There are probably other similar solutions. PS I'll tell you for free, without even checking, that it probably doesn't work in lynx. :-) -- Some people have a gift link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] save email in original layout
-Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Friday, February 23, 2007 2:19 PM To: Richard Kurth Cc: php-general@lists.php.net Subject: Re: [PHP] save email in original layout http://php.net/mysql_real_escape_string is the only thing you need to worry about as far as MySQL is concerned. Translating from Email newlines to HTML newlines to OS newlines is another kettle of fish... Email newlines are SUPPOSED to be \n, except that some ancient Windows MTAs insisted on using \r\n and... So I'm concerned to see the \r in the emails, as they shouldn't be there... And, of course, if you display this to a browser, you would need something like: echo nl2br(htmlentities($email)); to give the appearance of line-breaks in HTML. To send it back out as email, with a real MTA, you'll probably need to replace the \r\n with \n, though the real MTA might even be smart enough to do that, knowing that it came from a broken MTA in the first place. Did I just confuse email headers (\n only) with the body (\r\n) again? I do that all the time... Experimentation or reading RFCs will straighten you out on this one, though you're always at the mercy of the MTAs involved, which may or may not be doing it right... You also might as well prepare now for the Outlook users who will insist on using ASCII control characters for things like quote marks because they want those curly quotes that DO NOT WORK for anybody other than MS users... There's several solutions at http://str_replace for that one. On Wed, February 21, 2007 12:11 am, Richard Kurth wrote: I need to save an email in a mysql database so that it retains it's original layout so the example below Hello , Do you dream of a better life? Do you wish you had financial stability and freedom? Would you like to be your own boss? would look like this when the file is saved \r\n Hello ,\r\n\r\n\r\n Do you dream of a better life? Do you wish you had financial stability and freedom? Would you like to be your own boss? how do I insert all the line spaces like above My problem is I have a JavaScript that will hold all the email templates on the page that is displayed and when you select one it puts it in the textarea so you can edit it and then send it out. When it appears in the textarea it does not have all the /r/n in there anymore. The JavaScript errors out if I just put br or spaces in it. That is the only reason I need the /r/n in the file. Below is what the script looks like. The first script works the second does not work. The only difference is the spaces I put in the first email in the second example. I generate the last part of this script from the database where the email templates are stored THIS ONE WORKS form method=post name=scriptform action=sendfollowup.php script language=JavaScript !-- function MM_findObj(n, d) { //v4.0 var p,i,x; if(!d) d=document; if((p=n.indexOf(?))0parent.frames.length) { d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);} if(!(x=d[n])d.all) x=d.all[n]; for (i=0;!xid.forms.length;i++) x=d.forms[i][n]; for(i=0;!xd.layersid.layers.length;i++) x=MM_findObj(n,d.layers[i].document); if(!x document.getElementById) x=document.getElementById(n); return x; } function MM_setTextOfTextfield(objName,x,newText) { //v3.0 var obj = MM_findObj(objName); if (obj) obj.value = newText; } function changescript() { var t1=this is a test subject line; var s1=This is a test message. This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message This is a test message; var t2=this is a test subject line; var s2=\r\n This ,\r\n\r\n\r\n s a test message This is a test message? s a test message This is a test message? s a test message This is a test message? \r\ns a test message This is a test message; switch(document.scriptform.scriptn.value) {case '1' : MM_setTextOfTextfield('thescript','',s1); MM_setTextOfTextfield('subject','',t1); break; case '2' : MM_setTextOfTextfield('thescript','',s2); MM_setTextOfTextfield('subject','',t2); break; default : break; } } //-- /script p Choose Email Follow-up: select name=scriptn onChange=changescript(); option value=0 selectedSelect.../option OPTION value=1test1/OPTION OPTION value=2test2/OPTION /selectnbsp;nbsp; p table cellpadding=5 cellspacing=1 tr tdFrom:/td td /td /tr tr tdTo:/td td /td /tr tr tdSubject:/td tdinput type=text size=38 name=subject value=/td /tr tr td colspan=2 table cellpadding=0 cellspacing=0 style=width:100%; tr td nowrapMessage:/td td align=right width:100%; nowrap /td /tr /table textarea name=thescript cols=101 rows=15/textarea /td /tr tr td
[PHP] Re: How to call image from mySql to php file
#ORIGINAL# I have a field in database called logos which has one value images/logos/some_logo.jpg In my php I am trying to call it in my php file as image. With this code. $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno'; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $logos=mysql_result($result,$i,logos); echo div p $logos /p /div; ?/div But getting errors. What is the way to call image in php file from the database. I know that this is a very basic question but first time for me. I ignored this in the begining but now its right infront of me. Please advice. #END ORIGINAL# There are two ways to store images in databases. First is that you upload your images to a directory and store path to that image in the database. In this case make sure that your field size is large enough to store the complete path. You can use the following code to retreive the image and display it. $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno' limit 1; $result=mysql_query($query); $num=mysql_numrows($result); if ( ! $result ) die(Unable to get records); while($row= mysql_fetch_array( $result )) { $image= $row[sno]; } mysql_close(); echo div img src='$logos' border='0' /div; The second method is a bit complicated. You store images in a binary field of database and when you retrieve the image, you retrieve it via proxy file e.g. image.php the image.php outputs the image using header ? header('Content-type: image/jpeg'); $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno' limit 1; $result=mysql_query($query); $num=mysql_numrows($result); if ( ! $result ) die(Unable to get records); while($row= mysql_fetch_array( $result )) { $image= $row[sno]; } mysql_close(); echo $logos; ? you can make call to it from you abc.html as follows div img src=image.php?sno=?=$_REQUEST['sno']? / /div -- Regards Fahad Pervaiz www.ecommerce-xperts.com (Shopping Carts, Framwork for Multilingual Web Sites, Web Designs)
[PHP] Information Portal
Hi Everyone, I am developing an Information Portal for my university, and I am looking a good solid framework. can you provide me with links, currently I am a bit confused and overwhelmed with lots of great stuff on net like drupal and Ruby on Rails If you could share your experience[if any on similar projects] I would be really thankful. -- Murtaza Chang http://flickr.com/photos/blackstallion/
Re: [PHP] Re: How to call image from mySql to php file
$query = mysql_query(SELECT logos FROM table WHERE sno = '$sno' limit 1) or die(mysql_error()); while ($result = mysql_fetch_array($query)) { $sno = $result[logos]; } ? img src=?php echo($sno); ?/img hope it helps - Original Message - From: Fahad Pervaiz [EMAIL PROTECTED] To: [EMAIL PROTECTED]; php-general@lists.php.net Sent: Friday, February 23, 2007 9:38 PM Subject: [PHP] Re: How to call image from mySql to php file #ORIGINAL# I have a field in database called logos which has one value images/logos/some_logo.jpg In my php I am trying to call it in my php file as image. With this code. $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno'; $result=mysql_query($query); $num=mysql_numrows($result); mysql_close(); $logos=mysql_result($result,$i,logos); echo div p $logos /p /div; ?/div But getting errors. What is the way to call image in php file from the database. I know that this is a very basic question but first time for me. I ignored this in the begining but now its right infront of me. Please advice. #END ORIGINAL# There are two ways to store images in databases. First is that you upload your images to a directory and store path to that image in the database. In this case make sure that your field size is large enough to store the complete path. You can use the following code to retreive the image and display it. $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno' limit 1; $result=mysql_query($query); $num=mysql_numrows($result); if ( ! $result ) die(Unable to get records); while($row= mysql_fetch_array( $result )) { $image= $row[sno]; } mysql_close(); echo div img src='$logos' border='0' /div; The second method is a bit complicated. You store images in a binary field of database and when you retrieve the image, you retrieve it via proxy file e.g. image.php the image.php outputs the image using header ? header('Content-type: image/jpeg'); $sno = $_REQUEST['sno']; $query=SELECT logos FROM table WHERE sno = '$sno' limit 1; $result=mysql_query($query); $num=mysql_numrows($result); if ( ! $result ) die(Unable to get records); while($row= mysql_fetch_array( $result )) { $image= $row[sno]; } mysql_close(); echo $logos; ? you can make call to it from you abc.html as follows div img src=image.php?sno=?=$_REQUEST['sno']? / /div -- Regards Fahad Pervaiz www.ecommerce-xperts.com (Shopping Carts, Framwork for Multilingual Web Sites, Web Designs) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php