Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="">
- <input type="hidden" name="form_type" value="register" />
- <input type="text" name="nick value="" placeholder="nick..." /> <br/>
- <input type="password" name="password" value="" placeholder="haslo..." /> <br/>
- <input type="text" name="user_email" value="" placeholder="e-mail..." /> <br/>
- <input type="submit" value="Rejstruj" />
- <br/>
- <br/>
- <a href = "http://blackspot.c0.pl/login.php">Login<a/>
- </form>
- <?php
- $servername = 'mysql.cba.pl';
- $username = 'blackspot';
- $password = 'BlackSpot123';
- $dbname = 'blackspot_db';
- if ($_SERVER['REQUEST_METHOD'] === 'POST') {
- $nick = trim(strip_tags($_POST['nick']));
- $password1 = trim(strip_tags($_POST['password']));
- $email = trim(strip_tags($_POST['email']));
- $conn = new msqli($servername, $username, $password,$dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "INSERT INTO blackspot_db (login, pass, email) VALUES ('".$nick."', '".$email."', '".$password."')";
- if ($conn->query($sql) === TRUE) {
- $result = array('status' => 1, 'msg' => "Success");
- } else {
- $result = array('status' => 0, 'msg' => $conn->error);
- }
- echo json_encode($result);
- $conn->close();
- die;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement