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
- $md5_key = "2011"; // your md5 key
- $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
- $usr = $_POST['name'];
- $pass = $_POST['password'];
- $endPw = $md5_key . $pass;
- $md5 = sha1($endPw);
- $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 "Account Exists !";
- }
- else
- {
- mysql_query("INSERT INTO accounts(login_name,password,block,withdraw_remain_time,age,auth_ok,pcbang,last_login_server_idx,event_code,result) VALUES('$usr','$md5',0,0,18,1,1,1,0,1)");
- echo "Registration Success !";
- }
- }
- else
- {
- echo "Username or Password to small...";
- }
- ?>
- </center>
- </head>
- </html>
Add Comment
Please, Sign In to add comment