Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- include("../includes/db.php");
- include("../functions/functions.php");
- include("../includes/header.php");
- ?>
- <section>
- <div class="container">
- <div class="row">
- <?php include("../includes/nav.php");?>
- <div class="col-sm-9 padding-right">
- <div class="features_items" id="products_box"><!--features_items start-->
- <h2 class="title text-center">Create an account</h2>
- <form class="form-group" action="customer_register.php" method="post" enctype="multipart/form-data"/>
- <table width ="750" align="center">
- <tr>
- <td align="right"><b>Customer Name: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="text" name="customer_name" required /> </div></td>
- </tr>
- <tr>
- <td align="right"><b>Customer Email: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="text" name="customer_email" required /> </div> </td>
- </tr>
- <tr>
- <td align="right"><b>Customer Password: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="password" name="customer_pass" required /> </div></td>
- </tr>
- <tr>
- <td align="right"><b>Confirm Password: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="password" name="customer_pass_confirm" required /> </div></td>
- </tr>
- <tr>
- <td align="right"><b>Customer city: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="text" name="customer_city" required /> </div></td>
- </tr>
- <tr>
- <td align="right"><b>Customer Mobile no: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="text" name="customer_contact" required /> </div></td>
- </tr>
- <tr>
- <td align="right"><b>Customer Address: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control" type="text" name="customer_address" required /> </div></td>
- </tr>
- <tr>
- <td align="right"><b>Customer Image: </b> </td>
- <td> <div class="col-xs-8"><input class="form-control-file" type="file" name="customer_image" required /> <div></td>
- </tr>
- <tr align="center">
- <td colspan="10"> <br><input class="btn btn-success" type="submit" name="register" value="Submit" /> </td>
- </tr>
- </form>
- </div><!--features_items Ends-->
- </div><!--/category-tab-->
- </div>
- </div>
- </div>
- </section>
- </body>
- </html>
- <?php
- if(isset($_POST['register']))
- {
- $customer_pass = $_POST['customer_pass'];
- $customer_pass_confirm = $_POST['customer_pass_confirm'];
- if($customer_pass==$customer_pass_confirm)
- {
- $customer_name = $_POST['customer_name'];
- $customer_email = $_POST['customer_email'];
- $customer_country = "Indonesia";
- $customer_city = $_POST['customer_city'];
- $customer_contact = $_POST['customer_contact'];
- $customer_address= $_POST['customer_address'];
- $customer_image = $_FILES['customer_image']['name'];
- $customer_image_temp = $_FILES['customer_image']['tmp_name'];
- $customer_ip = getRealIpAddress();
- $insert_customer = "insert into customers(customer_name,customer_email,customer_pass,customer_country,customer_city,customer_contact,customer_address,customer_image,customer_ip)
- values ('$customer_name','$customer_email','$customer_pass','$customer_country','$customer_city','$customer_contact','$customer_address','$customer_image','$customer_ip')";
- $run_customer = mysqli_query($con,$insert_customer);
- //uploading a customer photo
- move_uploaded_file($customer_image_temp, "customer/customer_photos/$customer_image");
- //checking if this user have anything in the cart if yes we will redirect to payment page
- $sel_cart = "select * from cart where ip_add='$customer_ip'";
- $run_cart = mysqli_query($con,$sel_cart);
- $check_cart = mysqli_num_rows($run_cart);
- if($check_cart>0)
- {
- //create a session
- $_SESSION['customer_email'] = $customer_email;
- echo "<script>alert('Account has been created') </script>";
- echo "<script>window.open('checkout.php','_self')</script>";
- }
- else
- {
- $_SESSION['customer_email'] = $customer_email;
- echo "<script>alert('Account has been created') </script>";
- echo "<script>window.open('../index.php','_self')</script>";
- }
- }//end of password checking
- else
- {
- echo "<script>alert('Password did not match') </script>";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement