Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- function callback($member) {
- require_once ($_SERVER['DOCUMENT_ROOT'] . '/settings/index.php');
- }
- spl_autoload_register('callback');
- if (isset($_SESSION['username'])) {
- header('Location:http://blog.agwconitsha.org/');
- }
- $first_name = $_POST["first_name"];
- $last_name = $_POST["last_name"];
- $email = $_POST["email"];
- $password = password_hash($_POST["password"], PASSWORD_BCRYPT);
- $username = $first_name . '_' . $last_name;
- $confirm_id = mt_rand();
- if (!empty($email)) {
- $message = "<!DOCTYPE html>
- <html>
- <head>
- <link href='https://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
- <link href='https://fonts.googleapis.com/css?family=Raleway' rel='stylesheet' type='text/css'>
- <title> Confirm From AGWCOnitsha Blog</title>
- </head>
- <body style='background-color:#f1f1f1;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;color:#757575;font-family:lato, sans-serif;' >
- <main style='width:90%;margin-top:1%;margin-bottom:1%;margin-right:auto;margin-left:auto;' >
- <div style='display: flex;flex-flow: row nowrap;justify-content: space-around;'><h1 style='font-family:raleway, sans-serif;color:#999;' >AGWC Onitsha</h1> <img src='http://agwconitsha.org/logo.png' style='height:11%;width:17%;max-height:100%;max-width:100%;' ></div>
- <section style='background-color:#f9f9f9;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;padding-top:2%;padding-bottom:2%;padding-right:2%;padding-left:2%;' >
- <h3>Hi $first_name $last_name,</h3>
- <p id=welcome style='margin-top:-15px;margin-bottom:35px;color:#999;' >welcome to AGWC Blog</p>
- <p>Please click on the button below to confirm your email and complete the sign up to AGWC Onitsha</p> <br>
- <span style='background-color:#337ab7;background-image:none;background-repeat:repeat;background-position:top left;background-attachment:scroll;border-radius:3px;padding-top:1%;padding-bottom:1%;padding-right:1%;padding-left:1%;font-size:90%;' ><a href='http://agwconitsha.org/blog/register/confirm.php?id=" . $confirm_id . "&email=" . $email . "' style='color:#fff;text-decoration:none;' >CONFIRM </a></span> <br>
- <p>72A New Market Road Onitsha Anambra Nigeria </p>
- </section>
- </main>
- </body>
- </html>";
- $to = $email;
- $subject = "Confirm AGWC Onitsha sign up";
- $header = 'MIME-Version: 1.0' . "\r\n". 'Content-type: text/html; charset=utf-8' . "\r\n" . 'From: ' . "support@agwconitsha.org";
- $conn = new mysqli("localhost", "root", "41657", "adb");
- if (mysqli_connect_errno()) {
- die ("Couldn't connect because " . mysqli_connect_error());
- }
- else {
- $email_in_use = "SELECT email FROM users WHERE email='" . $email . "'";
- if ($conn = $conn->query($email_in_use)) {
- if ($conn->num_rows > 0) {
- return "<p style='color: red' id='errorText'> sorry. email in use by another user </p>";
- }
- else {
- $username = $usernameCheck($username);
- $sign_up_date = date("Y-m-d H:i");
- $last_login = $sign_up_date;
- $b = "INSERT INTO confirm VALUES ($first_name, $last_name, $email, $password, $username, $sign_up_date, $last_login, $confirm_id)";
- if ($new_user_query = $conn->query($b)) {
- mail($to, $subject, $message, $header);
- $add_array = unserialize(file_get_contents('../settings/all_users.php'));
- $new_user = new Member($username);
- $add_array[$username] = $new_user;
- file_put_contents('../settings/all_users.php', serialize($add_array));
- $conn->close();
- setcookie("email", $email, time() + 60 *60 *24 * 3, "/", 0, 1);
- $replace_arr = array('include_once sign_up.php', 'this loop should check where the array for where the new object matches, fetch that object then store it in the instance static variable');
- $static_file = str_replace($replace_arr, '', file_get_contents("member.php"));
- $user_doc = file_put_contents("../$username/index.php", $static_file);
- }
- }
- }
- }
- function usernameCheck($name){
- if ($username_in_use = $conn->query("SELECT username FROM users WHERE username='" . $name . "'")) {
- if ($username_in_use->num_rows > 0) {
- $name = $usernameCheck($name) . mt_rand(2, 90);
- }
- }
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement