require 'test.php'; session_start(); if (isset($_POST['send'])) { $email = trim($_POST['email']); $password = md5(trim($_POST["password"])); if (isset($_POST['email']) && $_POST['email'] !== "" && (isset($_POST['password']) && $_POST['password'] !== "")) { $activate = md5(uniqid(rand(), true)); $q1 = "SELECT IF(EXISTS(SELECT id FROM reg WHERE email_id='{$email}'),1,0)"; $val = mysqli_query($connection, $q1); $val1 = mysqli_fetch_assoc($val); $val2 = $val1["IF(EXISTS(SELECT id FROM reg WHERE email_id='{$email}'),1,0)"]; if ($val2) { $q = "UPDATE reg SET activation='0',password='******',act_com='{$activate}' where email_id='{$email}'"; $result = mysqli_query($connection, $q); if ($result) { mymail1($email, "click on the below link to login", $activate); $_SESSION['re_act'] = "Check your mail for Re-activation"; } else { $_SESSION['wrong_email'] = "Somthing Wrong"; } } } else { if ($email == "") { $_SESSION['blank_email'] = "email can't be blank"; } if ($_POST["password"] == "") { $_SESSION['blank_passs'] = "Password can't be blank"; } //$_SESSION['no_act']="Please Enter values "; } }
} //for username verification $q2 = "SELECT id FROM reg where user_name='{$username}'"; $res2 = mysqli_query($connection, $q2); if ($rows = mysqli_fetch_assoc($res2)) { $errors["username"] = ucfirst("username") . "already used"; } $output = form_errors($errors); //end of validations if (!$output) { //creating new unique activation code $activate = md5(uniqid(rand(), true)); $q = "INSERT INTO reg (user_name, \n\t\t\tpassword, \n\t\t\temail_id, \n\t\t\tfirst_name, \n\t\t\tlast_name, \n\t\t\tmiddle_name, \n\t\t\tph_no, \n\t\t\tgender, \n\t\t\tmarital, \n\t\t\temployement, \n\t\t\temployer, \n\t\t\tstreet, \n\t\t\tcity, \n\t\t\tstate, \n\t\t\tzip, \n\t\t\tfax, \n\t\t\tstreet1, \n\t\t\tcity1, \n\t\t\tstate1, \n\t\t\tzip1, \n\t\t\tfax1, \n\t\t\tcomment, \n\t\t\tdob, \n\t\t\timg, \n\t\t\tcheck1,\n\t\t\tact_com) \nVALUES ('{$username}',\n\t'{$password}', \n\t'{$email}', \n\t'{$first_name}', \n\t'{$last_name}', \n\t'{$middle_name}', \n\t'{$pno}', \n\t'{$gender}', \n\t'{$marital}', \n\t'{$employement}', \n\t'{$employer}', \n\t'{$street}', \n\t'{$city}', \n\t'{$state}', \n\t'{$zip}', \n\t'{$fax}', \n\t'{$street1}', \n\t'{$city1}', \n\t'{$state1}', \n\t'{$zip1}', \n\t'{$fax1}', \n\t'{$comment}', \n\t'{$dob}', \n\t'{$img_var}', \n\t'{$check}',\n\t'{$activate}')"; if (mysqli_query($connection, $q)) { $subject = "Activation mail"; $var1 = mymail1($email, $subject, $activate); $_SESSION['active_msg'] = "Activation link sent to your mail"; header("Location:login.php"); } else { ?> <div class="colo"><?php echo "Error: " . $q . "<br>" . mysqli_error($connection); ?> </div><?php } } } ?> <div class="col-lg-12 h1 well"> <center> Registration Form</center> </div>