Advertisement
Guest User

king

a guest
Mar 4th, 2019
215
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>ECA Consultant New User</title>
  5. <meta charset="utf-8">
  6. <link rel="stylesheet" href="css/common.css" type="text/css">
  7. <script src="script/myscript.js"></script>
  8. </head>
  9. <body onload="pload()">
  10. <img src="img/logo.jpg" alt="logo">
  11. <p id="date1">DATE</p>
  12. <p id="time1">TIME</p>
  13. <h3>Navigation</h3>
  14. <nav>
  15. <ul>
  16. <li><a href="home.html">Home</a></li>
  17. <li><a href="login.html">Login</a></li>
  18. <li><a href="addedit.php">New User</a></li>
  19. <li><a href="aboutus.html">About Us</a></li>
  20. <li><a href="contactus.html">Contact Us</a></li>
  21. </ul>
  22. </nav>
  23.  
  24. <h1>CODE ZERO</h1>
  25. <h2>Please log in to check your details</h2>
  26.  
  27. <?php
  28. //declare all variables for db connection
  29. $dbserver="localhost:3307";
  30. $dbuser="root";
  31. $dbpassword="";
  32. $dbname="mydatabase";
  33. //create connection
  34. $conn=new mysqli($dbserver,$dbuser,$dbpassword,$dbname);
  35. //check connection error
  36. if($conn->connect_error==true){
  37. die("connection failed error description $conn->Connect_error");
  38. }else{
  39. echo "<p class='success'>Connection Success</p>";
  40. }
  41. //read login from values
  42. $id=$_POST['id'];
  43. $name=$_POST['name'];
  44. $city=$_POST['city'];
  45. $dob=$_POST['dob'];
  46. $phone=$_POST['phone'];
  47. $password=$_POST['password'];
  48. //create sql to update
  49. $sql="UPDATE CUSTOMER SET ".
  50. "NAME='".$name."',".
  51. "CITY='".$city."',".
  52. "DOB='".$dob."',".
  53. "PHONE='".$phone."',".
  54. "PASSWORD='".$password."' ".
  55. "WHERE ID=".$id;
  56. //execute query
  57. $result=$conn->query($sql);
  58. if($result==true){
  59. $conn->query($sql);
  60. echo "<h1>Hello $name your details have been updated</h1>";
  61. echo "<h2>Please log in again to confirm your changes</h2>";
  62. }else{
  63. echo "<h1 class='fail'>Please contact admin your details have not been changed.</h1>";
  64. }
  65. //close db connection
  66. $conn->close();
  67.  
  68. ?>
  69. <footer>
  70. <p>Copyright&copy; 2019 - All Rights Reserved</p>
  71. <p>Abhiman Basnet</p>
  72. </footer>
  73. </body>
  74. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement