Re: WebPage Register Account
PHP Code:
<?php
// Config
// Title
echo '<title>CABAL Online Register</title>';
// MSSQL server connection details
// Database server
define('DB_ADDR','127.0.0.1');
// Database login
define('DB_USER','sa');
// Database password
define('DB_PASS','password');
// In case you have a different db names
define('DB_ACC','ACCOUNT');
define('DB_GAM','GAMEDB');
$link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
if (!$link) die('Could not connect to MSSQL database.');
$num_acc=0;
$num_cha=0;
$num_onl=0;
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table');
$num_acc=mssql_result($r,0,0);
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table where Login=1');
$num_onl=mssql_result($r,0,0);
$r=mssql_query('select count (*) from '.DB_GAM.'.dbo.cabal_character_table');
$num_cha=mssql_result($r,0,0);
echo '<div align="center">';
echo '<p style="font-size:24px;font-weight:bold">CABAL Online Account Registration</p>';
echo '<p>Login ID and Password must be at least a minimum of 6 characters, letters and/or numbers only.</p>';
echo '<form method="post" action="'.$_PHP['self'].'">';
echo '<table cellspacing="4" cellpadding="0" border="0">';
echo '<tr><td align="right">Login ID: </td><td><input type="text" name="uname" class="editbox"></td></tr>';
echo '<tr><td align="right">Password: </td><td><input type="password" name="pass" class="editbox"></td></tr>';
echo '<tr><td align="right">Confirm Password: </td><td><input type="password" name="pass2" class="editbox"></td></tr>';
echo '<tr><td colspan="2" align="center"><input type="submit" value="Register" class="button"></td></tr><br \>';
echo '</table>';
echo '</form>';
echo '<p>Registered accounts: <span style="font-size:16px;font-weight:bold">'.$num_acc.'</span> | Characters created: <span style="font-size:16px;font-weight:bold">'.$num_cha.'</span></p>';
$uid='';
$pass='';
$failed=false;
if (isset($_POST['uname'])) {
if (!ctype_alnum($_POST['uname']) || strlen($_POST['uname'])<6) {
$failed=true;
echo '<p class="errortext">Invalid username. Minimum of 6 characters, letters and numbers only.</p> ';
} else {
$uid=$_POST['uname'];
}
}
if (isset($_POST['pass'])) {
if (!ctype_alnum($_POST['pass']) || strlen($_POST['pass'])<6) {
$failed=true;
echo '<p class="errortext">Invalid password. Minimum of 6 characters, letters and numbers only.</p> ';
} else {
$pass=$_POST['pass'];
}
}
if (isset($_POST['pass2'])) {
if (!ctype_alnum($_POST['pass2'])) {
$failed=true;
} else {
if ($_POST['pass2']!=$_POST['pass']) {
$failed=true;
echo '<p class="errortext">Both password fields do not match.</p> ';
}
}
}
if ($failed==true) {
echo '<p class="errortext">Account Registration Failed.</p> ';
} else {
if ($uid!='' && $pass!='') {
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table where ID="'.$uid.'"');
if (mssql_result($r,0,0)==0) {
$r=mssql_query('exec '.DB_ACC.'.dbo.cabal_tool_registerAccount "'.$uid.'","'.$pass.'"');
if ($r==false) {
echo '<p class="errortext">Something went wrong.</p>';
} else {
echo '<p class="goodtext">Account created successfully.</p>';
}
mssql_free_result($r);
mssql_close($link);
} else {
echo '<p class="errortext">Login ID has been used.</p> ';
}
}
}
echo '</div>';
?>
Credits to chumpy.
Re: WebPage Register Account
Yep, my page was designed for exactly that, simple and no complications. If you download the .7z file from my sig you will get the images and style as well.
I have also recently released an extra page you can put next to that one to give basic rankings and i will be releasing a further addon page for password changing later today. These extra pages just need copying next to reg.php.
Re: WebPage Register Account
show me error in the line 20 :
Fatal error: Call to undefined function mssql_connect() in C:\AppServ\www\Cabal\index.php on line 20
$link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
:S
Re: WebPage Register Account
try putting the right things needed on the config.
Re: WebPage Register Account
you didn`t configure it well.
Re: WebPage Register Account
Don't work, i change for my dates :S and don't work
Quote:
<?php
// Config
// Title
echo '<title>CABAL Online Register</title>';
// MSSQL server connection details
// Database server
define('DB_ADDR','localhost');
// Database login
define('DB_USER','sa');
// Database password
define('DB_PASS','mypass');
// In case you have a different db names
define('DB_ACC','ACCOUNT');
define('DB_GAM','GAMEDB');
$link = mssql_connect(DB_ADDR, DB_USER, DB_PASS);
if (!$link) die('Could not connect to MSSQL database.');
$num_acc=0;
$num_cha=0;
$num_onl=0;
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table');
$num_acc=mssql_result($r,0,0);
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table where Login=1');
$num_onl=mssql_result($r,0,0);
$r=mssql_query('select count (*) from '.DB_GAM.'.dbo.cabal_character_table');
$num_cha=mssql_result($r,0,0);
echo '<div align="center">';
echo '<p style="font-size:24px;font-weight:bold">CABAL Online Account Registration</p>';
echo '<p>Login ID and Password must be at least a minimum of 6 characters, letters and/or numbers only.</p>';
echo '<form method="post" action="'.$_PHP['self'].'">';
echo '<table cellspacing="4" cellpadding="0" border="0">';
echo '<tr><td align="right">Login ID: </td><td><input type="text" name="uname" class="editbox"></td></tr>';
echo '<tr><td align="right">Password: </td><td><input type="password" name="pass" class="editbox"></td></tr>';
echo '<tr><td align="right">Confirm Password: </td><td><input type="password" name="pass2" class="editbox"></td></tr>';
echo '<tr><td colspan="2" align="center"><input type="submit" value="Register" class="button"></td></tr><br \>';
echo '</table>';
echo '</form>';
echo '<p>Registered accounts: <span style="font-size:16px;font-weight:bold">'.$num_acc.'</span> | Characters created: <span style="font-size:16px;font-weight:bold">'.$num_cha.'</span></p>';
$uid='';
$pass='';
$failed=false;
if (isset($_POST['uname'])) {
if (!ctype_alnum($_POST['uname']) || strlen($_POST['uname'])<6) {
$failed=true;
echo '<p class="errortext">Invalid username. Minimum of 6 characters, letters and numbers only.</p> ';
} else {
$uid=$_POST['uname'];
}
}
if (isset($_POST['pass'])) {
if (!ctype_alnum($_POST['pass']) || strlen($_POST['pass'])<6) {
$failed=true;
echo '<p class="errortext">Invalid password. Minimum of 6 characters, letters and numbers only.</p> ';
} else {
$pass=$_POST['pass'];
}
}
if (isset($_POST['pass2'])) {
if (!ctype_alnum($_POST['pass2'])) {
$failed=true;
} else {
if ($_POST['pass2']!=$_POST['pass']) {
$failed=true;
echo '<p class="errortext">Both password fields do not match.</p> ';
}
}
}
if ($failed==true) {
echo '<p class="errortext">Account Registration Failed.</p> ';
} else {
if ($uid!='' && $pass!='') {
$r=mssql_query('select count (*) from '.DB_ACC.'.dbo.cabal_auth_table where ID="'.$uid.'"');
if (mssql_result($r,0,0)==0) {
$r=mssql_query('exec '.DB_ACC.'.dbo.cabal_tool_registerAccount "'.$uid.'","'.$pass.'"');
if ($r==false) {
echo '<p class="errortext">Something went wrong.</p>';
} else {
echo '<p class="goodtext">Account created successfully.</p>';
}
mssql_free_result($r);
mssql_close($link);
} else {
echo '<p class="errortext">Login ID has been used.</p> ';
}
}
}
echo '</div>';
?>
Re: WebPage Register Account
instaid of localhost place 127.0.0.1 and if it doesn`t work place the service name.
Re: WebPage Register Account
nothing :S
Localhost
127.0.0.1
192.168.1.100
and ip of hamachi and nothing
Re: WebPage Register Account
try with the sql service name. One more thing : are you sure you are having your mssql extension installed in php?
Re: WebPage Register Account
i solved the problem, thanks all. the problem are in the php.ini
Re: WebPage Register Account
Quote:
Originally Posted by
maggieta2
i solved the problem, thanks all. the problem are in the php.ini
solved thanks