Advertisement
Guest User

db

a guest
Feb 15th, 2017
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.08 KB | None | 0 0
  1.     <?php
  2.         $servername = "host";
  3.         $username = "user_name";
  4.         $password = "password";
  5.         $dbname = "db_name";
  6.  
  7.         // Create connection
  8.         $conn = new mysqli($servername, $username, $password, $dbname);
  9.         // Check connection
  10.         if ($conn->connect_error) {
  11.             die("Connection failed: " . $conn->connect_error);
  12.         }
  13.  
  14.         $sql = "INSERT INTO user_cache (user_name, password, email)
  15.         VALUES ('$user_name', '$password', '$email')";
  16.  
  17.        
  18.         if ($conn->query($sql) === TRUE) {
  19.             echo "  ";
  20.         } else {
  21.             echo "Error: " . $sql . "<br>" . $conn->error;
  22.         }
  23.  
  24.         $conn->close();
  25.     ?>
  26.    
  27. <title>Rejestracja</title>
  28. <meta name="viewport" content="width=device-width, initial-scale=1">
  29. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  30. <script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
  31. <link href="css/style.css" rel="stylesheet" type="text/css" media="all" />
  32. <link href='//fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
  33. </head>
  34. <body>
  35.     <div class="w3layouts-main">
  36.         <div class="agilesign-form">  
  37.             <div class="agileits-top">
  38.                 <form action="#" method="post">
  39.                     <div class="styled-input w3ls-text">
  40.                         <input type="text" name="user_name" required=""/>
  41.                         <label>Login</label>
  42.                         <span></span>
  43.                     </div>
  44.                     <div class="styled-input w3ls-text">
  45.                         <input type="text" name="email" required=""/>
  46.                         <label>Email</label>
  47.                         <span></span>
  48.                     </div>
  49.                     <div class="styled-input w3ls-text">
  50.                         <input type="password" name="password" required="">
  51.                         <label>Hasło</label>
  52.                         <span></span>
  53.                     </div>
  54.                     <div class="styled-input w3ls-text">
  55.                         <input type="password" name="password" required="">
  56.                         <label>Powtórz hasło</label>
  57.                         <span></span>
  58.                     </div>
  59.                     <div class="wthree-text">
  60.                     <div class="agileits-bottom">
  61.                         <input type="submit" value="Zarejestruj">
  62.                     </div> 
  63.                 </form>
  64.             </div>
  65.         </div> 
  66.     </div>
  67.      
  68. </body>
  69. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement