Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $resp = array();
- $username = $_GET["username"];
- $password = $_GET["password"];
- $resp['submitted_data'] = $_POST;
- $login_status = 'invalid';
- $con = mysql_connect("localhost","u246282950_deer","Daman12345!");
- mysql_select_db("u246282950_main",$con);
- if ($username && $password){
- $name = mysql_real_escape_string($username);
- $pass = mysql_real_escape_string($password);
- $user = mysql_fetch_array(mysql_query("SELECT * FROM users WHERE username=".$name)) or die($myQuery."<br/><br/>".mysql_error());;
- if ($user[password] != $pass){
- die("Incorrect password");
- }
- $login_status = 'success';
- }
- $resp['login_status'] = $login_status;
- if($login_status == 'success')
- {
- $salt = hash("sha512", rand().rand().rand());
- setcookie("c_user", hash("sha512", $username, time() + 24 * 60 * 60, "/"));
- setcookie("c_salt", $salt, time() + 24 * 60 * 60, "/");
- $userID = $user["ID"];
- mysql_query("UPDATE users SET Salt = '$salt; WHERE ID = '$userID'");
- $resp['redirect_url'] = '';
- }
- echo json_encode($resp);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement