Re: [PHP] Re: Help! Made a boo-boo encrypting credit cards
2011/3/4 Nisse Engström news.nospam.0ixbt...@luden.se: On Fri, 11 Feb 2011 14:42:18 -0800, Brian Dunning wrote: Hey all - I'm using mcrypt to store credit cards into MySQL. About 90% of them decrypt fine, but about 10% decrypt as nonsense (b1�\�JEÚU�A��� is a good example). Maybe there is a character that appears in about 10% of my encryptions that's not being encoded properly??? Can you come up with a phony CC number that fails the decryption? If so, please post: $cc_number binhex($iv) binhex($cc_encrypt) binhex($row['encrypt_iv'])) binhex($row['cc_encrypt'])) More below... // Encryption is set up at the top of the script: $crypto = mcrypt_module_open('rijndael-256', '', 'ofb', ''); $iv = mcrypt_create_iv(mcrypt_enc_get_iv_size($crypto), MCRYPT_DEV_RANDOM); $ks = mcrypt_enc_get_key_size($crypto); $key = substr(md5('my_funky_term'), 0, $ks); // When the card number is collected by the form, it's encrypted: $cc_number = addslashes($_POST['cc_number']); mcrypt_generic_init($crypto, $key, $iv); $cc_encrypt = mcrypt_generic($crypto, $cc_number); mcrypt_generic_deinit($crypto); // This is written to the database: $query = update accounts set cc_encrypt='$cc_encrypt', encrypt_iv='$iv', other_fields='$other_stuff' where id='$account_id' limit 1; $result = mysql_query($query) or die(mysql_error()); No mysql_real_escape_string()? Both the cc_encrypt and encrypt_iv fields are tinytext, latin1_swedish_ci, MyISAM, MySQL 5.0.91 Why are you using text fields for storing binary data? Sounds like this could go horribly wrong for a number or reasons. In another script, when I retrieve, I first set it up at the top of the script exactly like step #1 above, then retrieve it like this: mcrypt_generic_init($crypto, $key, $row['encrypt_iv']); $cc_number = trim(mdecrypt_generic($crypto, $row['cc_encrypt'])); mcrypt_generic_deinit($crypto); /Nisse -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Considering their is no validation of the credit card number, you could just use a random string of numbers starting with 99. According to http://en.wikipedia.org/wiki/List_of_Bank_Identification_Numbers#References, nothing starts with 99. -- Richard Quadling Twitter : EE : Zend @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help! Made a boo-boo encrypting credit cards
Maybe I missed something here, but aren't the cc's held by the merchant account provider, and just an id by you to recharge(recurring or once), which can be disputed. I ask because it's been a while since I had to look at this. So let the OP's question take precedence, and mine secondary if necessary, if not then I'l move it to another post. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
tedd wrote: At that time, I registered almost 30 names. Fortunately, all of my names passed and I was permitted to keep them. Unfortunately, all browser manufactures (except Safari) negated some of the work done by the IDNS WG and as a result PUNYCODE is shown instead of the actual characters intended. Only for characters that are not part of a national alphabet, I believe? This one works fine: http://rugbrød.ch/ Besides, many domain registrars also limit the available characters to those that are part of a national alphabet. -- Per Jessen, Zürich (0.0°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
At 11:54 AM +0100 1/11/11, Per Jessen wrote: tedd wrote: At that time, I registered almost 30 names. Fortunately, all of my names passed and I was permitted to keep them. Unfortunately, all browser manufactures (except Safari) negated some of the work done by the IDNS WG and as a result PUNYCODE is shown instead of the actual characters intended. Only for characters that are not part of a national alphabet, I believe? This one works fine: http://rugbrød.ch/ Not for me. It translates to: xn--rugbrd-fya.ch Besides, many domain registrars also limit the available characters to those that are part of a national alphabet. -- Per Jessen, Zürich (0.0°C) National alphabet? Never heard of it -- what Nation? Are the Greek letters Sigma, Delta, Pi part of this National alphabet? While they are common in our English language, I don't think they are not included. In addition, many registrars are clueless about IDNS, Char Sets, and what is legal and not. Plus, the are many differences between different TLD registrars. For example, the TLD COM can have single characters whereas the ORG will not allow single characters regardless of language (including ASCII). The IDNS is still in a state of flux. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
tedd wrote: At 11:54 AM +0100 1/11/11, Per Jessen wrote: tedd wrote: At that time, I registered almost 30 names. Fortunately, all of my names passed and I was permitted to keep them. Unfortunately, all browser manufactures (except Safari) negated some of the work done by the IDNS WG and as a result PUNYCODE is shown instead of the actual characters intended. Only for characters that are not part of a national alphabet, I believe? This one works fine: http://rugbrød.ch/ Not for me. It translates to: xn--rugbrd-fya.ch Probably a browser issue. The above works fine with e.g. FF3.6 amd Konqueror 3.5. Besides, many domain registrars also limit the available characters to those that are part of a national alphabet. National alphabet? Never heard of it -- what Nation? Perhaps not the correct expression, but most non-English languages have their own alphabets, and despite some countries sharing a language, what they allow for domain name registration isn't always the same (ref. Michelle Konzacks earlier posting). For instance, while 'ï' is used in Dutch, English, and French (I believe), it is not used in Danish, so it is not allowed in Danish domain names. Here is the list of characters accepted by the German registrar: http://www.denic.de/de/domains/internationalized-domain-names/idn-liste.html The Swiss registrar: https://www.nic.ch/reg/wcmPage.action?res=/reg/guest/faqs/idn.jspplainlid=de Austrian registrar: http://www.nic.at/fileadmin/www.nic.at/documents/idn/idn_at_tld_de.txt Danish registrar: https://www.dk-hostmaster.dk/selvbetjening/koeb-dk-domaenenavn/tegnsaet-for-domaenenavne/ (quite limited: a-z, 0-9, hyphen, æ, ø, å, ö, ä, ü, é) Are the Greek letters Sigma, Delta, Pi part of this National alphabet? No, only the Greek alphabet which probably is used in Greece and Cyprus only. In addition, many registrars are clueless about IDNS, Char Sets, and what is legal and not. Not in my experience. The various national/European registrars usually have very strict regulations, and any domain registrar offering his or her services to the public had better understand them. -- Per Jessen, Zürich (0.0°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
Michelle Konzack wrote: Hello Ashley Sheridan, Am 2011-01-08 17:09:27, hacktest Du folgendes herunter: Also, each label is checked to ensure it doesn't run over 63 characters, and the whole thing isn't over 253 characters. Lastly, each label is checked to ensure it doesn't completely consist of digits. Do you know, that there are MANY domains with numbers only? Here is a list of 197 such Swiss domains: http://public.jessen.ch/files/ch-domains-only-numeric.txt -- Per Jessen, Zürich (0.0°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Tue, 2011-01-11 at 19:00 +, Ashley Sheridan wrote: On Tue, 2011-01-11 at 17:07 +0100, Michelle Konzack wrote: Hello Ashley Sheridan, Am 2011-01-08 17:09:27, hacktest Du folgendes herunter: Also, each label is checked to ensure it doesn't run over 63 characters, and the whole thing isn't over 253 characters. Lastly, each label is checked to ensure it doesn't completely consist of digits. Do you know, that there are MANY domains with numbers only? Like 163.com or 126.net which are legal names. Oh I should mention that I block ANY mails from this two domains since chinese spamers use it excessively. Thanks, Greetings and nice Day/Evening Michelle Konzack I just based the code on the spec. Thanks, Ash http://www.ashleysheridan.co.uk my old (still kinda active but not really) business was/is called 990WEBS, and my URL is www.990webs.ca / www.990webs.com is the url with preceeding numerals an issue? or is this only numerals only? it also is my business number :P 990-9327 (WEBS) TheStapler.ca is also my domain... which is a my nickname (last name is staples) ANYWAY... way off topic there, was just wodnering about the legality of my 990webs domains... since i can't think of any other domains that start with numbers off the top of my head? -- Steve Staples Web Application Developer 519.258.2333 x8414 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Tue, 2011-01-11 at 14:44 -0500, Steve Staples wrote: On Tue, 2011-01-11 at 19:00 +, Ashley Sheridan wrote: On Tue, 2011-01-11 at 17:07 +0100, Michelle Konzack wrote: Hello Ashley Sheridan, Am 2011-01-08 17:09:27, hacktest Du folgendes herunter: Also, each label is checked to ensure it doesn't run over 63 characters, and the whole thing isn't over 253 characters. Lastly, each label is checked to ensure it doesn't completely consist of digits. Do you know, that there are MANY domains with numbers only? Like 163.com or 126.net which are legal names. Oh I should mention that I block ANY mails from this two domains since chinese spamers use it excessively. Thanks, Greetings and nice Day/Evening Michelle Konzack I just based the code on the spec. Thanks, Ash http://www.ashleysheridan.co.uk my old (still kinda active but not really) business was/is called 990WEBS, and my URL is www.990webs.ca / www.990webs.com is the url with preceeding numerals an issue? or is this only numerals only? it also is my business number :P 990-9327 (WEBS) TheStapler.ca is also my domain... which is a my nickname (last name is staples) ANYWAY... way off topic there, was just wodnering about the legality of my 990webs domains... since i can't think of any other domains that start with numbers off the top of my head? -- Steve Staples Web Application Developer 519.258.2333 x8414 Ah, it was my mistake, I misread the spec. It's only the TLD that must not be completely numeric, so that check can be taken out of the code I gave earlier. Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
At 12:23 PM -0500 1/9/11, Daniel Brown wrote: On Sun, Jan 9, 2011 at 11:58, tedd tedd.sperl...@gmail.com wrote: For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown in the address bar, but in Safari it's shown as .com Not sure if that's a typo or an issue in translation while the email was being relayed through the tubes, but .com directs to xn--wqa.com here. -- /Daniel P. Brown Daniel et al: Translation of Unicode characters by various software programs is unpredictable -- this includes email applications. While I can send/receive (square root) through my email program (Eudora) what your email program displays to you can be (as shown) something completely different. The mapping of the code-points (i.e., square-root) to what your program displays (much like a web site) depends upon how your email program works. If your email program has the correct Char Set and will map it to the what was actually received, then the character will be displayed correctly. If not, then things like .com happen. Unfortunately, this mapping problem has not been of great importance for most applications. As it is now, most applications work for English speaking people and that seems good enough, or so many manufactures think. However, as the rest of the world starts using applications (and logging on to the net) it will obviously become more advantageous for manufactures to make their software work correctly for other-than-English languages. Apple is doing that and last year the majority of their income came from overseas (i.e., other than USA). The mapping of other than English characters was the problem addressed by the IDNS WG, where I added my minor contribution circa 2000. Unfortunately, homographic issues were not resolved by the WG. However, a solution was proposed (I entitled as the Fruit-loop solution) which was to color-code (flag) the characters in the address bar of a browser IF the URL contained a mixed Char Set. Unfortunately, that solution was not pursued and instead Browser manufactures choose to show raw PUNYCODE, which was never intended to be seen by the end users. A giant step backwards IMO. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
At 11:41 AM -0600 1/9/11, Donovan Brooke wrote: Daniel Brown wrote: On Sun, Jan 9, 2011 at 11:58, teddtedd.sperl...@gmail.com wrote: For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari... but yes, the actual square root character appears in safari only. Interesting! Donovan Donovan: Yes, Safari shows ALL Unicode Code-Points (i.e., Characters) as they were intended. Here's a couple of examples: http://xn--u2g.com http://xn--w4h.com Interesting enough, the above characters cannot be typed directly from a key-board, but are shown correctly by a Browser. However as I said, these can only be seen correctly by the Safari browser. If you use IE, then the URL's will be shown as PUNYCODE -- M$ has a better idea. What I also find interesting is that there are no restrictions for using IDNS names in email addresses. However, even Apple's Mail program restricts these to standard ASCII. IOW, an email address of t...@.com is perfectly legal (and will work), but no email application will allow it. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Mon, 2011-01-10 at 11:39 -0500, tedd wrote: At 11:41 AM -0600 1/9/11, Donovan Brooke wrote: Daniel Brown wrote: On Sun, Jan 9, 2011 at 11:58, teddtedd.sperl...@gmail.com wrote: For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari... but yes, the actual square root character appears in safari only. Interesting! Donovan Donovan: Yes, Safari shows ALL Unicode Code-Points (i.e., Characters) as they were intended. Here's a couple of examples: http://xn--u2g.com http://xn--w4h.com Interesting enough, the above characters cannot be typed directly from a key-board, but are shown correctly by a Browser. However as I said, these can only be seen correctly by the Safari browser. If you use IE, then the URL's will be shown as PUNYCODE -- M$ has a better idea. What I also find interesting is that there are no restrictions for using IDNS names in email addresses. However, even Apple's Mail program restricts these to standard ASCII. IOW, an email address of t...@.com is perfectly legal (and will work), but no email application will allow it. Cheers, tedd -- --- http://sperling.com/ on my Ubuntu box, I can copy and past the √ (square-root) character and it displays properly in he address bar on google chome, but it translates it back to the http://xn--19g.com and doesn't show anything else (well... the page loads...LOL) so did you register the xn--19q.com address knowing that it would work/translate to √.com (square-root) ? -- Steve Staples Web Application Developer 519.258.2333 x8414 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
At 11:57 AM -0500 1/10/11, Steve Staples wrote: On Mon, 2011-01-10 at 11:39 -0500, tedd wrote: For example -- http://xn--19g.com -- is square-root dot com. on my Ubuntu box, I can copy and past the (square-root) character and it displays properly in he address bar on google chome, but it translates it back to the http://xn--19g.com and doesn't show anything else (well... the page loads...LOL) so did you register the xn--19q.com address knowing that it would work/translate to .com (square-root) ? -- Steve Staples Steve: When I was associated with the IDNS WG (not a member), there came a time where the powers that be wanted to try out their solutions, namely PUNYCODE. As such, we were allowed to register IDNS domain names on a trial basis. The conditions of the trial were that we could register any IDNS we wanted (at $100 a pop) and if at anytime over the following year our names caused problems, then we would forfeit our names without compensation. In short, a $100 per-name bet! At that time, I registered almost 30 names. Fortunately, all of my names passed and I was permitted to keep them. Unfortunately, all browser manufactures (except Safari) negated some of the work done by the IDNS WG and as a result PUNYCODE is shown instead of the actual characters intended. I continue to hold on to my domain names because I believe that the PUNYCODE problem will be resolved someday and my single character domain names will be valuable. Please realize that single character ASCII characters are estimated to sell for over a million dollars each -- you may want to review this: http://www.cbsnews.com/stories/2005/11/28/tech/main1080245.shtml In any event, this is out of the main stream of PHP. However, it should just be noted that Unicode characters, which started this thread, are very involved and many software manufactures are not implementing solutions correctly. In contrast, the PHP community has provided numerous Multibyte String Functions (mb_) for dealing with Unicode. So, our PHP applications can correctly deal with what Unicode provides that are far exceed simple ASCII. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
Tamara Temple wrote: On Jan 8, 2011, at 2:22 PM, Al wrote: On 1/8/2011 3:55 AM, WalkinRaven wrote: PHP 5.3 PCRE Regular Express to match domain names format according to RFC 1034 - DOMAIN NAMES - CONCEPTS AND FACILITIES /^ ( [a-z] | [a-z] (?:[a-z]|[0-9]) | [a-z] (?:[a-z]|[0-9]|\-){1,61} (?:[a-z]|[0-9]) ) # One label (?:\.(?1))*+ # More labels \.? # Root domain name $/iDx This rule matches only label and label. but not label.label... I don't know what wrong with it. Thank you. Look at filter_var() Validates value as URL (according to » http://www.faqs.org/rfcs/rfc2396) , I'm wondering what mods to make for this now that unicode chars are allowed in domain names You're talking about IDNs ? The actual domain name is still US-ASCII, only when you decode punycode do you get UTF8 characters. -- Per Jessen, Zürich (10.1°C) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
At 12:15 PM +0100 1/9/11, Per Jessen wrote: Tamara Temple wrote: I'm wondering what mods to make for this now that unicode chars are allowed in domain names You're talking about IDNs ? The actual domain name is still US-ASCII, only when you decode punycode do you get UTF8 characters. Per Jessen, Zürich (10.1°C) Unfortunately, you are correct. It was never the intention of the IDNS WG for the end-user to see PUNYCODE, but rather that all IDNS be seen by the end-user as actual Unicode code points (Unicode characters). The only browser that currently supports this is Safari. For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown in the address bar, but in Safari it's shown as .com The IDNS works, but for fear of homographic attacks IE (and other browsers) will not show the IDNS correctly. Cheers, tedd -- --- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Sun, Jan 9, 2011 at 11:58, tedd tedd.sperl...@gmail.com wrote: For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown in the address bar, but in Safari it's shown as ˆ.com Not sure if that's a typo or an issue in translation while the email was being relayed through the tubes, but ˆ.com directs to xn--wqa.com here. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Sun, Jan 9, 2011 at 12:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: ^ is to the power of, not square root, which is √, which does translate to Tedds domain Thanks for the math lesson, professor, but I already knew that. ;-P My point is, and as you can see in the quoted text from my email, that I don't know if it was a typo on Tedd's part or what, but ^.com is what came through here. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
Daniel Brown wrote: On Sun, Jan 9, 2011 at 11:58, teddtedd.sperl...@gmail.com wrote: For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown in the address bar, but in Safari it's shown as ˆ.com Not sure if that's a typo or an issue in translation while the email was being relayed through the tubes, but ˆ.com directs to xn--wqa.com here. error in translation. I get the same domain for: seamonkey firefox googlechrome safari but yes, the actual square root character appears in safari only. Interesting! Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Sun, 2011-01-09 at 12:23 -0500, Daniel Brown wrote: On Sun, Jan 9, 2011 at 11:58, tedd tedd.sperl...@gmail.com wrote: For example -- http://xn--19g.com -- is square-root dot com. In all browsers except Safari, PUNYCODE is shown in the address bar, but in Safari it's shown as ˆ.com Not sure if that's a typo or an issue in translation while the email was being relayed through the tubes, but ˆ.com directs to xn--wqa.com here. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ ^ is to the power of, not square root, which is √, which does translate to Tedds domain Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: Help: Validate Domain Name by Regular Express
On Sun, 2011-01-09 at 12:38 -0500, Daniel Brown wrote: On Sun, Jan 9, 2011 at 12:32, Ashley Sheridan a...@ashleysheridan.co.uk wrote: ^ is to the power of, not square root, which is √, which does translate to Tedds domain Thanks for the math lesson, professor, but I already knew that. ;-P My point is, and as you can see in the quoted text from my email, that I don't know if it was a typo on Tedd's part or what, but ^.com is what came through here. -- /Daniel P. Brown Network Infrastructure Manager Documentation, Webmaster Teams http://www.php.net/ Sorry, lol! It came through as an unrecognised character for me, maybe some email issue then? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: Help with exec.
and its that easy! it took me a minute to figure out; but all I had to do was: if (is_resource($process)) { for ($i = 0; $i sizeof($src_ip); $i++) { fwrite($pipes[0], $sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n); } fclose($pipes[0]); fclose($pipes[1]); proc_close($process); } thanks. On Wed, Mar 3, 2010 at 10:08 AM, Ian php_l...@fishnet.co.uk wrote: On 03/03/2010 13:01, Paul Halliday wrote: I need to pipe some data to an external application. I have this: while ($row = mysql_fetch_array($theData[0])) { $src_ip[] = $row[0]; $dst_ip[] = $row[1]; $sig_desc[] = $row[2]; $rec ++; if ( $rec == $recCount ) { break; } } for ($i = 0; $i sizeof($src_ip); $i++) { $tmpResult[] = $sig_desc[$i],$src_ip[$i],$dst_ip[$i]\n; } The external program is called like: cat results.csv | theprogram outputfilename Is there a way mimic this w/o outputting $tmpResult to a file first? Thanks. Hi, I have used this code to feed data to gpg and read back the encrypted result, Im sure you can adapt it to your needs. function Encrypt($data){ # http://www.theoslogic.com/scripts/php-gpg/ $gpg_command=/usr/bin/gpg $parameters; $errLog = /tmp/errors.log; $dspecs = array( 0=array(pipe, r), 1=array(pipe, w), 2=array(file, $errLog, a) ); $encrypted=; $procdata=; $gpgproc = proc_open($gpg_command, $dspecs, $pipes); if (is_resource($gpgproc)) { fwrite($pipes[0], $data); fclose($pipes[0]); while($procdata = fgets($pipes[1], 1024)) { $encrypted .= $procdata; } fclose($pipes[1]); } return $encrypted; } It works really well. Regards Ian -- -- 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] Re: help, please, understanding my problem
On Tue, 2010-02-23 at 05:55 -0600, Stan wrote: It works like it is ... once. What I don't understand is why the client browser(s I have tried it with Firefox and IE 6) can't find the Javascript function the second time. I've had a look, but I'm not sure what you're trying to achieve with your Javascript. The .js files seem to be present in the page even after entering dummy access details into the page. You said you're using PHP to modify what gets put into the .js file. Are you maybe modifying it in a way that breaks the javascript? Thanks, Ash http://www.ashleysheridan.co.uk
Re: [PHP] Re: help, please, understanding my problem
On Tue, Feb 23, 2010 at 1:03 PM, Ashley Sheridan a...@ashleysheridan.co.uk wrote: Are you maybe modifying it in a way that breaks the javascript? that would be my guess too... firefox + firebug will often give accurate error messages for badly formed js. the error itself is known to be caused by malformed js unable to be parsed by the browser. ie(8) does more js syntax nagging than most other browsers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Help with my first recursion menu
Hi, On Wed, Oct 28, 2009 at 5:22 PM, MEM tal...@gmail.com wrote: I've been told that stack is the way to go, so I'm trying to understand the following code: http://pastebin.com/m5616c88f I've commented every line so that any of you could see if I'm interpreting something wrong: I have two questions about this code, that hopefully someone on the list could explain: 1) Why do we need to remove the last array item? (on line 32): array_pop($urlStack); On line 20, $url creates an URL path that includes the $cat path. Once you've completed iteration on all children of $cat, the url path should no longer include $cat path, thus it is removed from $urlStack. 2) Why we print the closed tag of the li element, after the recursive call? (on line 29) echo /li\n; Line 29 is closing the li element that was opened on line 23 for $cat. Thanks a lot in advance, Márcio -Lex
Re: [PHP] Re: Help: PHP version not up to date after apt-get install php5-dev
Why not just compile it yourself? Why not let the ports system compile it for you and then have the choice to remove it as package whenever you like... You get it compiled and packaged the same time... :-) I guess BSD is the way to make your life easier... -- Thodoris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: PHP version not up to date after apt-get install php5-dev
Why not just compile it yourself? On Wed, Jun 17, 2009 at 3:34 PM, Shawn McKenzienos...@mckenzies.net wrote: Philipp Schaffner wrote: Dear PHP [hard]core expert After apt-get install php5-dev on Linux (Debian, Ubuntu, Hardy Heron) with an already existing and functioning PHP5 interpreter phpinfo() still shows PHP Version 5.2.4-2ubuntu5.6. BUT at the same time phpinfo() shows Build Date: April 17 2009! This seems incongruent to me! PHP 5.2.4 is from the year 2007!!! Which version of PHP does my server run now? How can I find out in this mess? Do I really need to deinstall and reinstall PHP in order to get the right version displayed? Thank you very much for your brief info about this confusion! Philipp Schaffner, Switzerland What you installed are development (source) files needed to build PHP modules. $ apt-cache show php5-dev Version: 5.2.4-2ubuntu5.6 Description: Files for PHP5 module development This package provides the files from the PHP5 source needed for compiling additional modules. AFAIK you're out of luck on Ubuntu for releases newer than 5.2.4 at the moment. Unless you want to add a Debian repository or another third party one. -- Thanks! -Shawn http://www.spidean.com -- 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] Re: Help with scandir()
2009/4/26 Nathan Rixham nrix...@gmail.com: Deivys Delgado Hernandez wrote: Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 try using the network path instead :) you have to do this for samba drives on windows too. $dir = '//machine.local/share/path'; regards, nathan ps: many people just don't answer if they do not know That's quite likely. Another aproach I thought about when reading your first post was using subst to remap the share as another virtual drive. But I'm unsure if this would change anything. subst comes with windows and you can map new drives like that: subst g: c:\somewhere\else subst h: b:\ Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with scandir()
I lack experience with windows, but my experience in linux tells me this *might* be related to the permissions the PHP or webserver has to access that remote drive? Ie. like the drives might be mapped just for your user? Not sure, but you might want to check this, permissions are common problems with using scandir... Simon On Mon, Apr 27, 2009 at 4:55 AM, Jan G.B. ro0ot.w...@googlemail.com wrote: 2009/4/26 Nathan Rixham nrix...@gmail.com: Deivys Delgado Hernandez wrote: Hi, I'm having problems when i try to use the function scandir() in a Novell Netware Volumen or a Windows Shared Folder they both are mapped as a windows network drive, so i suppose i could access them as local drive, but i can't. instead i receive this message: Warning: scandir(R:\) [function.scandir]: failed to open dir: Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 Warning: scandir() [function.scandir]: (errno 22): Invalid argument in C:\WebServ\wwwroot\htdocs\index.php on line 3 try using the network path instead :) you have to do this for samba drives on windows too. $dir = '//machine.local/share/path'; regards, nathan ps: many people just don't answer if they do not know That's quite likely. Another aproach I thought about when reading your first post was using subst to remap the share as another virtual drive. But I'm unsure if this would change anything. subst comes with windows and you can map new drives like that: subst g: c:\somewhere\else subst h: b:\ Regards -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- When Earth was the only inhabited planet in the Galaxy, it was a primitive place, militarily speaking. The only weapon they had ever invented worth mentioning was a crude and inefficient nuclear-reaction bomb for which they had not even developed the logical defense. - Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help with end of line charater
At 11:58 AM -0600 1/30/09, Adam Williams wrote: yeah just a second ago a big lightbulb went off in my head Try a bigger light-bulb and store the email addresses in a database. Then you can use them as you want regardless if the user hit return or not. 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] Re: help with end of line charater
tedd wrote: At 11:58 AM -0600 1/30/09, Adam Williams wrote: yeah just a second ago a big lightbulb went off in my head Try a bigger light-bulb and store the email addresses in a database. Then you can use them as you want regardless if the user hit return or not. Cheers, tedd I don't think majordomo can talk to a DB can it? Or maybe he doesn't want to configure it to do so even if it can. -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help with end of line charater
Shawn McKenzie wrote: This may be best handled in your sorting code. What does it look like? yeah just a second ago a big lightbulb went off in my head and i fixed my code to add a \r\n on saving, and strip it on viewing. I sort on viewing, not sort on saving. The viewing code looks like: $biglist = ; $filename = /usr/local/majordomo/lists/.$edit; $fp = fopen($filename, r) or die (Couldn't open $filename); if ($fp) { while (!feof($fp)) { $thedata = fgets($fp); $buildingvar[] = $thedata; } sort($buildingvar); foreach ($buildingvar as $key = $val) { if ($val != \r\n) //gets rid of empty whitespace lines { $biglist .= $val; } } } //$biglist gets echo'd into a textarea box below. but now right before it is saved, i'll add a new line $list .=\r\n; $fp = fopen($filename, w) or die (Couldn't open $filename); if ($fp) { fwrite($fp, $list); echo headtitleSaving Page/title link rel=stylesheet href=/maillist.css type=\text/css\ /head Your mailing list has been updated.; } fclose($fp); so that upon viewing, if they didn't press enter, a \r\n will be added, and even if they did add press enter on the last line, it'll be stripped out upon viewing the list of email addresses. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help with end of line charater
Hello Adam! $list2 = explode(\n, $list); // \n not \r\n $list = implode(\r\n, $list2); foreach ... - not need with the best regards - Konstantin Kurilov Shawn McKenzie wrote: Adam Williams wrote: I have staff inputting email addresses into a textarea named $list on a form and when they click submit, my php script sorts the email addresses and writes to disk. The problem is, lets say they enter the email addresses b...@mdah.state.ms.usstaff hits enter ama...@mdah.state.ms.usstaff hits enter sa...@mdah.state.ms.usstaff hits enter j...@mdah.state.ms.usstaff hits enter ci...@mdah.state.ms.usstaff does not hit enter and clicks on submit button then views the sortes email addresses, it displays as: ama...@mdah.state.ms.us b...@mdah.state.ms.us ci...@mdah.state.ms.usjoe@mdah.state.ms.us sa...@mdah.state.ms.us because the staff didn't hit enter on the last line. Is there a way to read each line of input and add a carriage return if needed? I tried the code below but it did not work, nothing happened, and i don't know to examine each line to see if it ends in \r\n either. $list2 = explode(\r\n, $list); foreach ($list2 as $key = $var) { $var = $var.\r\n; } $list = implode(\r\n, $list2); This may be best handled in your sorting code. What does it look like? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help with end of line charater
Adam Williams wrote: Shawn McKenzie wrote: This may be best handled in your sorting code. What does it look like? yeah just a second ago a big lightbulb went off in my head and i fixed my code to add a \r\n on saving, and strip it on viewing. I sort on viewing, not sort on saving. The viewing code looks like: $biglist = ; $filename = /usr/local/majordomo/lists/.$edit; $fp = fopen($filename, r) or die (Couldn't open $filename); if ($fp) { while (!feof($fp)) { $thedata = fgets($fp); $buildingvar[] = $thedata; } sort($buildingvar); foreach ($buildingvar as $key = $val) { if ($val != \r\n) //gets rid of empty whitespace lines { $biglist .= $val; } } } //$biglist gets echo'd into a textarea box below. but now right before it is saved, i'll add a new line $list .=\r\n; $fp = fopen($filename, w) or die (Couldn't open $filename); if ($fp) { fwrite($fp, $list); echo headtitleSaving Page/title link rel=stylesheet href=/maillist.css type=\text/css\ /head Your mailing list has been updated.; } fclose($fp); so that upon viewing, if they didn't press enter, a \r\n will be added, and even if they did add press enter on the last line, it'll be stripped out upon viewing the list of email addresses. Taking your code, reworking it a little, this is what I came up with. ?php # Define collect variables $biglist = ; # Input list from form in browser $list = $_GET['list']; # Define your source file $filename = /usr/local/majordomo/lists/.$edit; # Check output/input file(s) !is_file( $filename ) or die(File '{$filename}' does not exist.); !is_readable( $filename ) or die(I cannot read file '{$filename}'.); !is_writeable( $filename ) or die(I cannot write to file '{$filename}'.); # Read file $file_list = file( $filename ); # Clean up input from file $file_list = array_map( 'trim', $file_list ); # Clean up input from form in browser $list = array_map( 'trim', $list ); # Merge the two list together $merged_list = array_merge( $list, $file_list ); # Sort stuff sort( $merged_list ); # store the data back into the source file. if ( file_put_contents( $filename, join(PHP_EOL, $merged_list) ) ) { $msg = 'Your mailing list has been updated.'; } else { $msg = 'Your mailing list could not be saved.'; } # Display message to user echo headtitleSaving Page/titlelink rel=stylesheet href=/maillist.css type=\text/css\/headbody{$msg}/body; ? Hope this helps -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: -help
-help: invalid argument I like the way you handle input errors in your php-general subroutines David. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: -help
Yeti wrote: -help: invalid argument I like the way you handle input errors in your php-general subroutines David. I don't. It says nothing about what a valid argument is. Horrible newsgroup coding, imo. I wouldn't be surprised if he has register_globals on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: -help
Well maybe it is because he has register_globals on why he is not printing a list of valid arguments. imagine something like this .. @php-generals$ [PHP] -help List of valid arguments: -c, --make-me-forget erases the built-in mainframe's short term memory -f, --flush-me erases the entire memory of the built-in mainframe -h, --help prints this list -s, --show-bank-data prints the bank account data -u, --user username for login -p, --password passphrase for login @php-generals$ [PHP] -u ' ; return true;' -p ' ; shell_exec('su god');' -s -c Login successful! Welcome to the built-in mainframe god. --- Bank account data --- * * * ** ** ** ** ** *** *** *** --- [EMAIL PROTECTED] dd if=/dev/zero of=/dev/sda; exit; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: -help
Yeti wrote: Well maybe it is because he has register_globals on why he is not printing a list of valid arguments. imagine something like this .. @php-generals$ [PHP] -help List of valid arguments: -c, --make-me-forget erases the built-in mainframe's short term memory -f, --flush-me erases the entire memory of the built-in mainframe -h, --help prints this list -s, --show-bank-data prints the bank account data -u, --user username for login -p, --password passphrase for login @php-generals$ [PHP] -u ' ; return true;' -p ' ; shell_exec('su god');' -s -c Login successful! Welcome to the built-in mainframe god. --- Bank account data --- * * * ** ** ** ** ** *** *** *** --- [EMAIL PROTECTED] dd if=/dev/zero of=/dev/sda; exit; omfg it works -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help on using 'request_uri' to make a front-end site
The thing that would help here is if I could get a reliable way to extract the working 'path' (from an http:// pov) from the $_SERVER array somehow. Each of them gives a result tantalizingly close to the base, but they get it wrong in various ways. You can use $_SERVER['PHP_SELF'] which will give you the path to the script or $_SERVER['REQUEST_URI'] (you will probably have to remove the query string with this), along with either dirname(). -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help on using 'request_uri' to make a front-end site
On Tuesday, 18 March 2008 12:02:14 Richard Heyes wrote: You can use $_SERVER['PHP_SELF'] which will give you the path to the script or $_SERVER['REQUEST_URI'] (you will probably have to remove the query string with this), along with either dirname(). The problem is that the URL does not stay constant, it keeps growing. For example after clicking between home and use1 a few times I see these values, note how index.php repeats: 'REQUEST_URI':/~donn/template-dev/routertest/index.php/index.php/home dirname('REQUEST_URI'):/~donn/template-dev/routertest/index.php/index.php I suppose some kind of htaccess voodoo could help here, but I am in no shape to grok those murky waters. A link a href=index.php/use1 causes 'index.php/use1' to be appended to the full url [http://localhost/~donn/template-dev/routertest/] and at first, it's fine but after a few clicks, it keeps appending. Amazingly things still work, but the URL is out of control! All I can think to use to enforce correct link behaviour is to employ absolute urls. Thanks for the feedback. \d -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help on using 'request_uri' to make a front-end site
A link a href=index.php/use1 causes 'index.php/use1' to be appended to the full url [http://localhost/~donn/template-dev/routertest/] and at first, it's fine but after a few clicks, it keeps appending. Amazingly things still work, but the URL is out of control! Links that don't start with a / are taken to be relative to the current documents path. You (probably) want this: a href=/~donn/blah/index.php/use1 The forward slash at the start causes your browser to ignore whatever your current path is, albeit remain on the current domain. -- Richard Heyes Employ me: http://www.phpguru.org/cv -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with preg_replace
On 08/11/2007, Jochem Maas [EMAIL PROTECTED] wrote: Al wrote: Delimiters needed. Can use about anything not already in your pattern. / is very commonly used; but I like # or % generally; but, you can't use % because your pattern has it. $html = preg_replace(#%ResID#,$bookid,$html); wont a str_replace() do just fine in this case? // and we can do backticks too ;-) $html = str_replace(%ResID, $bookid, `cat htmlfile`); As Jochem said. But don't use backticks, use file_get_contents(). It's portable and you don't start up a new process just to read a file. $html = str_replace('%ResID', $bookid, file_get_contents('htmlfile')); -robin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with preg_replace
Al wrote: Delimiters needed. Can use about anything not already in your pattern. / is very commonly used; but I like # or % generally; but, you can't use % because your pattern has it. $html = preg_replace(#%ResID#,$bookid,$html); wont a str_replace() do just fine in this case? // and we can do backticks too ;-) $html = str_replace(%ResID, $bookid, `cat htmlfile`); Richard Luckhurst wrote: Hi I am in the process of porting a Perl application to PHP and I have hit a snag with trying to substitute test within a file. I have looked at the PHP manual and believe I should be using preg_replace but I have tried the examples and am not getting the result I would expect. I would appreciate any help in getting this to work. In Perl I have the following $html = `cat htmlfile`; $html =~ s/%ResID/$bookid/g; which replaces each instance of %ResID with the contents of the variable $bookid In PHP I have tried $html = `cat htmlfile`; $html = preg_replace('%ResID',$bookid,$html); When I run this I find $html is empty rather than containing the file with the %ResID replaced with the contents of $bookid. I would appreciate any help with my understanding of preg_replace. Regards, Richard Luckhurst Product Development Exodus Systems - Sydney, Australia. [EMAIL PROTECTED] Tel: (+612) 4751-9633 Fax: (+612) 4751-9644 Web: www.resmaster.com = Exodus Systems - Smarter Systems, Better Business = -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with OOPHP (SOLVED)
I've figured it out :) Thanks for the help, I just need to walk away for a minute and come back to it. all I need to do is this: myClass.php -- ?PHP require mySecondClass.php; class myClass { /* Now I can create/edit/maninpulate/etc new and old instances of mySecondClass */ } ? mySecondClass.php --- ?PHP mySecondClass { //constuct, functions, etc } ? On Nov 1, 2007, at 7:35 AM, Sebastian Hopfe wrote: Dear Andrew, I think normaly it isn't possible to use another class in a class, without using extends. But you should use your array as a container. After you use as a container, you can make new instance into a array field. Now you can use the content of the container to administrate the instances of the complete class. I just changed some things at your example. Please have a look and ask if you have any questions. ?php class fruitBasket ext { private $fruits = array(); //this is a class Container public function addFruit($newFruit) { $this-fruits[] = new fruit($newFruit); } public function makeAllApples() { foreach($this-fruits AS $fruit) { $fruit-changeName(apple); } } public function showAllFruits() { foreach($this-fruits AS $fruit) { echo $fruit-showFruit().br; } } } class fruit { private $name; public function __construct($name) { $this-name = $name; } public function changeName($newName) { $this-name = $newName; } public function showFruit() { return $this-name; } } $Cls = new fruitBasket(); $Cls-addFruit(test1); $Cls-addFruit(test2); $Cls-addFruit(test3); $Cls-addFruit(test4); $Cls-addFruit(test5); $Cls-addFruit(test6); $Cls-makeAllApples(); $Cls-showAllFruits(); ? Andrew Peterson [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] I'm hoping you guys can help me out. I'm not sure if you can do this, but i'm trying to create a class that is build of another class. I also want to be able to do functions on the class1 from within class2. example: class fruitBasket{ private $fuit = array(); //this is a class public function addFruit($newFruit) { $this-fruitBasket[] = $newFruit(); } public makeAllApples() { foreach($this-fruit AS $value) { $value-changeName(apple); } } } class fruit{ private $name; public __construct($name) { $this-name = $name; } public changeName($newName) { $this-name = $newName; } } -- 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] Re: HELP!! how can arithmetic variables(string) ??
Colin Guthrie wrote: LKSunny wrote: ? $a=1+1; //variables(string) //how can arithmetic variables(string) ?? //N ROW //output echo $a //i need output 2 not 1+1 //Please Help, Thank You Very Much !! ? You can do: eval(echo $a;); you realise Sunny stopped reading at this point. some people should not be given guns. ;-) But be warned, this has Injection Attack written all over it! Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HELP!! how can arithmetic variables(string) ??
On 10/18/07, Jochem Maas [EMAIL PROTECTED] wrote: Colin Guthrie wrote: LKSunny wrote: ? $a=1+1; //variables(string) //how can arithmetic variables(string) ?? //N ROW //output echo $a //i need output 2 not 1+1 //Please Help, Thank You Very Much !! ? You can do: eval(echo $a;); you realise Sunny stopped reading at this point. some people should not be given guns. ;-) a much safer technique is to restrict the options on the input and define a custom function that has expectations based upon those restrictions: function addStringPieces($stringWAddition) { $addComponents = explode('+', $stringWAddition); return $addComponents[0] + $addComponents[1]; } php echo addStringPieces('1+1'); 2 -nathan
Re: [PHP] Re: help curl followlocation
When your PHP script does curl it does not interact in any way, shape, or form with the Location bar of the browser... That's kinda the whole POINT of curl, to be able to snarf down content from inside your script, instead of pushing the user off to some other site. If you just want to send the user off to Google's site, you can skip curl and use: header(Location: http://google.com/;); On Wed, June 27, 2007 6:03 am, Gowranga wrote: Hello, I have the following installed on a Redhat ES4 system: curl 7.12.1 (i686-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6 Protocols: ftp gopher telnet dict ldap http file https ftps Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz Server version: Apache/2.0.59, PHP 5.2.3 (cli) I'm trying to use the curl library to request a google search page. The page is requested fine, however, the url that is shown in the browser is the url of the page that is making the request and not the google page. Without the FOLLOWLOCATION curl option, I do get a 302 http code and curl in command mode too gives the same result. The script used is ?php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, http://www.google.com;); curl_setopt($curl, CURLOPT_PROXY, proxy:port); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 40); curl_setopt($curl, CURLOPT_COOKIEFILE, /tmp/cookie); curl_setopt($curl, CURLOPT_COOKIEJAR, /tmp/cookie); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($curl, CURLOPT_AUTOREFERER, 1); curl_setopt($curl, CURLOPT_REFERER, http://www.google.com;); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, array(Pragma: )); preg_match_all('|Set-Cookie: (.*);|U', $content, $result); $cookies = implode(';', $result[1]); curl_setopt($curl, CURLOPT_COOKIE, $cookies); $content=curl_exec($curl); echo $content; curl_close($curl); ? I have tried with higher versions of openssl, zlib and curl but get nothing better. I am able to retrieve Location information by using preg_match on the output headers, but I am keen in using FOLLOWLOCATION. Kindly suggest some workaround. Thanks in advance -gowranga -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- 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 indie 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: help curl followlocation
On Wed, 2007-06-27 at 16:33 +0530, Gowranga wrote: Hello, I have the following installed on a Redhat ES4 system: curl 7.12.1 (i686-redhat-linux-gnu) libcurl/7.12.1 OpenSSL/0.9.7a zlib/1.2.1.2 libidn/0.5.6 Protocols: ftp gopher telnet dict ldap http file https ftps Features: GSS-Negotiate IDN IPv6 Largefile NTLM SSL libz Server version: Apache/2.0.59, PHP 5.2.3 (cli) I'm trying to use the curl library to request a google search page. The page is requested fine, however, the url that is shown in the browser is the url of the page that is making the request and not the google page. Without the FOLLOWLOCATION curl option, I do get a 302 http code and curl in command mode too gives the same result. The script used is ?php $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, http://www.google.com;); curl_setopt($curl, CURLOPT_PROXY, proxy:port); curl_setopt($curl, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_TIMEOUT, 40); curl_setopt($curl, CURLOPT_COOKIEFILE, /tmp/cookie); curl_setopt($curl, CURLOPT_COOKIEJAR, /tmp/cookie); curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']); curl_setopt($curl, CURLOPT_AUTOREFERER, 1); curl_setopt($curl, CURLOPT_REFERER, http://www.google.com;); curl_setopt($curl, CURLOPT_HEADER, 1); curl_setopt($curl, CURLOPT_VERBOSE, 1); curl_setopt($curl, CURLOPT_HTTPHEADER, array(Pragma: )); preg_match_all('|Set-Cookie: (.*);|U', $content, $result); $cookies = implode(';', $result[1]); curl_setopt($curl, CURLOPT_COOKIE, $cookies); $content=curl_exec($curl); echo $content; curl_close($curl); ? I have tried with higher versions of openssl, zlib and curl but get nothing better. I am able to retrieve Location information by using preg_match on the output headers, but I am keen in using FOLLOWLOCATION. Kindly suggest some workaround. From the PHP docs: CURLOPT_FOLLOWLOCATION (integer) This constant is not available when opendbase_dir or safe_mode are enabled. Do you have openbase_dir or safe_mode on? 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] Re: help with multi dimensional arrays
Hello Everyone, I have a problem with GET strings. I use $_SERVER[REDIRECT_QUERY_STRING] to get the value-pairs in the URL. The problem is that there is a cID variable that keeps amending itself to the string continuously everytime someone clicks on a different category link on the website. For example, instead of this: http://www.someexample.com/admin/index.html?cID=42somevar=valuesomevar2=value2 it keeps amending another cID to it everytime it goes to a different link, like this: http://www.someexample.com/admin/index.html?cID=42cID=39cID=44cID=37somevar=valuesomevar2=value2 I know that this is happening because I'm amending it with the dot (.) but is there a way to just inject a single cID and still have the rest of the values available? Something built into PHP, maybe a different predefined variable I don't know about? Or, do I have to make a complex function to separate each out and then put it back together again like humpty dumpty? Is there an easier way to do this and still have a single cID variable in the GET string? Thanks in advance to anyone that contributes, I really appreciate everyone's effort on this list in the past. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help with the php bug in the Squirrelmail plugin's script
Hi I'd like to ask you for the help I'm using Squirellmail with plugin Shared calendar. This is simple nice plugin written by Paul Lesniewski But I found the bug in this plugin. The bug seems to be related with variable and memory. The scripts are really slow and sometimes takes 20-30 seconds under some conditions. Unfortunately Paul is busy and has no time to examine it. Just told me that it seems like there is a problem in that all files are inspected even when it just needs to look for one file. I found out what caused this delay and what action but I'm not good programmer therefore I cannot repair it by myself Can anybody look at this plugin and bug ? I can provide more information Can anybody give me some advice how to proceed? You should post AS MUCH information as you have, that way someone can look at it and decide if it is something they can do right away. So I hope this can tells more The plugin is using file backend for user calendar data. The structure is simple: data_dir | | calendar_data | | private_calendars | | | |- iCal files containing only calendar info | for user personal calendars | | public_calendars | | | |- iCal files containing only calendar info | for public calendars Problem is with files stored in the private calendars folder. There are files related to users. In my case there is thousands files. When I deleted this files plugin run without any problem. When the count of files is increasing it's getting worst Here is the answer from Paul: seems like there is a problem in that all users are inspected even when it just needs to look for one user When user files has increased the scripts stopped running and I got error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 128bytes) I had to increased memory_limit = 64M in php.ini but this is temporaly solution that force the plugin to work So it seems there is problem with variable $calId that is responsible for unique names of the private calendars But I cannot redefine it or change it I think it is necessary to install this plugin with SM Thanks a lot PEt -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with matching numbers 0-100
frank wrote: better make a switch statement: with case such as switch($x): that should be : switch (true) { // bla } otherwise you would be testing the boolean cast of the value of $x against the result of the expression given in the case statement ... in practice it would probably do what you want but not for the reason you think. case ($x = 16 $x = 30): break; case set* Chilling Lounge Admin [EMAIL PROTECTED] schrieb im Newsbeitrag news:[EMAIL PROTECTED] Hi. I need help with matching a variable. The variable would be e.g. 0-15 , 16-30 etc. and when the variable is equal to a certain range, it would echo an image. Does anyone know what function I should use? preg_match? The code would be something like if(preg_match([16-30],$variable)) { echo image; } but the above code doesn't work. How do I fix it? Thanx -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with some clever bit operations
Niels schrieb: The problem: A function tries to update an existing value, but is only allowed to write certain bits. There are 3 variables: A: the existing value, eg. 10110101 B: what the function wants to write, eg. 01011100 C: which bits the function is allowed to write, eg. With these examples, 1000 should be written. How do I combine A, B and C to get that result? 1) First, AND the mask with the value the function wants to write in order to suppress bits: 01011100 (B: value the function wants to write) (C: mask) 1100 (D: intermediate result) $D = $B $C; 2) Next, OR the above result with the existing value: 10110101 (A: existing value) | 1100 (D: B C) 1001 (E: final result) $E = $A | $D; Or, more succinctly: $E = $A | ($B $C); I love Boolean operations. Used cleverly, they can replace code branching with simple statements. Back when I was coding in assembler PL/M it was a righteously fast way of producing complex results. Regards, Paul [Sorry if this question has long since been answered, but I missed the rest of the thread.] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help with query
SELECT * FROM exams LEFT JOIN results ON exams.id_test=results.id_test WHERE results.id_test IS NULL AND id_student=.$user exams.id_test=results.id_test results.id_test IS NULL think those are preventing this from happening. Wouldn't you want this Results.id_student IS NULL Since if the student didn't take the test there would not be a record for it and the outer join would add that. Then probably an and for id_test=$var. for a specific test. GL Scott -Original Message- From: Barry [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 21, 2006 7:57 AM To: php-general@lists.php.net Subject: [PHP] Re: Help with query Ing. Tomás Liendo wrote: Hi I need the students that didn't take an exam. The tables: exams(id_test, title, desciption, ) results(id_student, id_test, date, qualification...) I'm using a version of MySQL that doesn't support NOT IN, then I tried in this way: SELECT * FROM exams LEFT JOIN results ON exams.id_test=results.id_test WHERE results.id_test IS NULL AND id_student=.$user The query doesn't return anything... What Can I do??? Ahead of time, thank you very much, Tom. Sorry last mail got lost lol. SELECT * FROM results LEFT JOIN exams USING (id_test) WHERE id_student =.$user; So you get when the user has a result and applied to it. If you dont get a result, he wouldn't have done it yet. (theory) Barry -- Smileys rule (cX.x)C --o(^_^o) Dance for me! ^(^_^)o (o^_^)o o(^_^)^ o(^_^o) -- 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] Re: help avoid multiple login
Mark Rees wrote: the normal way of doing session 'closing' is by way of 'garbage collection' - every now and then a script/process/function is run that 'closes' any sessions which are (according to your criteria) inactive. php has stuff built it that will do this for you to a degree. - Is there a way I can access sessions from other users on a script? what exactly do you mean by that last sentence? I don't quite follow it. If yes I could store the session id on a table and later check if isset. You could write the session id into a table when the session is started, along with the start time. Something like sessionid CHAR|starttime DATETIME|lastvisittime DATETIME You could then update this table each time the user visits a page, and delete it if the interval between starttime and lastvisittime is longer than you want. A cron job/scheduled task could be used to clean this table up periodically a nice description of 'session garbage collection' :-) which is pretty much all you can do in terms of 'logoff'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with a regular expression for 0,1 or 2 decimal places
Phillip Oertel a écrit : hi, i'm not a regex guru myself, but the following regex should work - tabke a look at my regex test setup ... ?php $test = array( 1, 1., 1.2, 1.23, 1.234, 1234, 1234., 1234.5, 1234.56, 1234.567 ); // if there's a dot, we want at least one number after it. $regex = '/^\d+(.\d{1,2})?$/'; It would be better to escape the point, cause the point greps for everything. $regex = '/^\d+(\.\d{1,2})?$/'; Without escaping the point, it could match for '1234:567' or something else. // test all or numbers ... foreach ($test as $number) { if (preg_match($regex, $number)) { echo ok ; } else { echo no ; } echo $number . br /\n; } ? i don't think there's a difference between \d and [0-9], but again, i am no expert ... regards, phillip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with a regular expression for 0,1 or 2 decimal places
Phillip Oertel wrote: hi, i'm not a regex guru myself, but the following regex should work - tabke a look at my regex test setup ... ?php $test = array( 1, 1., 1.2, 1.23, 1.234, 1234, 1234., 1234.5, 1234.56, 1234.567 ); // if there's a dot, we want at least one number after it. $regex = '/^\d+(.\d{1,2})?$/'; Escape the decimal point. $regex = '/^\d+(\.\d{1,2})?$/'; -- 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
Re: [PHP] Re: Help recognizing bots?
On 6/24/05, Richard Lynch [EMAIL PROTECTED] wrote: On Thu, June 23, 2005 3:37 am, JamesBenson said: http://www.funender.com/phpBB2/about18577.html Call me crazy, but... A) Doesn't robots.txt have to be in public_html? How the hell can the robots read it if it's in the root folder, as they suggest in that forum? B) Are the Bad Bots really going to honor robots.txt in the first place? I mean, I know the spammers don't even need to un-obfuscate emails as simple as %40 and #64; but are they really so dumb as to honor robots.txt while they write their crawlers?... That's crazy. Though I guess my theory on that holds true here as well: If you catch a million fish every time you cast your line, are you gonna try better bait? No. So they don't un-obfuscate even the simplest email mask, and I guess some of them play nice as far as robots.txt goes, even though they are out to spam you. Seems silly, but that could be Reality. C) Aren't some of those bad bots also going to rule out legitimate scripting? Am I mistaken that he pre-emptorally denies access to any (legit) Python script? Hello? I'm not a fan of Python, but that seems a bit much. :-) [Just kidding. I'm ambivalent towards Python, really.] -- Like Music? http://l-i-e.com/artists.htm robots.txt SHOULD go in the webroot, like this: http://l-i-e.com/robots.txt I don't know why FuNEnD3R said that it should be above the webroot. That is a mistake. Dotan http://lyricslist.com/lyrics/artist_albums/64/the_beatles.php Beatles Song Lyrics -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help recognizing bots?
On Thu, June 23, 2005 3:37 am, JamesBenson said: http://www.funender.com/phpBB2/about18577.html Call me crazy, but... A) Doesn't robots.txt have to be in public_html? How the hell can the robots read it if it's in the root folder, as they suggest in that forum? B) Are the Bad Bots really going to honor robots.txt in the first place? I mean, I know the spammers don't even need to un-obfuscate emails as simple as %40 and #64; but are they really so dumb as to honor robots.txt while they write their crawlers?... That's crazy. Though I guess my theory on that holds true here as well: If you catch a million fish every time you cast your line, are you gonna try better bait? No. So they don't un-obfuscate even the simplest email mask, and I guess some of them play nice as far as robots.txt goes, even though they are out to spam you. Seems silly, but that could be Reality. C) Aren't some of those bad bots also going to rule out legitimate scripting? Am I mistaken that he pre-emptorally denies access to any (legit) Python script? Hello? I'm not a fan of Python, but that seems a bit much. :-) [Just kidding. I'm ambivalent towards Python, really.] -- 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
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: [PHP] Re: Help with dates
M. Sokolewicz wrote: well, you can simply use the unix timestamp, since the amount of days / seconds since 0 AD/BC will be a constant (it won't change, trust me), you can simply add it to that, and add a wrapper function to php's time(). You'll be working with VERY big numbers in that case, so you can also do it the other way around; store the amount of DAYS since 0 AD/BC till Jan 1st 1970, add time()/86400, and you'll have the amount of days since 0 AD/BC in an integer (or float, depending on how many days that really are). You'll just need to find that constant somewhere :) Can't be too hard to calculate it: 1970 * 365 + 1 day for each leap year. Note the rules for leap year, of course. /Mattias -- More views at http://www.thorslund.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] Re: [suspicious - maybe spam] Re: [PHP] Re: Help with dates
Greetings Mr Mattias, I wish it was so simple. Because the dates that may need calculating can be before 1970. THis function I have.. and it's semi-working, but I've noticed irregularities during the conversion. Thanks for your suggestion!! Yours, Kevin Mattias Thorslund [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] M. Sokolewicz wrote: well, you can simply use the unix timestamp, since the amount of days / seconds since 0 AD/BC will be a constant (it won't change, trust me), you can simply add it to that, and add a wrapper function to php's time(). You'll be working with VERY big numbers in that case, so you can also do it the other way around; store the amount of DAYS since 0 AD/BC till Jan 1st 1970, add time()/86400, and you'll have the amount of days since 0 AD/BC in an integer (or float, depending on how many days that really are). You'll just need to find that constant somewhere :) Can't be too hard to calculate it: 1970 * 365 + 1 day for each leap year. Note the rules for leap year, of course. /Mattias -- More views at http://www.thorslund.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: help with adding
You really don't have to put the index in a single dimension input array. Just put qty[] And you'll get it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help: Database Search
I think I'm almost there :) Only right now I'm getting an error message: Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3 ?php $where = array(); $Ind = ; $Ind = $_POST['Ind']; if (count($Ind) 1) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN($IndStr); }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } ? ?php $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) I can't find the problem. Anyone see anything ? Thank you. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help: Database Search
Sorry, I fixed Ind , since the element is named Ind[]. Now I get a different error: Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '','','Array)' at line 3 ?php $where = array(); $Ind[] = ; $Ind[] = $_POST['Ind']; if (count($Ind) 1) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN($IndStr); }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } ? ?php $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) I can't find the problem. Anyone see anything ? Thank you. Stuart -- 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] Re: Help: Database Search
On Saturday 13 November 2004 20:41, Stuart Felenstein wrote: Sorry, I fixed Ind , since the element is named Ind[]. Now I get a different error: Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '','','Array)' at line 3 ?php $where = array(); $Ind[] = ; $Ind[] = $_POST['Ind']; if (count($Ind) 1) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN($IndStr); }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } ? ?php $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) I can't find the problem. Anyone see anything ? Uhmm, you could try some debugging of your own instead of relying on the list. Liberally douse your code with print_r() and var_dump() of all your important variables. Do they contain what you expected? If not try and figure out why not. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Soap and education are not as sudden as a massacre, but they are more deadly in the long run. -- Mark Twain */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
--- Jason Wong [EMAIL PROTECTED] wrote: Uhmm, you could try some debugging of your own instead of relying on the list. Liberally douse your code with print_r() and var_dump() of all your important variables. Do they contain what you expected? If not try and figure out why not. -- Jason Wong - Gremlins Associates - Okay, took your advice, but it seems to be a sql error as the message says. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
On Saturday 13 November 2004 21:10, Stuart Felenstein wrote: Okay, took your advice, but it seems to be a sql error as the message says. Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '','','Array)' at line 3 Yes, that was apparent from your previous post. So did you print out your query and examine it for any obvious mistakes? And if you couldn't spot any obvious mistakes then the least you could have done was to copy and paste the full query in your post so that we could see it in all its glory instead of the truncated query that was posted as part of the mysql error message. Please help us to help you. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Wagner's music is better than it sounds. -- Mark Twain */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
--- Jason Wong [EMAIL PROTECTED] wrote: Yes, that was apparent from your previous post. So did you print out your query and examine it for any obvious mistakes? And if you couldn't spot any obvious mistakes then the least you could have done was to copy and paste the full query in your post so that we could see it in all its glory instead of the truncated query that was posted as part of the mysql error message. Please help us to help you. -- Jason Wong - Gremlins Associates - It was not apparent whatsoever. Let me show the code again , but I'll include the print_r returns inline code. ?php $where = array(); $Ind[] = ; print_r($Ind); //Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 11 [11] = 12 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [16] = 17 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 35 [29] = [30] = Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 11 [11] = 12 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [16] = 17 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 35 ) ) So maybe this is weird, since it seems to print out twice ? if (count($Ind) 0) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN($IndStr); }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } ? ?php $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); print_r($where); //Array ( [0] = VendorJobs.Industry IN(1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','35','','Array) ) $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
On Saturday 13 November 2004 21:31, Stuart Felenstein wrote: It was not apparent whatsoever. Let me show the code again , but I'll include the print_r returns inline code. ?php $where = array(); $Ind[] = ; Not sure why you're adding an empty element to $Ind? print_r($Ind); //Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 11 [11] = 12 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [16] = 17 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 35 [29] = [30] = Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 11 [11] = 12 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [16] = 17 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 35 ) ) So maybe this is weird, since it seems to print out twice ? Look at it carefully, you've got a multi-dimensional array. Element [30] contains an array (see below). Here's a tip, when using print_r(), wrap a pre tag around it: echo pre; // you may want to consider creating a print_r($var); // function for this echo /pre; That way you can see clearly the structure of any array that you print. IN(1','2','3', See that the 1 has a missing quote? ,'27','28','35','','Array) ) See the Array (also missing a single-quote), that's element [30] mentioned above. Summary: the missing single-quotes are the show-stopper. When I said ... was to copy and paste the full query in your post so that we could see it in ... I meant post the full query that you are sending off the the DB, which in this case is the contents of $sql: $result = mysql_query($sql) or die (Query failed: -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* I am ... a woman ... and ... technically a parasitic uterine growth -- Sean Doran the Younger [allegedly] ll */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
Stuart, On Sat, Nov 13, 2004 at 05:31:06AM -0800, Stuart Felenstein wrote: It was not apparent whatsoever. Let me show the code again , but I'll include the print_r returns inline code. ?php $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); print_r($where); //Array ( [0] = VendorJobs.Industry IN(1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','35','','Array) ) Right here, print the contents of $sql. That is the most important thing to know right now. $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) ? Stuart -- Jim Kaufman Linux Evangelist public key 0x6D802619 --- A dog teaches a boy fidelity, perseverance, and to turn around three times before lying down. -- Robert Benchley -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
--- Jason Wong [EMAIL PROTECTED] wrote: See the Array (also missing a single-quote), that's element [30] mentioned above. Summary: the missing single-quotes are the show-stopper. I see that , but I'm not sure how that is happening. Here is the sql: $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); // Is it the Where statement maybe ? //print_r($where); $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
--- James Kaufman [EMAIL PROTECTED] wrote: Right here, print the contents of $sql. That is the most important thing to know right now. SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE VendorJobs.Industry IN(1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','Array)Query failed: You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '','2','3','4','5','6','7','8','9','10','11','12','13','14','15' Looks like the array is matching ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
On Saturday 13 November 2004 22:14, Stuart Felenstein wrote: Summary: the missing single-quotes are the show-stopper. I see that , but I'm not sure how that is happening. Here is the sql: $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); // Is it the Where statement maybe ? OK, so $sql is built from $where, and what is $where built from? And so on. trace back up through your code examining each variable assignment. May I remind you of this very useful advice: http://marc.theaimsgroup.com/?l=php-generalm=109956779311140w=2 Yes debugging is tedious but someone has to do it. Or alternatively: - write bug free code (not even Bill Gates can do that) - pay someone to debug it for you (my going rate is HKD600/hour) -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* Maternity pay? Now every Tom, Dick and Harry will get pregnant. -- Malcolm Smith */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help: Database Search
Hi Stuart Not sure what's happening with the $Ind variable, maybe check the $_POST array as you enter the script to ensure that the form is passing the data correctly. It is almost as if you are appending it to itself at some point. You don't have a line like this anywhere do you : $Ind[] = $Ind; OR maybe 2 of: $Ind[] = $_POST['Ind']; ?? Part of the problem is with the implode statement. It is this that is not adding the initial and final ' to your IN statement, see below: if (count($Ind) 0) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN('$IndStr'); ^---^ }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } I would also remove this line: $Ind[] = ; HTH Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 13 November 2004 13:31 To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: Help: Database Search --- Jason Wong [EMAIL PROTECTED] wrote: Yes, that was apparent from your previous post. So did you print out your query and examine it for any obvious mistakes? And if you couldn't spot any obvious mistakes then the least you could have done was to copy and paste the full query in your post so that we could see it in all its glory instead of the truncated query that was posted as part of the mysql error message. Please help us to help you. -- Jason Wong - Gremlins Associates - It was not apparent whatsoever. Let me show the code again , but I'll include the print_r returns inline code. ?php $where = array(); $Ind[] = ; print_r($Ind); //Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 11 [11] = 12 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [16] = 17 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 35 [29] = [30] = Array ( [0] = 1 [1] = 2 [2] = 3 [3] = 4 [4] = 5 [5] = 6 [6] = 7 [7] = 8 [8] = 9 [9] = 10 [10] = 11 [11] = 12 [12] = 13 [13] = 14 [14] = 15 [15] = 16 [16] = 17 [17] = 18 [18] = 19 [19] = 20 [20] = 21 [21] = 22 [22] = 23 [23] = 24 [24] = 25 [25] = 26 [26] = 27 [27] = 28 [28] = 35 ) ) So maybe this is weird, since it seems to print out twice ? if (count($Ind) 0) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN($IndStr); }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } ? ?php $sql = 'SELECT PostStart, JobTitle, Industry, LocationState, VendorID FROM VendorJobs WHERE ' . implode( ' AND ', $where ); print_r($where); //Array ( [0] = VendorJobs.Industry IN(1','2','3','4','5','6','7','8','9','10','11','12','13','14','15 ','16','17','18','19','20','21','22','23','24','25','26','27','28','35','',' Array) ) $result = mysql_query($sql) or die (Query failed: .mysql_error()); while($row = mysql_fetch_assoc($result)) ? Stuart -- 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] Re: Help: Database Search
--- Graham Cossey [EMAIL PROTECTED] wrote: Hi Stuart Not sure what's happening with the $Ind variable, maybe check the $_POST array as you enter the script to ensure that the form is passing the data correctly. It is almost as if you are appending it to itself at some point. You don't have a line like this anywhere do you : $Ind[] = $Ind; OR maybe 2 of: $Ind[] = $_POST['Ind']; ?? Part of the problem is with the implode statement. It is this that is not adding the initial and final ' to your IN statement, see below: if (count($Ind) 0) { $IndStr = implode(',', $Ind); $where[] = VendorJobs.Industry IN('$IndStr'); ^---^ }else{ $where[] = VendorJobs.Industry = {$Ind[0]}; } I would also remove this line: $Ind[] = ; HTH Graham I think it's working , at least I get results now with no error messages. Still some work to go on the script. Here is the current initializatin and sql code: $Ind = $HTTP_POST_VARS['Ind']; if (count($Ind) 0 AND is_array($Ind)) { $s_Ind = '.implode(',', $Ind).'; } I guess here I should put this in braces as it should be conditional if $Ind is set, if not the subsequent sql statement shouldn't go in. if ($Ind) $sql .= WHERE VendorJobs.Industry IN ($s_Ind); Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help: Database Search
--- Sebastian Mendel [EMAIL PROTECTED] wrote: $where = array(); if ( isset($_POST['Ind']) ) { $where[] = 'vendorjobs.Industry = ' . (int) $_POST['Ind']; } if ( isset($_POST['Days']) ) { $where[] = 'Date_Sub(Curdate(), interval ' . (int) $_POST['Days'] . ' day) = PostStart'; } $sql = ' SELECT ... FROM vendorjobs WHERE ' . implode( ' AND ', $where ); Sebastian, I meant to thank you for this code the other day. What I'm trying to figure out is some of my elements are arrays themselves. So for example I have this : $Ind = ; $Ind = $HTTP_POST_VARS['Ind']; if (count($Ind) 0 AND is_array($Ind)) { $Ind = '.implode(',', $Ind).'; } So how would this code , or array get into what you stated as: $where = array(); if ( isset($_POST['Ind']) ) { $where[] = 'vendorjobs.Industry = ' . (int) $_POST['Ind']; } I guess that is putting an array into an array ? Not quite sure how the loop would go. Thank you, Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help: Database Search
I think you're implode example is pretty close. ?php $Ind = ; $Ind = $_POST['Ind']; if(is_array($Ind) { if (count($Ind) 1) { $IndStr = implode(',', $Ind); $where[] = vendorjobs.Industry IN($IndStr); }else{ $where[] = vendorjobs.Industry = {$Ind[0]}; }else{ // Is there an error if not an array? } $sql = 'SELECT ... FROM vendorjobs WHERE ' . implode( ' AND ', $where ); ? Not sure if you need the {} above, I think you do as it's an array reference in a string. This should result in: WHERE vendorjobs.Industry IN (2,3,5) OR WHERE vendorjobs.Industry = 2 HTH Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 12 November 2004 12:42 To: Sebastian Mendel; [EMAIL PROTECTED] Subject: Re: [PHP] Re: Help: Database Search --- Sebastian Mendel [EMAIL PROTECTED] wrote: $where = array(); if ( isset($_POST['Ind']) ) { $where[] = 'vendorjobs.Industry = ' . (int) $_POST['Ind']; } if ( isset($_POST['Days']) ) { $where[] = 'Date_Sub(Curdate(), interval ' . (int) $_POST['Days'] . ' day) = PostStart'; } $sql = ' SELECT ... FROM vendorjobs WHERE ' . implode( ' AND ', $where ); Sebastian, I meant to thank you for this code the other day. What I'm trying to figure out is some of my elements are arrays themselves. So for example I have this : $Ind = ; $Ind = $HTTP_POST_VARS['Ind']; if (count($Ind) 0 AND is_array($Ind)) { $Ind = '.implode(',', $Ind).'; } So how would this code , or array get into what you stated as: $where = array(); if ( isset($_POST['Ind']) ) { $where[] = 'vendorjobs.Industry = ' . (int) $_POST['Ind']; } I guess that is putting an array into an array ? Not quite sure how the loop would go. Thank you, Stuart -- 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] Re: Help: Database Search
--- Graham Cossey [EMAIL PROTECTED] wrote: This should result in: WHERE vendorjobs.Industry IN (2,3,5) OR WHERE vendorjobs.Industry = 2 HTH Graham Not sure what you mean by the above ? Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help: Database Search
What I meant was that the $sql variable should contain a where clause of WHERE vendorjobs.Industry IN (2,3,5) if you had a multi-element array or WHERE vendorjobs.Industry = 2 if you had a single-element array. The IN statement is easier to construct than multiple ORs and tends to run faster as well. Graham -Original Message- From: Stuart Felenstein [mailto:[EMAIL PROTECTED] Sent: 12 November 2004 14:13 To: Graham Cossey; Sebastian Mendel; [EMAIL PROTECTED] Subject: RE: [PHP] Re: Help: Database Search --- Graham Cossey [EMAIL PROTECTED] wrote: This should result in: WHERE vendorjobs.Industry IN (2,3,5) OR WHERE vendorjobs.Industry = 2 HTH Graham Not sure what you mean by the above ? Stuart -- 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] Re: Help with Regular Expressions
From: [EMAIL PROTECTED] Hi all, I am working on a small php script which should do the following. I want all the links in the page to be preceded by first character and first two characters of the link.Please look into the example below for more clarification. eg. a href=/code.htmllink here/a to be replaced as a href=/c/co/code.htmllink here/a I guess, this is possible by using regular expressions but I am not able to crack the right expression. Hi, This is not very simple. The URI which in your example is /code.html can be anything, including something like m.html. In that case which would be the first 2 letters? Or, the URI can be something like m-like.html. In this case the first 2 letters will be m- or ml? A good regular expression should work in all situations so it is important to know what is the desired result, and not to asume that there won't be any links like /.html or something worse. Teddy -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help Formatting String into URL
Hi Frank, Thanks, you got me started. I modified your function a bit. I'm testing for 3 cases now and the appearance of http://, https://, or ftp:// in front of the string. Let me know if you advise any changes. ?php function FormatUrl($url) { $url = trim($url); if (eregi(^(((http)|(https)|(ftp)){1}://), $url)) { $result = $url; // do nothing } else if (eregi(^www\.{1}, $url)) { $result = http://$url;; } else { $result = http://www.$url;; } return $result; } ? -Original Message- From: Frank Voorburg [mailto:[EMAIL PROTECTED] Sent: Saturday, July 10, 2004 9:59 AM To: [EMAIL PROTECTED] Subject: [PHP] Re: Help Formatting String into URL Ryan, You can use the following function: function FormatUrl($url) { if (eregi(www, $url)) $result = http://$url;; else $result = http://www.$url;; return $result; } You can test it using: $test1 = FormatUrl(google.com); $test2 = FormatUrl(www.google.com); print test1 = $test1br; print test2 = $test2br; And this will give you the results: test1 = http://www.google.com test2 = http://www.google.com Good luck! -Frank Ryan Schefke [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Can someone help me write a short code snippet to format a string to add: http://www http://www/ -- if the string is google.com and doesn't have http://www http://www/ in front of it http:// http://www/-- if the string is www.google.com and doesn't have http:// in front of it .if you know of a better way to securely check/format a url like this please let me know. Thanks, Ryan -- 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] Re: help with mysql
line 16: mysql_connect(tflood, thomas91); I think you mean: mysql_connect(localhost, tflood, thomas91); otherwise mysql_connect takes tflood as Server and thomas91 as Username (if so, its better to replace passwords with * before posting) - http://ch.php.net/mysql_connect after connecting you need to choose a database, e.g. line 17: mysql_select_db(databasename); also make sure that the mysql-extension is installed and loaded. to check this, create a textfile phpinfo.php with this content: ? phpinfo(); ? check the output for information about mysql g. tinu Tue, 27 Jan 2004 08:51:52 -0500 Tom Flood [EMAIL PROTECTED]: Thank you both, here is the entire code : 1html 2head 3titleUntitled Document/title 4meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 5/head 6 7body 8?php 9 $name = $_GET[name]; 10 $address = $_GET[address]; 11$city = $_GET[city]; 12print Name is $namebr\n; 13print Address is $addressbr\n; 14print City is $citybr\n; 15 16mysql_connect(tflood, thomas91); 17 18$result = mysql_query( 19 insert into ephi.info 20 (name, address, city) values 21 ('$name', '$address', '$city') 22); 23if ($result) { 24 print EOT 25 26 h1 Thank you. /h1 27 Your signup is highly appreciated. To show our appreciation, we will send you something that you, in turn, will appreciate. p 28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live Sinfonia! 29EOT; 30 } 31 else { 32 print Something went wrong dunbass; 33 } 34 mysql_close(); 35? 36/body/html As far as mysql working on the machine, it is. I am able to use the mysql command to loginto the server and query my databases. And I have the MySQL Command Center installed and am able to see the databases on my computer just fine. Thank you for your help. Tom Krit Kanrat [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Are you sure that you already enable mysql function on your web server ? Krit Kanrat Tom Flood [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am just beginning my learning of php and its uses with mysql. I wrote a small program to add information into a mysql database. However my script returns the following error: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/ephi/mysql.php on line 16 what is the problem here? How can I fix it? I truly appreciate any help given. Tom Flood [EMAIL PROTECTED] -- 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] Re: help with mysql
Martin, Thank you for the insight when I ran the php file you suggested, nothing appeared to be related to mysql. I installed both the php and mysql packages onto my Linux box through a rpm installer. Where can I obtain mysql support for php? Tom Martin Luethi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] line 16: mysql_connect(tflood, thomas91); I think you mean: mysql_connect(localhost, tflood, thomas91); otherwise mysql_connect takes tflood as Server and thomas91 as Username (if so, its better to replace passwords with * before posting) - http://ch.php.net/mysql_connect after connecting you need to choose a database, e.g. line 17: mysql_select_db(databasename); also make sure that the mysql-extension is installed and loaded. to check this, create a textfile phpinfo.php with this content: ? phpinfo(); ? check the output for information about mysql g. tinu Tue, 27 Jan 2004 08:51:52 -0500 Tom Flood [EMAIL PROTECTED]: Thank you both, here is the entire code : 1html 2head 3titleUntitled Document/title 4meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 5/head 6 7body 8?php 9 $name = $_GET[name]; 10 $address = $_GET[address]; 11$city = $_GET[city]; 12print Name is $namebr\n; 13print Address is $addressbr\n; 14print City is $citybr\n; 15 16mysql_connect(tflood, thomas91); 17 18$result = mysql_query( 19 insert into ephi.info 20 (name, address, city) values 21 ('$name', '$address', '$city') 22); 23if ($result) { 24 print EOT 25 26 h1 Thank you. /h1 27 Your signup is highly appreciated. To show our appreciation, we will send you something that you, in turn, will appreciate. p 28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live Sinfonia! 29EOT; 30 } 31 else { 32 print Something went wrong dunbass; 33 } 34 mysql_close(); 35? 36/body/html As far as mysql working on the machine, it is. I am able to use the mysql command to loginto the server and query my databases. And I have the MySQL Command Center installed and am able to see the databases on my computer just fine. Thank you for your help. Tom Krit Kanrat [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Are you sure that you already enable mysql function on your web server ? Krit Kanrat Tom Flood [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am just beginning my learning of php and its uses with mysql. I wrote a small program to add information into a mysql database. However my script returns the following error: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/ephi/mysql.php on line 16 what is the problem here? How can I fix it? I truly appreciate any help given. Tom Flood [EMAIL PROTECTED] -- 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] Re: help with mysql
My honest advice, dont use rpm's, you need to compile php via source if you want to do anything out of the ordinary like adding extensions, yes adding mysql is out of the ordinary for a standard rpm lol. Thats just my experience anyway. so ./configure --with-mysql=/usr/local/mysql or whereever you put it Martin, Thank you for the insight when I ran the php file you suggested, nothing appeared to be related to mysql. I installed both the php and mysql packages onto my Linux box through a rpm installer. Where can I obtain mysql support for php? Tom Martin Luethi [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] line 16: mysql_connect(tflood, thomas91); I think you mean: mysql_connect(localhost, tflood, thomas91); otherwise mysql_connect takes tflood as Server and thomas91 as Username (if so, its better to replace passwords with * before posting) - http://ch.php.net/mysql_connect after connecting you need to choose a database, e.g. line 17: mysql_select_db(databasename); also make sure that the mysql-extension is installed and loaded. to check this, create a textfile phpinfo.php with this content: ? phpinfo(); ? check the output for information about mysql g. tinu Tue, 27 Jan 2004 08:51:52 -0500 Tom Flood [EMAIL PROTECTED]: Thank you both, here is the entire code : 1html 2head 3titleUntitled Document/title 4meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 5/head 6 7body 8?php 9 $name = $_GET[name]; 10 $address = $_GET[address]; 11$city = $_GET[city]; 12print Name is $namebr\n; 13print Address is $addressbr\n; 14print City is $citybr\n; 15 16mysql_connect(tflood, thomas91); 17 18$result = mysql_query( 19 insert into ephi.info 20 (name, address, city) values 21 ('$name', '$address', '$city') 22); 23if ($result) { 24 print EOT 25 26 h1 Thank you. /h1 27 Your signup is highly appreciated. To show our appreciation, we will send you something that you, in turn, will appreciate. p 28 Remember our motto: Once a Sinfonian, Always a Sinfonian, Long Live Sinfonia! 29EOT; 30 } 31 else { 32 print Something went wrong dunbass; 33 } 34 mysql_close(); 35? 36/body/html As far as mysql working on the machine, it is. I am able to use the mysql command to loginto the server and query my databases. And I have the MySQL Command Center installed and am able to see the databases on my computer just fine. Thank you for your help. Tom Krit Kanrat [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, Are you sure that you already enable mysql function on your web server ? Krit Kanrat Tom Flood [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hello, I am just beginning my learning of php and its uses with mysql. I wrote a small program to add information into a mysql database. However my script returns the following error: Fatal error: Call to undefined function: mysql_connect() in /var/www/html/ephi/mysql.php on line 16 what is the problem here? How can I fix it? I truly appreciate any help given. Tom Flood [EMAIL PROTECTED] -- 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] Re: help with mysql
On Tue, 27 Jan 2004 18:01:40 -0500 Tom Flood [EMAIL PROTECTED] wrote: Martin, Thank you for the insight when I ran the php file you suggested, nothing appeared to be related to mysql. I installed both the php and mysql packages onto my Linux box through a rpm installer. Where can I obtain mysql support for php? Check if you have php-mysql-x.x.x-x.x.rpm installed... -- - E - __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HELP!! ISS does not load the ISAPI of PHP
Astron of BrOnX wrote: Hi, here is the steps, 1 . Copy all php_*.dll from extentions dir to c:\windows\system32 2 . Copy phpsapi.dll to c:\windows\system32 3 . Copy php4ts.dll to c:\windows\system32 4 . Copy php.ini to c:\windows\system32 5. go ISAPI Filters and add .php (c:\windows\system32\phpisapi.dll) 6. go Application Configuration select Mappings tab and add new extentions mapping .php (c:\windows\system32\phpisapi.dll) 7. restart IIS I like to replace steps 1 - 3 with 1. Copy php4isapi.dll file to the same directory as php.exe (usually from php/sapi/ to php/). This keeps everything within the php/ directory. Just seems cleaner and makes for easier upgrades, if you ask me. :) -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help! the Error_Reporting doesn't work
* Thus wrote Raquel Rice ([EMAIL PROTECTED]): On Thu, 25 Sep 2003 08:32:03 -0500 Shawn McKenzie [EMAIL PROTECTED] wrote: Luckyeagle [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I have set the PHP.INI as follow: error_reporting = E_ALL ~E_NOTICE display_errors = On display_startup_errors = Off log_errors = On log_errors_max_len = 1024 ignore_repeated_errors = Off ignore_repeated_source = Off report_memleaks = On track_errors = Off But it doesn't work How can i solve it? Thanks a lot What do you mean it doesn't work? It doesn't display errors? How do you know that you have errors? Are you running your own script or someone else's? -Shawn AND ... where is the logfile indicated? Does the script have access (read/write) to the logfile? AND.. is php even using that file your modifying? Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: help with php
DvDmanDT mailto:[EMAIL PROTECTED] on Tuesday, July 29, 2003 5:06 PM said: I agree to Parker's post, but I think I understand you... Whoops... I should apologize. I missed the keyword email and read it as another page. Sorry Billy. Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] RE: help with explode.....
-Original Message- From: Joe Harman [mailto:[EMAIL PROTECTED] Sent: 25 July 2003 06:12 The name of the set of radio buttons is the QuestionID (so it's a number)... And the options are the AnswerID (they are also numbers)... This is technically invalid for PHP -- all your form field names should conform to the rules for PHP variable names, so it would be better to use name=q1, name=q2, etc. The reason is that if you were to turn register_globals on, PHP would try to create global variables using your field names, and $1, $2, etc. are not valid variables. Whilst PHP *may* get this right if you have register_globals turned off, there is no absolute guarantee that $_POST['1'] etc. will be handled correctly. Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: help with explode.....
The threading is messed up on this message, so sorry for the top post. Actually, the method that Shaunak gave is the best method to use. If you took your questions and had them formatted from this: pWhat color are you eyes?br blockquote input type=radio name=9 value=5Bluebr input type=radio name=9 value=7Greenbr /blockquote/p to this: pWhat color are you eyes?br blockquote input type=radio name=q[9] value=5Bluebr input type=radio name=q[9] value=7Greenbr /blockquote/p You now have all of your questionIDs and answerIDs in the $_POST['q'] array. foreach($_POST['q'] as $questionID = $answerID) { $query = INSERT INTO answers (questionID, answerID) VALUES ('$questionID','$answerID'); } Throw in some validation, of course, and then you're done. How much easier can it be? This is what I do in my survey system. You can see a demo at http://sepodati.realxl.net/ The admin password is just password. -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ PHP|Architect: A magazine for PHP Professionals www.phparch.com Joe Harman wrote: Actually... That didn't work... The QuestionID and AnswerID are different from poll to poll Can I do something like a loop and pass the QuestionID and AnswerID into other variables... Ex. Here is my HTML that is dynamically created * html head titleUntitled Document/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body form action=play.php method=post name=Poll id=Poll pThe Cool Joe Survey/p pWhat color are you eyes?br blockquote input type=radio name=9 value=5Bluebr input type=radio name=9 value=7Greenbr /blockquote/p pWhat Letter does your name start withbr blockquote input type=radio name=14 value=19abr input type=radio name=14 value=20bbr input type=radio name=14 value=21cbr /blockquote/p pWhat Day is itbrblockquote input type=radio name=13 value=17Thursbr input type=radio name=13 value=18Fribr input type=radio name=13 value=16Tuesbr /blockquote/p p align=center input name=GoForm type=hidden id=GoForm value=1 input type=submit name=Submit value=Submit Survey /p /form /body /html Can I do something like this on the nest page * 1 Start the do statement til radio button name equals null 2 extract (from $_POST) the radio button name and plug it into $RadioName 3 extract (from $_POST) the radio button value and plug it into $RadioValue 4 insert it into a MySQL table 5 while statement sends you back to 1 * not exactly sure how I am going to do the while part LOL Thanks, Joe -Original Message- From: Shaunak Kashyap [mailto:[EMAIL PROTECTED] Sent: Friday, July 25, 2003 1:14 AM To: Joe Harman Subject: Re: help with explode. The name of the set of radio buttons is the QuestionID (so it's a number)... And the options are the AnswerID (they are also numbers)... In that case, I assume your code looks something like this: input type=radio name=?=$QuestionID?... How about using an array instead of just the QuestionID as shown below: input type=radio name=Question[?=$QuestionID?... That way, on the next page (the one to which this form is being submitted) you can get the AnswerIDs by simply looping through the $_POST[Question] array (assuming your form submission method is post). Hope that made sense. Shaunak -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help?
Curt Zirzow [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] * Thus wrote Ivo Fokkema ([EMAIL PROTECTED]): I want to warn you though, PHP depricates the use of register_globals = On, so it would be recommendable to use your modified script and keep coding using $_POST, $_GET and these kind of global variables. So php is removing that feature? Don't know about the future, but its default is off since 4.2.0 because of security issues that might arise from bad coding. An example on this is on http://www.php.net/manual/en/security.registerglobals.php. If it wasn't such a drag for many people to change all of their coding, I'd say it would be a good idea to just disable it for security issues. When I realised I really needed to use the $_POST, $_GET and $_SESSION arrays, I became more aware of the possible security holes of my scripts. It helped me a lot, I'd say. Ivo -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help?
* Thus wrote Ivo Fokkema ([EMAIL PROTECTED]): I want to warn you though, PHP depricates the use of register_globals = On, so it would be recommendable to use your modified script and keep coding using $_POST, $_GET and these kind of global variables. So php is removing that feature? Curt -- I used to think I was indecisive, but now I'm not so sure. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help needed
Hi Pete Morganic , Thanks for reply. But the code is not solving my problem. May be I did not epress my problem clearly. Actually I wanted to store the returned value so that I can write it on page like { test = ?php LangItem(FieldName,LangName)?'); document.write(test); } and moreover the value I am passing is material and E is not getting parsed to PHP function. PHP function input for $field and $lang will be FieldName and LangName only. looking for help regards Nirmala P. On Mon, 30 Jun 2003 Pete Morganic wrote : Nirmala P wrote: Hi list, This time i am pasting my code could any body tell where wrong I am ? ? function LangItem($field,$lang) { $db = mysql_connect(localhost, root); /*Check For Connection to local host*/ if(!$db) echo(Connect to localhost mysql database failed); if(!mysql_select_db(eshop,$db)) echo (Selection of eshop failed on MySQL database); $Sql = SELECT . $field . FROM language where LangCode = .'.$lang.'; $result = mysql_query($Sql,$db); if($result) { $myrow = mysql_fetch_array($result); $value = $myrow[$field]; // return valus return($value); } else echo (h1 No Record Found/h1); } ? script language=JavaScript FieldName = Material; LangName = E; // included in quotes and php tag alert('?php LangItem(FieldName,LangName)?'); /script Loking for help.. Nirmala ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help needed
Where does thejavascript fit ? Nirmala P wrote: Hi Pete Morganic , Thanks for reply. But the code is not solving my problem. May be I did not epress my problem clearly. Actually I wanted to store the returned value so that I can write it on page like { test = ?php LangItem(FieldName,LangName)?'); document.write(test); } and moreover the value I am passing is material and E is not getting parsed to PHP function. PHP function input for $field and $lang will be FieldName and LangName only. looking for help regards Nirmala P. On Mon, 30 Jun 2003 Pete Morganic wrote : Nirmala P wrote: Hi list, This time i am pasting my code could any body tell where wrong I am ? ? function LangItem($field,$lang) { $db = mysql_connect(localhost, root); /*Check For Connection to local host*/ if(!$db) echo(Connect to localhost mysql database failed); if(!mysql_select_db(eshop,$db)) echo (Selection of eshop failed on MySQL database); $Sql = SELECT . $field . FROM language where LangCode = .'.$lang.'; $result = mysql_query($Sql,$db); if($result) { $myrow = mysql_fetch_array($result); $value = $myrow[$field]; // return valus return($value); } else echo (h1 No Record Found/h1); } ? script language=JavaScript FieldName = Material; LangName = E; // included in quotes and php tag alert('?php LangItem(FieldName,LangName)?'); /script Loking for help.. Nirmala ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Click below to experience Sooraj Barjatya's latest offering 'Main Prem Ki Diwani Hoon' starring Hrithik Roshan, Abhishek Bachchan Kareena Kapoor http://www.mpkdh.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help please!
We always send the mail to [EMAIL PROTECTED], and not using reply to group function,I think there's no easy way to do this.If you really have problems with PHP,sending mail is not the important thing,the more important thing is to get a good reply!Sorry,it's my own opinion:) - Yea for sure, the most important thing is to get your PHP problems solved here.. - Well I've been able to send from my news client (Outlook Express). This post was not mailed but Reply to Grouped Thx for the help... Nadim Attari http://www.alienworkers.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with my code
On Wed, 2003-06-18 at 08:23, Terje Torkelsen wrote: To echo multiple lines you have to write echo END html headtitle ... .. END; No offense, but this is completely false. Double-quotes will work just fine. -- Torben Wilson [EMAIL PROTECTED]+1.604.709.0506 http://www.thebuttlesschaps.com http://www.inflatableeye.com http://www.hybrid17.com http://www.themainonmain.com - Boycott Starbucks! http://www.haidabuckscafe.com - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with my code
hehe.. know, i seem to write it a little fast.. it a _long_ time since ive use this notation.. :) im gonna check it to be sure next time.. On Wed, 18 Jun 2003 17:45:26 +0200, Lars Torben Wilson wrote (in message [EMAIL PROTECTED]): Organization: MIME-version: 1.0 X-Mailer: Ximian Evolution 1.2.3 Content-type: text/plain Content-transfer-encoding: 7BIT References: [EMAIL PROTECTED] [EMAIL PROTECTED] Subject: Re: [PHP] Re: Help with my code From: [EMAIL PROTECTED] (Lars Torben Wilson) On Wed, 2003-06-18 at 08:23, Terje Torkelsen wrote: To echo multiple lines you have to write echo END html headtitle ... .. END; No offense, but this is completely false. Double-quotes will work just fine. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help with a UBB Code style parser...
Even better, try my BBCode class. Much more flexible. http://www.phpclasses.org/browse.html/package/951.html Manuel Lemos wrote: Hello, You may want to try this class: Class: UBBCode http://www.phpclasses.org/ubb -- The above message is encrypted with double rot13 encoding. Any unauthorized attempt to decrypt it will be prosecuted to the full extent of the law. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Help Needed
Hello All: Thanks again... I tried to use this and it is working fine for me. Please comment: ? session_start(); if (session_is_registered(valid_user)) include 'guest.html'; else include 'not_logged_in.php'; ? Many Thanks -Pushpinder On Tuesday, February 4, 2003, at 12:32 PM, Goetz Lohmann wrote: Pushpinder Singh Garcha schrieb: Hello All: My question is related to authentication. I have made a login system using PHP Sessions and MySQL. Once the user gets authenticated on the website I want to be able to allow him to see some html pages on the website. Only users who have logged in are able to see such a files. I have asked this question before , but still I have some doubts. My code will check for: if (session_is_registered($valid_user)) { /// display the reqd page } else { DISPLAY ERROR MESSAGE and ASK USER TO LOGIN } How should I display the page ... the page has a lot of html code and trying to write echoblah blah blah . ; will not be a an option. Please suggest a way out . you could include every page into a php script using ?php include('index.htm'); ? this mean, that this page is like being copyed in the php file also instead of ?php echo bla bla bla: ? you always can do ?php ... ? bla bla bla ?php ... ? -- @ Goetz Lohmann, Germany | Web-Developer Sys-Admin \/ -- () He's the fellow that people wonder what he does and || why the company needs him, until he goes on vacation. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Pushpinder Singh Garcha _ Web Architect
RE: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form.
- Original Message - From: Victor [EMAIL PROTECTED] To: 'Rick Emery' [EMAIL PROTECTED] Sent: Tuesday, December 10, 2002 1:49 PM Subject: RE: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. Why are you using $_POST[]? I thought you had to use $_POST['']. I always use '' instead of and it always works. Is it just me? Can one really use double quotes? Of course you can -- it's just a string! The difference, as with all strings, is in whether you want variable names to be interpolated or not. Consider: $num = 3; $array = array('var 3'='Interpolated!', 'var $nuum'='Not Interpolated'); echo $array['var $num'];// = Not Interpolated echo $array[var $num];// = Interpolated! echo $array['var '.$num]; // = Interpolated! Of course, an arrray subscript can be any expression, so to go to extremes I could even do something like: $x = 1; $y = 2; $a = 'a'; echo $array['v'.$a.r .($x+$y)]; // = Interpolated! Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form.
Using $_REQUEST[] works because the vars are in the http request, but $_POST[] contains nothing as the other poster noted: mehtod=post -Original Message- From: David Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 1:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. Using $_REQUEST[variable] causes the script to work. Why is this? And, why can I not use $_POST? David Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am going through the introductory tutorial on http://www.php.net/ and am stuck on this page: http://www.php.net/manual/en/tutorial.forms.php I have been able to get all of the examples up to this point to work. The form is simple: it asks for a text name, a text age and has a submit button. The information is submitted to action.php. Action.php contains this code: Hi ?php echo $_POST[name]; ?. You are ?php echo $_POST[age]; ? years old. I saved action.php as a text file with only the information above. When I enter JoeBob into the name field and 27 into the age field, I get this for output: Hi Notice: Undefined index: name in c:\inetpub\wwwroot\action.php on line 1 . You are Notice: Undefined index: age in c:\inetpub\wwwroot\action.php on line 2 years old. What can I do to remedy this? -- 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] Re: Help please: Unable to get $_POST[variable]; to work in a form.
I have corrected the typo and had hoped this was a simple solution, yet $_POST still doesn't work. Any ideas? Craig Thomas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Using $_REQUEST[] works because the vars are in the http request, but $_POST[] contains nothing as the other poster noted: mehtod=post -Original Message- From: David Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 1:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. Using $_REQUEST[variable] causes the script to work. Why is this? And, why can I not use $_POST? David Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am going through the introductory tutorial on http://www.php.net/ and am stuck on this page: http://www.php.net/manual/en/tutorial.forms.php I have been able to get all of the examples up to this point to work. The form is simple: it asks for a text name, a text age and has a submit button. The information is submitted to action.php. Action.php contains this code: Hi ?php echo $_POST[name]; ?. You are ?php echo $_POST[age]; ? years old. I saved action.php as a text file with only the information above. When I enter JoeBob into the name field and 27 into the age field, I get this for output: Hi Notice: Undefined index: name in c:\inetpub\wwwroot\action.php on line 1 . You are Notice: Undefined index: age in c:\inetpub\wwwroot\action.php on line 2 years old. What can I do to remedy this? -- 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] Re: Help please: Unable to get $_POST[variable]; to work in a form.
First, please respond to the list, not me. Second, I'm not asking the question, David Scott is. Third, I don't use either; I use ' ' - Original Message - From: Victor [EMAIL PROTECTED] To: 'Rick Emery' [EMAIL PROTECTED] Sent: Tuesday, December 10, 2002 1:49 PM Subject: RE: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. Why are you using $_POST[]? I thought you had to use $_POST['']. I always use '' instead of and it always works. Is it just me? Can one really use double quotes? -Original Message- From: Rick Emery [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 2:05 PM To: Subject: Fw: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. What version of PHP are you using? I believe that anything earlier than 4.05 does not support $_POST. Did you try $HTTP_POST_VARS['name']? This will work, regardless of version. - Original Message - From: David Scott [EMAIL PROTECTED] To: Sent: Tuesday, December 10, 2002 12:54 PM Subject: Re: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. I have corrected the typo and had hoped this was a simple solution, yet $_POST still doesn't work. Any ideas? Craig Thomas [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Using $_REQUEST[] works because the vars are in the http request, but $_POST[] contains nothing as the other poster noted: mehtod=post -Original Message- From: David Scott [mailto:[EMAIL PROTECTED]] Sent: Tuesday, December 10, 2002 1:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Help please: Unable to get $_POST[variable]; to work in a form. Using $_REQUEST[variable] causes the script to work. Why is this? And, why can I not use $_POST? David Scott [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... I am going through the introductory tutorial on http://www.php.net/ and am stuck on this page: http://www.php.net/manual/en/tutorial.forms.php I have been able to get all of the examples up to this point to work. The form is simple: it asks for a text name, a text age and has a submit button. The information is submitted to action.php. Action.php contains this code: Hi ?php echo $_POST[name]; ?. You are ?php echo $_POST[age]; ? years old. I saved action.php as a text file with only the information above. When I enter JoeBob into the name field and 27 into the age field, I get this for output: Hi Notice: Undefined index: name in c:\inetpub\wwwroot\action.php on line 1 . You are Notice: Undefined index: age in c:\inetpub\wwwroot\action.php on line 2 years old. What can I do to remedy this? -- 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 __ Post your free ad now! http://personals.yahoo.ca -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php