Jump to content

GetPutDelete

Members
  • Posts

    70
  • Joined

  • Last visited

    Never

Everything posted by GetPutDelete

  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.
  14. Hey guys, does anyone know of sites similar to http://builditwith.me ? I'm looking for some which are a bit more active, thanks.
  15. Hey, nice job. One thing that you absolutely positively can't be without is validation. I've got a ton of sites that I've developed and even the least popular with say less than 100 visitors a month get their forms spammed by bots and people who don't take the time to fill everything in correctly. So the whole point of validation is to make sure that the form is filled in the way you want it to be, so you want to start by adding a check to make sure that the return email address is correctly formatted (for example check there is a @ sign and at least one period [.]) and that the subject and message are filled in. Then if you want to make it really user friendly add javascript validation on top of your PHP validation, this will give the user a nice experience when they insert data incorrectly. Good luck and have fun. PS The functions you want are strpos (to determine if a character exists, the function returns true if there is and false if not) and strlen (determines the string length, for subject and message fields).
  16. If you're going to let the user choose their own password then you need to encrypt it (need as in ethically), if you are automatically generating them then just don't worry about encryption. An alternative to your problem could be to use a generated session hash as a GET variable instead of the password, then in the db the session hash will be associated to the users account and you can go from there.
  17. AHHHH My EYES.... *Jumps out of window*
  18. Ahh wow, can't believe I've never come across that before. Cheers pal.
  19. I've been pondering sticking my neck a bit further into the world of social media and as it happens I've got a few months with relatively little else going on which presents a great opportunity to make a move on it. But in the social networking world finding a niche isn't exactly the easiest thing to do. So do any of you, wise phpfreaks, have any ideas to share or projects which you could use another pair of hands?
  20. Glad to help Just fyi the escapes are the backslashes (\) they let you maintain the same quotes inside of each other, for example if you wanted to do echo 'My name's Bob'; it would actually end the string in the word name's due to the quote. To get round this you do echo 'My name\'s Bob'; that way it will output My name's Bob.
  21. I've escaped the quotes for you, this will make sure it remains part of the string. (Notice the colour change). Also I've added a ; to the end of the function to end it. <?php /** * @version 1.0 $ * @package cbprofilecall * @copyright (C) 2008 OohYa Chat * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL **/ /** ensure this file is being included by a parent file */ defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' ); $dummyURl = sefRelToabs( 'http://www.oohya.net/index.php?option=com_comprofiler&task=userProfile& amp;user=\'%USER%\''); ?>
  22. You forgot to close the bracket on the md5 function. Errors mean something, in the future please post yours.
  23. Erm... If you want to erase the contents of a div use document.getElementById('DIV NAME') = ''; Sorry if that's not what you wanted.
×
×
  • 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.