Jump to content
Larry Ullman's Book Forums

Jonathon

Members
  • Posts

    1064
  • Joined

  • Last visited

  • Days Won

    55

Posts posted by Jonathon

  1. A wise decision wframe. I can't think why you want to delete the entire user. Unless they are maybe being malicious with their use.

     

    If ti were me i'd have a column called active and give a boolean value. So if the the person is active they would have a value of 1 or 0 if false. Then you maintain all their information and they just have to update something in their profile or system to make themselves active again.

     

    i've not looked into your query in much depth but i'd say the comma after "NOT NULL" is not needed.

     

    Why are you setting the password to NOT NULL too?

     

    Do forgive me if its in the earlier posts I have only scan read them

     

    Jonathon

    • Upvote 1
  2. Yes I must say its not the first and I doubt the last set of benchmarks I'll see. And there doesn't seem to be a universally accepted speed for anything really. Some of those figures listed are strange, especially _once() after you mentioned the overhead it uses. But 'apparently' its 24% faster than include.

     

    I don't think anyone can really know the precise implementations on performance to be honest.

     

    However, I would like to know if xcache_set() really is 1,645% faster than file_put_contents(). Just because its such huge %.

     

    Some people also unduly stress the importance of speed.

     

    I've seen it quite a lot around the web and forums, things like @ is really slow blah blah. It may be slower I guess, but whenever I've used it i've never thought, damn, the @ is making my script too slow, better remove it.

     

    Jonathon

    • Upvote 1
  3. Hi Larry,

     

    Thanks for getting back to me. To clarify what i did. I downloaded the Net_Geo, except I had probelems with it. So I also tried Net_GeoIP to no avail. SO.... I started again. Deleted both the folders and tried to download Net_Geo using the pear installer within xampps shell. This failed, regarding the package.xml message referenced in my earlier reply. So I went in manually to my downloads and extracted the files and put them inside the Net folder. So I do have Geo.php now and it seems to be the right one.

     

    However my Country,City,State,Lat,Long are all blank when I try to access an IP. The IP is being passed through ok and i've looked into the Geo.php file itself to try and see if there is anything I think that could be causing it. I can't see anything and it doesn't error.

     

    Would you be able to add any expertise when it comes to debugging?

     

    Thanks

     

    Ps - looking forward to your js book

     

    - To update this post. I've looked into my pear set up and I have done something to it that has rendered it pretty useless for installing packages. I'm getting a new one in the next couple months so I shall install pear again and fix it. Thanks for your help though. :)

  4. Hi Larry,

     

    I've just added my signature to my posts. Sorry i forgot to yesterday.

     

    I'm using GeoIP.php,v 1.3 2006/06/07

    I'm using PHP 5.3.1

    And i used the pear command installer through xampp to get the package using

    pear install Net_Geo

     

     

     

    I've actually just updated my PEAR package to 1.9.2 and thought, maybe I should try to upgrade my Net_Geo too and hope it works, but this failed:

     

    "Could not extract the package.xml file, this goes on to say couldn't create directory, unable to create path and then finally, Download of "pear/Net_Geo succeeded but it is not a valid package archive.

     

    But in my Net folder download the only files provided were GeoIP.php, SMTP.php and Socket.php so there was no Geo.php that was is referenced in the book. I do have a Geo.php but it is within a Zend folder that came (I think) with xampp. I have had a look over this file too, but couldn't get that to work i'm afraid.

     

    Thanks for the reply,

     

    I like the enw forum too

     

    Jonathon

  5. Hello,

     

    I just wondered if anyone had experienced a similar problem that I have with PEAR during Larry's example. I have installed the package from PEAR for IP Geolocation, except my package doesnt include a file called Geo.php. It does however include a GeoIP file, which I have tried to use in place of the Geo.php. However running Larry's script (from his folder) through that (just so I knew it wasnt a type error on my part, or at least hoped it wasnt!!)) I get the following error:

     

    "Call to private method Net_GeoIP::getRecord() from context"

     

    - I know what the error means thanks to the previous chapters and I have tried making the methods public, but this in turn sprung up more errors.

     

    I did also try and use the GEO_IP (beta) package but that was also unfortuantely to no avail.

     

    I wondered if anyone else had experienced a similar problem, or new of a fix??

     

    Here is my code for the file, just in case it is my error:

    require_once('C:\Documents and Settings\Simon\My Documents\Microbiology\xampp\php\PEAR\Net\GeoIP.php');

     

    // Create the object

    $net_geo = new Net_GeoIP();

     

    // Get the clients IP address

    $ip = $_SERVER['REMOTE_ADDR'];

     

    // Get the information

    $results = $net_geo->getRecord($ip);

     

    // Print whatever about the user

    echo "<p>Our spies tell us the following information about you:<br />

    IP Address: $ip<br />

    Country: {$results['COUNTRY']}<br />

    City, State: {$results['CITY']}, {$results['STATE']}<br />

    latitude: {$results['LAT']}<br />

    Longitude: {$results['LONG']}</p>";

     

    // Print something about a site:

    $url = 'www.apple.com';

     

    // Get the IP address

    $ip = gethostbyname($url);

     

    // Get the information

    $results = $net_geo->getRecords($ip);

     

    // Print whatever about the url

    echo "<p>Our spies tell us the following information about the URL $url:<br />

    IP Address: $ip<br />

    Country: {$results['COUNTRY']}<br />

    City, State: {$results['CITY']}, {$results['STATE']}<br />";

     

    ?>

×
×
  • Create New...