[PHP] Looking for complete entered URL

2013-04-20 Thread Angela Barone
I've written a script that logs all visits to a web site, complete with referrer and IP address. It also logs all 4xx errors. What I'd like to add to this is, if someone adds extra code after the page_name.php, to be able to capture any extra code and log that. I've tried: $_

[PHP] Detecting massive web hits

2013-04-12 Thread Angela Barone
Does anyone know if there's a ready-made script that detects if someone hits multiple web pages within seconds of each other and then can temporarily ban them by IP from accessing our site? Looking through the logs, I see someone/something hit each and every page of a site I wor

Re: [PHP] Mystery foreach error

2013-03-13 Thread Angela Barone
On Mar 13, 2013, at 5:02 PM, David Harkness wrote: > isset() will return false for an array key 'foo' mapped to a null value > whereas array_key_exists() will return true. The latter asks "Is this key in > the array?" whereas isset() adds "and is its value not null?" While isset() > is every-so-

Re: [PHP] Mystery foreach error

2013-03-13 Thread Angela Barone
On Mar 13, 2013, at 4:24 PM, Matijn Woudt wrote: > That wouldn't work, in_array checks the values, and your states are in the > keys. Use: > if(isset($states[$state])) Hi Matijn, Before I received your email, I ran across if(array_key_exists) and it seems to work. How does that differ

Re: [PHP] Mystery foreach error

2013-03-13 Thread Angela Barone
On Mar 13, 2013, at 9:07 AM, Jim Giner wrote: > Why not just check if the $state exists as a key of the array $states before > doing this? Jim, Are you thinking about the in_array function? Angela

Re: [PHP] Mystery foreach error

2013-03-12 Thread Angela Barone
On Mar 12, 2013, at 5:16 PM, David Robley wrote: > Presumably there is a fixed list of State - those are US states? - > so why not provide a drop down list of the possible choices? There is, but the problem must have been that if someone didn't select a State, $state was blank. I've sin

Re: [PHP] Mystery foreach error

2013-03-12 Thread Angela Barone
I think I figured it out. array( '350','351','352','353', ), 'AK' => array( '995','996','997','998','999', ), 'AZ' => array( '850','851','852','853','854', ), 'WI' => array( '530','531','532', ), 'WY' => array( '820','821','822','823','824', ), ); $zip = 35261; $state =

Re: [PHP] Mystery foreach error

2013-03-12 Thread Angela Barone
On Mar 12, 2013, at 2:26 PM, Marco Behnke wrote: > what is in $states? > Looks like $states[$state] is not an array. Here's a sample: array( '350','351','352','353', ), 'AK' => array( '995','996','997','998','999', ), 'AZ' => array( '850','851','852','853','854', ), ...

[PHP] Mystery foreach error

2013-03-12 Thread Angela Barone
I've been getting the following error for awhile now, but I can't figure out why it's happening: Invalid argument supplied for foreach() in ... sample.php on line 377 Here's that portion of code: include("states_zipcodes.php"); // Check if Zip Code matches from states_zipcodes

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
On Mar 11, 2013, at 4:10 PM, Jonathan Sundquist wrote: > the variable $current_page does not exist. That was my problem. :( I've been staring at this for too long. Too bad there's not a 'use strict' pragma. > I would also suggest keeping with your original statement to return early an

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
On Mar 11, 2013, at 3:47 PM, Ashley Sheridan wrote: > if ( !( ($current_page == $saved_page) and ($current_ip == $saved_ip) and > ($current_dt < ($saved_dt + 3600)) ) ) Hello Ash, This makes sense to me, but I can't get it to work, so I'm either not understanding it or I'm asking the wr

Re: [PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
On Mar 11, 2013, at 2:38 PM, Jonathan Sundquist wrote: > Since you already have the return statement with the if statement the else > isn't required. If those three statements are true you would exit the call > any ways I don't follow. The else contains the meat of the statement. Ang

[PHP] UNLESS Statement Equivalent

2013-03-11 Thread Angela Barone
I'm looking for an 'unless' statement, but as far as I can tell, PHP doesn't have one. Hopefully someone can help me rewrite my statement. In English, I want to say: "always do something UNLESS these 3 conditions are met". The best I've been able to come up with in PHP

Re: [PHP] Not counting my own page visits

2013-03-05 Thread Angela Barone
On Mar 4, 2013, at 3:49 PM, David Robley wrote: > Misunderstanding what $cookie contains? It is a boolean, i.e. it will be > true or false depending on whether the cookie was set or not. To echo the > contents of a cookie, you need to use the cookie name, viz > > "; ?> You're right - I

Re: [PHP] Not counting my own page visits

2013-03-04 Thread Angela Barone
On Mar 4, 2013, at 11:33 AM, Ashley Sheridan wrote: > You can manually write a cookie on your machine, or use a special script that > only you visit that contains a setcookie() call (it only need be set once). > From there on, you can check the $_COOKIES super global for the presence of > your c

Re: [PHP] Not counting my own page visits

2013-03-04 Thread Angela Barone
On Mar 4, 2013, at 9:56 AM, Ashley Sheridan wrote: > set a cookie with a long life and check for that, discounting visits when > either are true Hi Ash, I don't know anything about cookies. It sounds complicated to me. Is there a simple way to set one? Thanks, Angela -- PHP General M

Re: [PHP] Not counting my own page visits

2013-03-04 Thread Angela Barone
On Mar 4, 2013, at 9:52 AM, Tommy Pham wrote: > What about ignoring $_SERVER['REMOTE_ADDR'] or $_SERVER['REMOTE_HOST'] > where that matches your public IP or FQDN? Hi Tommy, I am checking for $_SERVER['REMOTE_ADDR'] but how would I check that against mine? I don't have a static IP. Tha

[PHP] Not counting my own page visits

2013-03-04 Thread Angela Barone
Hello, I have a script that counts hits to all the pages in my site and emails me a report nightly. However, it also counts my visits to my site, and when I'm coding, I'm hitting a lot of my pages, repeatedly. I'd like to find a way to not count my page visits. At first, I th

Re: [PHP] Complex MySQL query for lowest price

2013-02-01 Thread Angela Barone
Thank you for everyone's input. Someone suggested the MySQL list, so I posted my question there and got the answer I needed. Regards, Angela -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] Complex MySQL query for lowest price

2013-01-31 Thread Angela Barone
Hello, I have a formula that says, if 'specialprice' is not empty and it is lower than 'unitprice', use 'specialprice', otherwise use 'unitprice': Your Price: $%s', number_format(mysql_result($result,0,"used_price"),2)); ?> What I'd like is to add a starting and ending date and