Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- if(count($_FILES) > 0 && isset($_POST['terms'])) {
- if(is_uploaded_file($_FILES['image']['tmp_name'])) {
- include '././php_add_ons/stuff/connect.php';
- $password1 = $_POST['password1'];
- $password2 = $_POST['password2'];
- $imgData = addslashes(file_get_contents($_FILES['image']['tmp_name']));
- $imageProperties = getimagesize($_FILES['image']['tmp_name']);
- if($password1 == $password2)
- {
- $user = $_POST['userName'];
- $userImage = $_POST['userName'];
- $password = $_POST['password1'];
- $email = $_POST['email'];
- if(isset($user) && !empty($user) && isset($email) && !empty($email)){
- if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){
- // Return Error - Invalid Email
- $msg = 'The email you have entered is invalid, please try again.';
- }
- else{
- $check = mysqli_query($con, "SELECT * FROM user");
- $checkUser = mysqli_fetch_assoc($check);
- if($user == $checkUser['User_Name'] || $email == $checkUser['User_Email']){
- echo "The user name or email is already registered.";
- }
- else{
- $sql = "INSERT INTO user(User_Name,Image_Name, User_Password, User_Email, Image_Type, User_Image) VALUES ('$user', '$userImage', md5('$password'), '$email', '{$imageProperties['mime']}', '{$imgData}')";
- $current_id = mysqli_query($con, $sql) or die("<b>Error:</b> Problem on Insert information<br/>" . mysqli_error($con));
- $sqlLogin = mysqli_query($con, "SELECT * FROM user WHERE User_Name = '$user' AND User_Password = md5('$password')");
- $count = mysqli_num_rows($sqlLogin);
- if($count == 1)
- {
- $row = mysqli_fetch_assoc($sqlLogin);
- setcookie("user", $row["User_Name"]);
- header ("Location: ././After_Login/index.php");
- }
- }
- }
- }
- }
- else {
- Echo "Your passwords did not match.";
- }
- }
- }else {
- echo "You must accept the terms.";
- }
- ?>
Add Comment
Please, Sign In to add comment