Jump to content

Chronos

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Everything posted by Chronos

  1. I've used the function [url=http://www.php.net/manual/en/function.substr.php]substr[/url] for that one! Works for me! I'd suggest a code of something like this: [code] $output = substr($db_input,0,50)."... [<a href=''>Read more</a>]"; [/code]
  2. Check out this fucntion, using this in combination with some sort function you should be able to make a good (and much simpler  ;)) code! [url=http://www.php.net/manual/en/function.array-count-values.php]array_count_values()[/url]
  3. As far as i know they <Directory> can't be used in .HTACCESS and should be in the HTTPD.conf file. Try this, and put the seperate .HTACCESS files in theire appropriate directories [code] ExpiresActive On AllowOverride Indexes ExpiresDefault "access 3 months" ... [/code]
  4. That's a regex question, please post it in the appropiate subforum :) they can help you
  5. $logcookie = unerialize($_COOKIE['mysite_username']); $mysite_username = $a_cookie[0]; You are trying to assign a cookie variable to $mysite_username where none exist. $logcookie containts the cookie information, not a_cookie in your case :)
  6. Sorry haha, typo :P unserialize(); But, according to this code, i can hack the cookie and put username 'bogus' in it and it will parse as a valid user! Don't forget the security and valditate the cookie. Cookie hacking is one of the most common website hacking methods
  7. try mysql_fetch_array instead of row Then you can call the array vars with their db names. for example, you now call the row identifier with $row[0]. When using mysql_fetch_array you can call it by using $row['id']
  8. Depens on what kind of logon system you use. There are serveral: -Cookies (Mostly used to auto-register the sessions) -Sessions -SQl -HTACCESS In you're case, you are loggin ppl in with HTACCESS, thats fine for now but i suggest you to begin learning SQL database structures. As for now, Retrieving the username is simple: [code] $v_username = $_SERVER['PHP_AUTH_USER']; [/code]
  9. Use a code like this: $ret = serialize(array($userid,md5($username.$password))); Use $ret to store the cookie. Now, when trying to determine which user is trying to log on: $a_cookie = unerialize($_COOKIE['whatever']); Now we have: $a_cookie[0] - The user ID, use this to retrieve the username/password from database. $a_cookie[1] - The validation MD5 Code Now, hash the username/password from the database the same way as you did from the cookie and parse them against eachother! :)
  10. Dunno if it's the case but i my experience cookies with IE is always a drag. Try to manually delete the cookie every time you test a new code. IE Security sometimes prohibits you from altering a already stored cookie
  11. First off, why should you want to create more then one cookie? You should just create one cookie and insert all the info there. You can use the serialize() and array() fucntions for this. This way you only have to worry about one cookie :) Having said that try this: $exptime = 3600 * 24; setcookie("loggedin", "TRUE", time()+$exptime); Then a little tip about you cookie, you're using a username for validate the user! This is never a good idea because i could just hack the cookie and let it think i'm the admin or something. You should always have something that validates the cookie info against the server. I recommend the following code: $cookiehash = md5($username.$password); This way the hacker you has the cookie could recreate the cookie but could never recreate another user which has more rights! :)
  12. As it is a shared webserver the answer should be obivous Contact the administrator  ::)
×
×
  • 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.