Re: [PHP] mysql_num_rows()
I tried your script locally. Its working for me. On Tue, Feb 22, 2011 at 11:10 AM, Gary gp...@paulgdesigns.com wrote: Can someone tell me why this is not working? I do not get an error message, the results are called and echo'd to screen, the count does not work, I get a 0 for a result... $result = mysql_query(SELECT * FROM `counties` WHERE name = 'checked') or die(mysql_error()); if ( isset($_POST['submit']) ) { for($i=1; $i=$_POST['counties']; $i++) { if ( isset($_POST[county$i] ) ) { echo You have chosen . $_POST[county$i]. br/; } } } $county_total=mysql_num_rows($result); while($row = mysql_fetch_array($result)) {$i++; echo $row['name']; } $county_total=mysql_num_rows($result); echo $county_total; echo 'You Have ' . $county_total . ' Counties '; ? -- Gary __ Information from ESET Smart Security, version of virus signature database 5894 (20110221) __ The message was checked by ESET Smart Security. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- :DJ
Re: [PHP] Fw: Spoofing user_agent
Use curl http://php.net/manual/en/book.curl.php On Thu, Nov 25, 2010 at 4:41 PM, Shreyas Agasthya shreya...@gmail.comwrote: I feel you should use more of the 4th method here as you are not trying to read the file but the header level (7th layer) information of the HTTP protocol. http://php.net/manual/en/function.file-get-contents.php --Shreyas On Thu, Nov 25, 2010 at 4:11 PM, Ron Piggott ron.pigg...@actsministries.org wrote: Will the header pass with using file_get_contents , or should I be using another command, and if so, which one? Ron ?php header('User Agent: RonBot (http://www.example.com)'); $url = http://www.example.com;; http://www.example.com%22; $input = file_get_contents($url); The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info *From:* Shreyas Agasthya shreya...@gmail.com *Sent:* Thursday, November 25, 2010 4:21 AM *To:* Ron Piggott ron.pigg...@actsministries.org *Cc:* php-general@lists.php.net ; a...@ashleysheridan.co.uk *Subject:* Re: [PHP] Fw: Spoofing user_agent A standard HTTP Request headers is : User Agent (without the underscore). --Shreyas On Thu, Nov 25, 2010 at 2:36 PM, Ron Piggott ron.pigg...@actsministries.org wrote: Is this what you are telling me to do: header('user_agent: RonBot (http://www.theverseoftheday.info)'); Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info From: a...@ashleysheridan.co.uk Sent: Thursday, November 25, 2010 3:34 AM To: Ron Piggott ; php-general@lists.php.net Subject: Re: [PHP] Fw: Spoofing user_agent You need to set it in the header request you make. Putting it in the script you're using as a spider with ini_set won't do anything because the Target site doesn't know anything about it. Thanks, Ash http://www.ashleysheridan.co.uk - Reply message - From: Ron Piggott ron.pigg...@actsministries.org Date: Thu, Nov 25, 2010 08:25 Subject: [PHP] Fw: Spoofing user_agent To: php-general@lists.php.net I have wrote a script to generate a sitemap of my web site. It crawls all of the site web pages. (About 30,000) I need help to spoof the user_agent variable so the stats program running in the background ( “AWSTATS” ) will treat the crawl as a bot, not browsing usage. The sitemap generator is a cron job. I tried the syntax: ini_set('user_agent', 'RonBot (http://www.theverseoftheday.info)/'/); This didn’t work. The browsing was attributed to the dedicated IP address. How do I get AWSTATS to access this, such as other entries under the “Robots/Spiders visitors” heading: Unknown robot (identified by 'bot*') I don’t mean any ill will by changing this setting. Thanks for the help. Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info -- Regards, Shreyas Agasthya -- Regards, Shreyas Agasthya -- :DJ
[PHP] How to prevent duplicate record insertion after refreshing php page
Hi, If I do refresh after submission of a form, records are getting stored multiple times. I have two pages. /submission-form/ and /thank-you/ I was trying header('Location: /thank-you/'); on submission-form page after successful validation and insertion into db. Still if I do refresh on thank-you page it adds one more record in database. How to prevent it without token? -- Devendra Jadhav देवेंद्र जाधव
Re: [PHP] How to prevent duplicate record insertion after refreshing php page
Yeah... Done... Got the solution... You need to do exit(0); after the header().. die() wont work... On Wed, May 19, 2010 at 5:42 PM, Ashley Sheridan a...@ashleysheridan.co.ukwrote: On Wed, 2010-05-19 at 17:43 +0530, Deva wrote: Hi, If I do refresh after submission of a form, records are getting stored multiple times. I have two pages. /submission-form/ and /thank-you/ I was trying header('Location: /thank-you/'); on submission-form page after successful validation and insertion into db. Still if I do refresh on thank-you page it adds one more record in database. How to prevent it without token? Before inserting the data, perform a query that asks for the count of records with that data in it. If you get a record, then don't insert the data. This assumes that the data in the row is always unique. If it's something like adding a stats record, then have some sort of time comparison against the current time and the date entry of the latest matching record. Thanks, Ash http://www.ashleysheridan.co.uk -- Devendra Jadhav देवेंद्र जाधव
Re: [PHP] How to prevent duplicate record insertion after refreshing php page
wtf now its working for die() also.. weird need to figure out what happened... On Wed, May 19, 2010 at 6:00 PM, Peter Lind peter.e.l...@gmail.com wrote: On 19 May 2010 14:23, Deva devendra...@gmail.com wrote: Yeah... Done... Got the solution... You need to do exit(0); after the header().. die() wont work... That's rather odd, according to the docs die() and exit() are equivalent. You're sure nothing else changed? Also, note that you should consider using form tokens, so you don't get caught by double submits and cross site form posts, etc. Regards Peter -- hype WWW: http://plphp.dk / http://plind.dk LinkedIn: http://www.linkedin.com/in/plind Flickr: http://www.flickr.com/photos/fake51 BeWelcome: Fake51 Couchsurfing: Fake51 /hype -- Devendra Jadhav देवेंद्र जाधव
Re: [PHP] simplexml choking on apparently valid XML
I think that should be amp; because you cant use in xml as independent alphbet On 5/7/10, Dan Joseph dmjos...@gmail.com wrote: On Thu, May 6, 2010 at 8:02 PM, Brian Dunning br...@briandunning.comwrote: Hey all - I'm using simplexml-load-string just to validation a string of XML, and libxml-get-errors to return any errors. It's always worked before, but today it's choking on this line in the XML: client_orderitem_numberBasketball Personalized Notebook - Jeffapos;s/client_orderitem_number It's returning Premature end of data in tag client_orderitem_number line 90 but as far as I can tell, Jeffapos;s is properly XML encoded. I can't debug this. Any suggestions? I have run the XML through a couple of online validators and it does come back as valid with no errors found. http://www.php.net/unsub.php I had this problem It turned out to be some special characters in the tags or data that I had to strip out first, then load it thru the simplexml parser. I will have to check my code when I get back to the office in the AM and I'll let you know what it was if you haven't figured it out by then. But that might get you started in fixing it. -- -Dan Joseph www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry -- Sent from my mobile device Devendra Jadhav देवेंद्र जाधव -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] simplexml choking on apparently valid XML
- amp; added space because browser is converting it to :) On 5/8/10, Deva devendra...@gmail.com wrote: I think that should be amp; because you cant use in xml as independent alphbet On 5/7/10, Dan Joseph dmjos...@gmail.com wrote: On Thu, May 6, 2010 at 8:02 PM, Brian Dunning br...@briandunning.comwrote: Hey all - I'm using simplexml-load-string just to validation a string of XML, and libxml-get-errors to return any errors. It's always worked before, but today it's choking on this line in the XML: client_orderitem_numberBasketball Personalized Notebook - Jeffapos;s/client_orderitem_number It's returning Premature end of data in tag client_orderitem_number line 90 but as far as I can tell, Jeffapos;s is properly XML encoded. I can't debug this. Any suggestions? I have run the XML through a couple of online validators and it does come back as valid with no errors found. http://www.php.net/unsub.php I had this problem It turned out to be some special characters in the tags or data that I had to strip out first, then load it thru the simplexml parser. I will have to check my code when I get back to the office in the AM and I'll let you know what it was if you haven't figured it out by then. But that might get you started in fixing it. -- -Dan Joseph www.canishosting.com - Unlimited Hosting Plans start @ $3.95/month. Promo Code NEWTHINGS for 10% off initial order http://www.facebook.com/canishosting http://www.facebook.com/originalpoetry -- Sent from my mobile device Devendra Jadhav देवेंद्र जाधव -- Sent from my mobile device Devendra Jadhav देवेंद्र जाधव -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php