Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head><link href="style.css" rel="stylesheet" type="text/css">
- <title>
- Z8 Group
- </title>
- </head>
- <body>
- <h2>Z8 Group</h2>
- <fieldset id="fieldset1">
- <?php
- // Load the configuration file containing your database credentials
- require_once('config.inc.php');
- // Connect to the database
- $mysqli = new mysqli($database_host, $database_user, $database_pass, $database_name);
- // Check for errors before doing anything else
- if($mysqli -> connect_error) {
- die('Connect Error ('.$mysqli -> connect_errno.') '.$mysqli -> connect_error);
- $name = $_POST["name"];
- $email= $_POST["email"];
- $form = sprintf("SELECT * FROM Login_Form WHERE Name LIKE '%s'", $name);
- $result = $mysqli -> query($form);
- $row = $result -> fetch_row();
- if (!filter_var($email, FILTER_VALIDATE_EMAIL))
- echo "The e-mail is incorrect.";
- else
- {
- echo "Your e-mail has been confirmed! ";
- if ($row)
- echo "Welcome, Z8 member. We have work to do!";
- else
- {
- echo "Welcome, normal user. Your details are going in the database!";
- $mysqli -> query(sprintf("INSERT INTO Login_Form(Name, Email) values('%s', '%s');", $name, $email))
- or die(mysqli_error($mysqli));
- }
- }
- }
- // SELECT ALL THE THINGS
- if($result = $mysqli -> query("SELECT * FROM Things")) {
- printf("Select returned %d rows.\n", $result -> num_rows);
- $result -> close(); // Remember to release the result set
- }
- // Always close your connection to the database cleanly!
- $mysqli -> close();
- ?>
- </fieldset>
- <br /><br />
- <button onclick="goBack()">Go back</button>
- <script>
- function goBack()
- {
- window.history.back()
- }
- </script>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement