Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $host = 'localhost';
- $user = 'mysql username';
- $pass = 'mysql password';
- $password=strtoupper($_POST['password']);
- $accname=strtoupper($_POST['accname']);
- if (!ctype_alpha($accname))
- {
- echo"Please only use a-z and A-Z charachters...";
- }
- else
- {
- $con = mysql_connect($host, $user, $pass);
- if (!$con)
- {
- die('Could not connect: ' . mysql_error());
- }
- mysql_select_db("realmd", $con);
- $sql="select username, email from account where username ='". $accname ."';";
- $result = mysql_query($sql,$con);
- if (mysql_num_rows($result) > 0)
- {
- echo "Account already exists, created by: ". mysql_result($result,0,1);
- }
- else
- {
- $sha_pass = sha1($accname . ":" . $password);
- $sql="INSERT INTO account (username, sha_pass_hash, email, expansion)
- VALUES
- ('$accname','$sha_pass','$_POST[email]','0')";
- if (!mysql_query($sql,$con))
- {
- die('Error: ' . mysql_error());
- }
- echo "Account Created";
- mail('foobar@gmail.com', 'New WoW account created', 'User: ' . $accname . ' joined our Wow servers.');
- }
- mysql_close($con);
- }
- ?>
- <br>
- <FORM><INPUT Type="button" VALUE="Back" onClick="history.go(-1);return true;"></FORM>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement