Advertisement
Guest User

ss

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