Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //this is my register page code
- <!doctype html>
- <?php
- $con=mysqli_connect("localhost","root","","test");
- if (mysqli_connect_errno())
- {
- echo "Failed to connect to MySQL: " . mysqli_connect_error();
- }else{
- }
- if(isset($_POST["submit"])){
- if(!empty($_POST['finame']) && !empty($_POST['pass']) && !empty($_POST['laname']) && !empty($_POST['uemail'])) {
- $fristname=mysqli_real_escape_string($con,$_POST['finame']);
- $pass=$_POST['pass'];
- $laname=mysqli_real_escape_string($con,$_POST['laname']);
- $email=mysqli_real_escape_string($con,$_POST['uemail']);
- $query=mysqli_query($con,"SELECT * FROM login WHERE email='".$email."'");
- $numrows=mysqli_num_rows($query);
- if($numrows==0)
- {
- $addtothedb="INSERT INTO login (firstname,lastname,email,password) VALUES ('". $fristname . "','". $laname ."','" . $email . "','". $pass ."')" ;
- $result=mysqli_query($con,$addtothedb);
- $cur = "USERS/";
- $gofile=$cur.$email;
- if($result){
- if ( mkdir($gofile,0777) ) {
- echo "<center>Account Successfully Created.Now you can Login.</center>";
- } else {
- echo " <center> Account Not Successfully Created.But you can Login.</center>" ;
- }
- }
- else {
- echo "<center>Failure</center>";
- }
- }
- else {
- echo " That Email already exists! Please try again with another.";
- }
- }
- else {
- echo "<center>All fields are required!</center>";
- }
- }
- ?>
- <html>
- <head>
- <meta name="viewport" content="width=device-width, initial-scale=1">
- <title>Register</title>
- </head>
- <body>
- <div id= "signup">
- <form action="" method="POST" align="center">
- <fieldset>
- <div id="register_form">
- <h3><center>Registration Form</center></h3>
- </div>
- Firstname:<br /> <input id="textdecor" type="text" name="finame" autocomplete="off" size="35"><br /><br />
- Lastname:<br /> <input id="textdecor" type="text" name="laname" autocomplete="off" size="35"><br /><br />
- Email: <br /><input id="textdecor" type="email" name="uemail" value="" size="35"><br /><br />
- Password:<br /> <input id="textdecor" type="password" name="pass" autocomplete="off" size="35" /><br /><br />
- <input id="sumbit_buttom" type="submit" value="Register" name="submit" />
- <p><center><a class="tab-group" href=regis.php">Register</a> | <a href="log.php">Login</a></p>
- </fieldset>
- </form>
- </div>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement