Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- mysql_connect("localhost", "localhost", "") or die (mysql_error()); //mysql connect
- mysql_select_db("users") or die(mysql_error()); //select database
- //Are you already logged in?
- //database connect
- /* if (isset($_COOIKE['username'] | $_COOKIE['password']))
- {
- $check_info_query=mysql_query("SELECT * FROM user WHERE $_COOKIE['username']=username AND $_COOKIE['password']=password");
- if (mysql_num_rows($check_info_query) == 0)
- {
- header("location:login_form.php");
- }
- else
- {
- header("location: view_gallery.php");
- }
- }
- */
- //define post variables--secure password
- $password= $_POST['password'];
- $username= $_POST['username'];
- $password_salt= "#@%*$)@ Aren't you GLAD you aren't ME 23903q8509#*@(@";
- $password_secure= md5(sha1($password.$password_salt));
- //require all entries
- if (!$password | !$username)
- {
- die ("Oops! You forgot to enter something!");
- {
- $search_username=mysql_query("SELECT * FROM users WHERE '$username'=username");
- if ($search_username==0)
- {
- die ("Incorrect username or password");
- }
- $check_password=mysql_fetch_array($search_username);
- if ($check_password['password'] != $password_secure)
- {
- die ("Incorrect username or password");
- }
- else
- {
- setcookie("password", $password_secure, time()+3600*24*30);
- setcookie("username", $username, time() + 3600*24*30);
- // header('location:view_gallery.php');
- }
- ?>
Add Comment
Please, Sign In to add comment