Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require_once('recaptchalib.php');
- $privatekey = "6LdVt7kSAAAAAKNfGz_Uk58OdJFHFonIZhFtOHZ8";
- $resp = recaptcha_check_answer ($privatekey,
- $_SERVER["REMOTE_ADDR"],
- $_POST["recaptcha_challenge_field"],
- $_POST["recaptcha_response_field"]);
- if (!$resp->is_valid) {
- die ("The reCAPTCHA wasn't entered correctly. Go back and try it again. reCAPTCHA said: " . $resp->error );
- }
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $cpassword = $_POST['cpassword'];
- $connect = mysql_connect('mysql16.000webhost.com', 'a5530369_accounts', 'yu74daCre8ep6PHAnunazuphEpRAg7ban3jECAJu8esawE7equVu9tuMap6aphAf');
- if (!$connect) {
- die('Error: Could not connect to MySQL database. Please email support@Johtaja.x10.mx and tell them about this.');
- }
- mysql_select_db("a5530369_johtaja", $connect);
- $selectusername = mysql_query("SELECT * FROM users WHERE username='$username'");
- if (mysql_num_rows($selectusername) == 1) {
- if (!empty($username) && !empty($email) && !empty($password) && !empty($cpassword) && $password == $cpassword) {
- $sqlquery = "CREATE TABLE " . $username . "
- (
- name varchar(255),
- due varchar(255),
- course varchar(255),
- description varchar(1000)
- )";
- if (!mysql_query($sqlquery,$connect)) {
- die('Error: Could not query MySQL database. Please email support@Johtaja.x10.mx and tell them about this.');
- }
- $sqlquery1 = "INSERT INTO users (username, email, password) VALUES ('$username', '$email', '$password')";
- if (!mysql_query($sqlquery1,$connect)) {
- die('Error: Could not query MySQL database. Please email support@Johtaja.x10.mx and tell them about this.');
- }
- $to = $email;
- $subject = "Johtaja Account Information";
- $message = "Thank you for signing up for Johtaja! Here is your account information:\n" .
- "Username: $username\n" .
- "Email: $email\n" . "Password: $password\n" .
- "You may sign in at Johtaja.x10.mx Please keep this information in case you need it later.";
- $headers = "From: support@Johtaja.x10.mx";
- $status = mail($to, $subject, $message, $headers);
- if($status) {
- echo "Account Created!<br />";
- echo "Username: " . $username . "<br />";
- echo "Email: " . $email . "<br />";
- echo "Account Information Has Been Sent To " . $email . ".<br />";
- }
- }
- $usrvalues = array($username, $email, $password, $cpassword);
- foreach ($usrvalues as $value) {
- if (empty($value) {
- echo "You have not entered a value for a required field. Please press the back button on your web browser and correct this. </br>";
- }
- }
- } else {
- echo "The username " . $username . " is already taken. Please press the back button on your web browser and choose another username";
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement