コード例 #1
0
ファイル: signup.php プロジェクト: Gameonn/curler-class
 if (!empty($result['email'])) {
     $success = "0";
     $msg = "User already exist!";
 } else {
     if (!empty($profile_pic)) {
         $randomFileName = GeneralFunctions::randomFileNameGenerator("Img_") . "." . end(explode(".", $profile_pic['name']));
         if (@move_uploaded_file($profile_pic['tmp_name'], "../uploads/{$randomFileName}")) {
             $success = "1";
             $url = $randomFileName;
         }
     }
     if (!$url) {
         $url = "default_user.png";
     }
     if (!empty($cover_pic['name'])) {
         $randomFileName = GeneralFunctions::randomFileNameGenerator("Img_") . "." . end(explode(".", $cover_pic['name']));
         if (@move_uploaded_file($cover_pic['tmp_name'], "../uploads/{$randomFileName}")) {
             $success = "1";
             $url1 = $randomFileName;
         }
     }
     if (!$url1) {
         $url1 = "default_user.png";
     }
     // Initialize the hasher without portable hashes (this is more secure)
     $hasher = new PasswordHash(8, false);
     // Hash the password.  $hashedPassword will be a 60-character string.
     $hashedPassword = $hasher->HashPassword($password);
     $sql = "insert into `users` values(DEFAULT,:name,:profile_pic,:cover_pic,:email,:password,'',:dob,:gender,:token,now(),'','')";
     $stmt = $conn->prepare($sql);
     $stmt->bindParam(':name', $name);