Jump to content

GetPutDelete

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Contact Methods

  • Website URL
    http://www.youtube.com/user/awesomePHP

Profile Information

  • Gender
    Male
  • Location
    London, UK

GetPutDelete's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. You're right it gets a unique hash for the user, it can be used for whatever you like (like identifying a user). But I always prefer to create my own hashes, to do this I usually hash a combination of the user id (or ip address), microtime and a random number. for example... <?php $hash =md5($user_id . microtime() . mt_rand(1, 99999)); ?>
  2. Ok, unset will only work with sessions, you can either unset an individual session variable or clear the whole lot by using session_destroy(), to clear a cookie you need to set the cookie to expire in the past.
  3. 1. Do you mean unset? 2. If you set it to '/' then it will be available across your whole site (I'd recommend this). 3. No, but with sessions you need to use session_start() at the top of the page.
  4. You could use str_replace to put markers in the code and then remove things between the markers, I did that once on a similar project when I didn't know what I was doing, turned out I could have done it 10 times quicker and easier with preg_replace.
  5. Seems a bit unnecessary. Execution time will take several times longer now when just using a salt of 64 char's is more than enough.
  6. Google search, three seconds, first result. http://www.intelliot.com/blog/2008/03/sorted-directory-listing-image-resizing-comparison-and-similarity-in-php/
  7. Something like this... <label> <input type="radio" name="radio" id="radio" value="radio"<?php if(mysql_num_rows(mysql_query(...)) == 1) { echo ' checked'; } ?> ></label>
  8. Ooh, welcome to Object Orientated Programming, I'd suggest this tutorial (http://www.killerphp.com/tutorials/object-oriented-php/) It will explain everything you need to know about the scope resolution operators ( -> ) and ( :: )
  9. Check that session_start(); appears before anything has been outputted to the browser.
  10. Ok so first create a table called ip_log with the fields 'id' - set to auto increment & int, 'ip' - set to char (15). To check use <?php //Check if user has already visited if(mysql_num_rows(mysql_query("select `ip` from ip_log where ip='" . $_SERVER['REMOTE_ADDR'] . "' limit 0, 1")) == 1) { //Redirect user header('Location: ...Location Here...'); } else { //Log visit mysql_query("insert into ip_log (`ip`) values ('" . $_SERVER['REMOTE_ADDR'] . "')"); } ?>( Place the rest of the site below, and don't forget to set the database login details.
  11. Hey, You should create a table inside your database called IP Addresses and then when a user visits the site, insert the IP Address to the database, but just prior to this have PHP check to see if the IP address is already in the database, if it is then you can redirect the user away. Be careful though, IP Addresses are rarely static It's possible that users who haven't visited the site before will get redirected away.
  12. I don't think it has to do with your network as temp sessions are stored locally, I'd check your code.
  13. You have two options, you can use MySql Load or you can parse the file into PHP and then insert it into the db.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.