Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- print '<title>Registration</title>';
- $name = $_POST['name'];
- $pass = $_POST['pass'];
- $host['naam'] = 'localhost'; // my host
- $host['gebruikersnaam'] = 'root'; // my database username
- $host['wachtwoord'] = ''; // my database password
- $host['databasenaam'] = 'testtest'; // my database name
- $db = mysql_connect($host['naam'], $host['gebruikersnaam'], $host['wachtwoord']) OR die ('Cant connect to the database');
- mysql_select_db($host['databasenaam'], $db);
- $sel = 'SELECT * FROM users WHERE username="'.$_POST['name'].'"';
- if($name == ""){
- echo 'No username filled in';
- exit();
- }elseif(mysql_num_rows(mysql_query($sel)) >= 1 ){
- echo 'This username does already exists!';
- exit();
- }elseif($pass == ""){
- echo 'No password filled in';
- exit();
- }else{
- $encrypting = md5($pass);
- $d = 'INSERT INTO users (username, password) VALUES ("'.$name.'", "'.$encrypting.'")';
- mysql_query($d) OR die (mysql_error());
- echo 'Your account has been created, you can now login.';
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement