Blazer9131
New Member
- Messages
- 411
- Reaction score
- 0
- Points
- 0
Hey guys,
I have a script, its a simple 3 file registeration script. here are all three parts:
register.php
register_do.php
config.php
I set up the config.php file to connect to my IP, but everytime I try to register an account, it says access denied for Blaze9@localhost.
Anyway this script can connect to my IP? o.o
Thanks
~Blaze
I have a script, its a simple 3 file registeration script. here are all three parts:
register.php
PHP:
<html>
<head>
<title>My maplestory server</title>
<!--- Version 3.3 ---!>
<style>
*{ FONT-SIZE: 8pt; FONT-FAMILY: verdana; } b { FONT-WEIGHT: bold; } .listtitle { BACKGROUND: #425984; COLOR: #EEEEEE; white-space: nowrap; } td.list { BACKGROUND: #EEEEEE; white-space: nowrap; } </style>
</head>
<center><br><br><br><br>
<h1>My maplestory server</h1>
<table cellspacing=1 cellpadding=5>
<tr>
<td class=listtitle colspan=2>Register at my server</td></tr>
<form action="register_do.php" method="POST">
<tr><td class=list align=right>Username:</td><td class=list><input type=text name=name maxlength="30"></td></tr>
<tr><td class=list align=right>Password:</td><td class=list><input type=password name=pass maxlength="30"></td></tr>
<tr><td class=list align=right>PIN:</td><td class=list>
<select name="pin1">
<option value="0">0</option>
<option SELECTED value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<select name="pin2">
<option value="0">0</option>
<option value="1">1</option>
<option SELECTED value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<select name="pin3">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option SELECTED value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select>
<select name="pin4">
<option value="0">0</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option SELECTED value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
<option value="9">9</option>
</select></td></tr>
<tr><td class=list align=right>Gender:</td><td class=list>
<select name="gender">
<option value="0">Male</option>
<option value="1">Female</option>
</select>
</td></tr>
<tr><td class=listtitle align=right colspan=2><input type=submit name=submit value='Register'></td></tr>
</form>
</table>
<br>
<!--- thanks Antv912 ---!>
<?php
include('config.php');
$result = mysql_query("SELECT * FROM users", $db);// Account section
$num_rows = mysql_num_rows($result);
$result2 = mysql_query("SELECT * FROM characters", $db);// Character section
$num_rowsc = mysql_num_rows($result2);
echo 'Stats:<br><b>'.$num_rows.'</b> Accounts registed.<br><b>'.$num_rowsc.'</b> Characters created.';
?>
</center></body></html>
register_do.php
PHP:
<?php
// Version 3.3
if($_POST['submit']){
print '<title>My maplestory server</title>';
// ty hacker_kts for security thing
$name2 = ereg_replace('[^a-zA-Z0-9]', '', $_POST['name']);
$pass2 = ereg_replace('[^a-zA-Z0-9]', '', $_POST['pass']);
$gender = $_POST['gender'];
$pin1 = ereg_replace('[^0-9]', '', $_POST['pin1']);;
$pin2 = ereg_replace('[^0-9]', '', $_POST['pin2']);
$pin3 = ereg_replace('[^0-9]', '', $_POST['pin3']);
$pin4 = ereg_replace('[^0-9]', '', $_POST['pin4']);
include('config.php');
$sel = 'SELECT * FROM users WHERE username="'.$name2.'"';
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{
$d = 'INSERT INTO users (username, password, pin, gender, gm) VALUES ("'.$name2.'", "'.$pass2.'", "'.$pin1.$pin2.$pin3.$pin4.'", "'.$gender.'", "0")';
mysql_query($d) OR die (mysql_error());
echo 'Your account has been created, you can now login.<br><br>Your username is: <b>'.$name2.'</b>';
}
}else{
print '<title>My maplestory server</title>';
echo '???';
}
?>
config.php
PHP:
<?php
// Version 3.3
$host['naam'] = 'localhost'; // my host
$host['gebruikersnaam'] = 'root'; // my database username
$host['wachtwoord'] = ''; // my database password
$host['databasenaam'] = 'maplestory'; // 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);
?>
I set up the config.php file to connect to my IP, but everytime I try to register an account, it says access denied for Blaze9@localhost.
Anyway this script can connect to my IP? o.o
Thanks
~Blaze