Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- ob_start();
- $host="localhost"; // Host name
- $username="terryw000"; // Mysql username
- $password="peterw000"; // Mysql password
- $db_name="db_data"; // Database name
- $tbl_name="tb_animewatch"; // Table name
- $salt="t3*\86I";
- // Connect to server and select databse.
- mysql_connect("$host", "$username", "$password")or die("cannot connect");
- mysql_select_db("$db_name")or die("cannot select DB");
- $username=$_POST['username'];
- $password=md5($salt.$_POST['password'].$salt);
- if ($_POST['e-mail'] == $_POST['ree-mail'])
- {
- $email=$_POST['e-mail'];
- }
- $check= "SELECT * FROM `$tbl_name` WHERE email = '$email' OR username = '$username'";
- $result = mysql_query($check);
- $count = mysql_num_rows($result);
- if (0 == $count)
- {
- $sql="INSERT INTO `$tbl_name` ( `username`, `password`, `email`) VALUES ('$username', '$password', '$email')";
- $result=mysql_query($sql);
- header("location:index.html");
- }else {
- echo "this username or email has already been used";
- }
- ob_end_flush();
- ?>
Add Comment
Please, Sign In to add comment