- Joined
- Feb 22, 2008
- Messages
- 81
- Reaction score
- 0
could someone make a basic register for 5017 just one that only asks for ur username
thanks in advance
Corey
thanks in advance
Corey
<?php
$sqlhost = 'localhost';
$sqlun = '';
$sqlpw = '';
$sqldb = '';
$atable = '';//Account table
$afield = '';//Account field
$sqllink = mysql_connect($sqlhost, $sqlun, $sqlpw);
if (!$sqllink) { echo 'Unable to establish mySQL connection'; die(); }
if (!mysql_select_db($sqldb, $sqllink)) { echo 'Unable to select DB'; die(); }
if (isset($_POST['accname']))
{
$res = mysql_query("SELECT * FROM $atable WHERE $afield='{$_POST['account']}'");
if (mysql_num_rows($res))
{
echo "Account already exists.<br><a href=\"javascript:history.back();\">Click here</a> to go back.";
die();
}
mysql_query("INSERT INTO $atable (`$afield`) VALUES ('{$_POST['accname']}')");
if (mysql_affected_rows())
{
echo "Account created successfully.";
die();
}
else
{
echo "Account not created.";
die();
}
}
else
{
echo '<form action="'.substr(strrchr($PHP_SELF,'/'),1).'" method="POST" name="signup">';
echo '<table width="500">';
echo '<tr><td class="cacc" COLSPAN=2>Create Account</td></tr>';
echo '<tr><td class="cacc"><div align=right>Account Name:</div> </td><td class="cacc"><input name="accname" maxlength="15" type="text" /></td></tr>';
echo '<div align=right><input type="submit" name="submit" value="Submit"></div>';
echo '</td></tr></table>';
echo '</form>';
}
?>