define('DB_PASSWORD', 'damniforgot');
$con = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or die("Failed to connect to MySQL: " . mysql_error());
$db = mysql_select_db(DB_NAME, $con) or die("Failed to connect to MySQL: " . mysql_error());
function NewUser()
{
    $fullname = $_POST['name'];
    $userName = $_POST['user'];
    $email = $_POST['email'];
    $password = $_POST['pass'];
    $query = "INSERT INTO Users (fullname,userName,email,pass) VALUES ('{$fullname}','{$userName}','{$email}','{$password}')";
    $data = mysql_query($query) or die(mysql_error());
    if ($data) {
        echo "YOUR REGISTRATION IS COMPLETED...";
        header('Location: http://localhost/agproje/index.php');
    }
}
function SignUp()
{
    if (!empty($_POST['user'])) {
        $query = mysql_query("SELECT * FROM Users WHERE userName = '******'user']}' AND pass = '******'pass']}'") or die(mysql_error());
        if (!($row = mysql_fetch_array($query)) or die(mysql_error())) {
            newuser();
        } else {
            echo "Üzgünüm zaten kayıtlısınız";
            echo "<br><a href='localhost/agproje/Sign-In.html'> oturum açmak için tıklayın </a>'";
        }
    }
}
if (isset($_POST['submit'])) {
    SignUp();
}
Esempio n. 2
0
?>
        <form method="post" action="#">    
            Email : <input name="email" type="text" value="" />
            <br />
            Password : <input name="pass" type="password" value="" />
            <br />
            Retype Password:<input name='validpass' type="text" value="">
            <br />
            <input type="submit" value="Sign Up" />    

        </form>
        <?php 
if (isPostRequest()) {
    $email = filter_input(INPUT_POST, 'email');
    $pass = filter_input(INPUT_POST, 'pass');
    $validpass = filter_input(INPUT_POST, 'validpass');
    if ($pass === $validpass) {
        $isSignedUp = SignUp($email, $pass);
    } else {
    }
    if ($isSignedUp === true) {
        echo "congratulations, you are now signed up for free address booking!";
        echo '<br>';
        echo "You will be redirected to the login page in 5 seconds!";
        echo '<meta http-equiv="refresh" content="5;url=../index.php" />';
    }
}
?>
    </body>
</html>
Esempio n. 3
0
         echo DBSaveComment(-1, $parentPost, $parentComment, $params['content'], $_SESSION['UserID'], 0);
     } else {
         if ($request == 'editComment') {
             echo DBSaveComment($params['cId'], $params['parentPost'], $params['parentComment'], $params['content'], $_SESSION['UserID'], 0);
         } else {
             if ($request == 'deleteComment') {
                 DBDeleteComment($params['cId'], $_SESSION['UserID']);
             } else {
                 if ($request == 'login') {
                     echo Login($params['email'], $params['password']);
                 } else {
                     if ($request == 'logout') {
                         Logout();
                     } else {
                         if ($request == 'signUp') {
                             echo SignUp($params['userName'], $params['emailAddress'], $params['password']);
                         } else {
                             if ($request == 'updateName') {
                                 SaveUserName($_SESSION['UserID'], $params['userName']);
                             } else {
                                 if ($request == 'updatePassword') {
                                     echo SaveUserPassword($_SESSION['UserID'], $params['newPassword'], $params['oldPassword']);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
Esempio n. 4
0
    $name = $firstname . " " . $lastname;
    $email = $_POST['username'];
    $password = $_POST['password'];
    $phonenumber = $_POST['phonenumber'];
    $address = $_POST['address'];
    $securityquestion = $_POST['security_question'];
    $securityanswer = $_POST['security_answer'];
    $query = "INSERT INTO texaskitchen.users (name,fname,lname,password,address,phone,email,security_question,answer,user_groups_id,created,modified) VALUES ('" . $name . "','" . $firstname . "','" . $lastname . "','" . $password . "','" . $address . "','" . $phonenumber . "','" . $email . "','" . $securityquestion . "','" . $securityanswer . "','2',curdate(),curdate());";
    $data = $mysqli->query($query);
    if ($data) {
        header('Location: registration_success.html');
        exit;
        //echo "YOUR REGISTRATION IS COMPLETED...";
    } else {
        header('Location: registration_failure.html');
        exit;
    }
}
function SignUp($mysqli)
{
    if (!empty($_POST['username'])) {
        $query = $mysqli->query("SELECT * FROM users WHERE email = '{$_POST['username']}'");
        if (!($row = $query->fetch_array(MYSQLI_BOTH))) {
            NewUser($mysqli);
        } else {
            echo "SORRY...YOU ARE ALREADY REGISTERED USER...";
        }
    }
}
SignUp($mysqli);
Esempio n. 5
0
		<div class="content">
      <h2>Welcome to Mitt rum</h2>
		
		<?php 
if (!empty($_POST['loginsubmit'])) {
    $username = $_POST['username'];
    $password = $_POST['password'];
    $_SESSION['username'] = $username;
    $_SESSION['password'] = $password;
    login($conn, $username, $password);
}
?>
		<?php 
if (!empty($_POST['signupsubmit'])) {
    if ($_POST["signuppassword"] == $_POST["confirmpassword"]) {
        SignUp($conn);
    } else {
        echo "Password doesn't match";
    }
}
?>

<div id="login">
	<p><?php 
echo messages();
?>
</p>      
	<form method="post" action="">
  <p>Log in:</p>
	<p><label><input type="text" name="username" placeholder="username" value="" /></label></p>
	<p><label><input type="password" name="password" placeholder="password"  /></label></p>
Esempio n. 6
0
    }
    if ($data['password'] != $data['retype']) {
        $error[] = "Invalid password retype.";
    }
    if (strlen($data['password']) < 4) {
        $error[] = "Password too short.";
    }
    if (!isset($_SESSION['signup_captcha']) or $_SESSION['signup_captcha'] !== $data['captcha']) {
        $error[] = "Invalid CAPTCHA.";
    }
    if (!preg_match("/^.+?@.+?\\..+?\$/", $data['email'])) {
        $error[] = "Please provide valid email.";
    }
    unset($_SESSION['signup_captcha']);
    if (empty($error)) {
        SignUp($data);
    }
}
?>
<html>
<head>
<link rel='stylesheet' href='style.css'></link>

</head>
<body>
<?php 
if (!empty($error)) {
    foreach ($error as $err) {
        echo "<div class='error'>{$err}</div>" . PHP_EOL;
    }
}