From ca784b878869279c95deaaadb754f17646e172dc Mon Sep 17 00:00:00 2001 From: Neku Date: Sun, 15 Dec 2013 10:17:54 +0100 Subject: some changes --- moe/core.php | 71 ------------------------------------------------------------ 1 file changed, 71 deletions(-) delete mode 100644 moe/core.php (limited to 'moe/core.php') diff --git a/moe/core.php b/moe/core.php deleted file mode 100644 index c2a5c67..0000000 --- a/moe/core.php +++ /dev/null @@ -1,71 +0,0 @@ -prepare("SELECT password FROM users WHERE username = (:user)"); - $do->bindParam(':user', $username); - $do->execute(); - $pass = $do->fetch(); - - // Check if hash is the same as the one in DB - if($pass['0']===$password){ - // Return good result - $return = array('action' => 'cp', 'info' => 'Logged in.'); - }else{ - // Return bad result - $return = array('info' => 'Wrong username or password, try again.'); - } - // Return result with JSON - json_encode($return); -) - -// Registration function -function register ($username, $password, $email) { - global $db; - - // Check if username, email, etc exists - $do = $db->prepare("SELECT user,email FROM users WHERE username = (:user) OR email = (:email)"); - $do->bindParam(':user', $username); - $do->bindParam(':email', $email); - $do->exeute(); - $count = $do->rowCount(); - - // If already exists display mess, otherwise continue - if(!$count==='0'){ - // Return result - $return = array('info' => 'User already exists.'); - }else{ - // Generate password hash - $hash = password_hash($password, PASSWORD_BCRYPT, bsettings)."\n"; - // Register new user - $do = $db->prepare("INSERT INTO users (username, password, email, date) VALUES (:user, :pass, :email, :date)"); - $do->bindParam(':user', $username); - $do->bindParam(':pass', $hash); - $do->bindParam(':email', $email); - $do->bindValue(':date', date('Y-m-d')); - $do->exeute(); - // Return that user has been made and goto login - $return = array('action' => 'login', 'info' => 'User has been made, login.'); - } - // Return JSON - json_encode($return); -} - -function delete ($id, $delid) { - global $db; - -} -?> \ No newline at end of file -- cgit v1.2.3