Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = "localhost"; // your sql instance
- $user = "root"; // username
- $pw = ""; // password
- $db = "bananachat"; // db
- $connect = mysql_connect($host, $user, $pw)
- or die("Can't connect to the datebase.");
- mysql_select_db($db,$connect)
- or die("Can't select the datebase");
- ?>
- <html>
- <head>
- <title>Register</title>
- <center>
- <h3 style="color:red">Register Page</h3>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
- Username : <input type="text" size="20" name="name" /><br />
- Password : <input type="password" size="20" name="password" /><br /><br />
- <input type="submit" value="Register now !" name="senden" />
- </form>
- <?php
- if (isset($_POST[senden])) {
- $usr = $_POST['name'];
- $pass = $_POST['password'];
- $pw = sha1($pass);
- $results = mysql_query("SELECT * FROM accounts WHERE name = '".$usr."'");
- $res = mysql_num_rows($results);
- if(strlen($usr) >= 4 && strlen($pass) >= 4)
- {
- if($res > 0)
- {
- echo "Dieser Accounts ist bereits vergeben.";
- }
- else
- {
- mysql_query("INSERT INTO accounts set name='".$urs."', password='".$pw."'");
- echo "Du hast soeben den Nicknamen ".$urs." registriert.";
- }
- }
- else
- {
- echo "Nickname oder Passwort sind zu kurz...";
- }
- }
- ?>
- </center>
- </head>
- </html>
Add Comment
Please, Sign In to add comment