|
You last visited: Today at 09:50
Advertisement
How make Registred Page?
Discussion on How make Registred Page? within the SRO Private Server forum part of the Silkroad Online category.
02/16/2015, 22:56
|
#1
|
elite*gold: 0
Join Date: May 2014
Posts: 200
Received Thanks: 25
|
How make Registred Page?
i want a Registred page , like account and pw and this is it +email or without , just a reg page , no website just a simple page like a clean background only connect to my DB for create account ,who can tell me more or give me some hint or hellp me with a tutorial or something ? . Thanks in advanced!
|
|
|
02/16/2015, 23:43
|
#2
|
elite*gold: 41
Join Date: Oct 2012
Posts: 2,216
Received Thanks: 1,196
|
PHP Code:
<?php /* Simple registration page for silkroad server, by Chernobyl * Settings are at _inc/config.php * If you get an mssql connection error, while defining totally correct data * Just use older ntwdblib.dll for your webserver */ require_once('_inc/security.class.php'); require_once('_inc/config.php');
if(!isset($_POST['submit'])) { echo "<table border='1'> <form method='post'> <td>Username</td><td><input type='text' name='username' maxlength='16'></td><tr/> <td>Password[1]</td><td><input type='password' name='pw1' maxlength='32'></td><tr/> <td>Password[2]</td><td><input type='password' name='pw2' maxlength='32'></td><tr/> <td></td><td><input type='submit' name='submit' value='Register'></td> </form> </table>"; } else { if(is_array($user) == true) $err[] = "Username is array, n00p"; if(is_array($pass1) == true) $err[] = "Pw1 is array, n00p"; if(is_array($pass2) == true) $err[] = "Pw2 is array, n00p"; if(strlen($_POST['username']) < 3) $msg[] = "Username too short"; if(strlen($_POST['username']) > 16)$msg[] = "Username too long"; if(strlen($_POST['pw1']) < 6) $msg[] = "Password [1] too short"; if(strlen($_POST['pw1']) > 32)$msg[] = "Password [1] too long"; if(strlen($_POST['pw2']) < 6) $msg[] = "Password [2] too short"; if(strlen($_POST['pw']) > 32) $msg[] = "Password [2] too long"; if($_POST['pw1'] != $_POST['pw2']) $msg[] = "Passwords are not the same"; $sec = new security(); if($sec->is_secure($_POST['username']) == false) $msg[] = "Username contains forbidden symbols"; if($sec->is_secure($_POST['pw1']) == false) $msg[] = "Password [1] contains forbidden symbols"; if($sec->is_secure($_POST['pw2']) == false) $msg[] = "Password [2] contains forbidden symbols"; if(count($msg) > 0) { for($i = 0; $i < count($msg); $i++) { echo $msg[$i]."<br/>"; } return; } else { //checking damn mssql stuff $accountExists = mssql_num_rows(mssql_query("select StrUserID from TB_User where StrUserID='$_POST[username]'")); if($accountExists > 0) echo "Account with such username already exists<br/>"; else { $pwd = md5($_POST['pw1']); mssql_query("insert into TB_User(StrUserID,password,sec_primary,sec_content) values('$_POST[username]','$pwd','3','3')"); echo "Account successfully created<br/>"; } }
} ?>
PHP Code:
<?php class security { function is_secure($string) { $pattern = "#[^a-zA-Z0-9_\-]#"; if(preg_match($pattern,$string)==true)return false; else return true; } } ?>
PHP Code:
<?php
$cfg['sql_host'] = ".\SQLEXPRESS"; $cfg['sql_user'] = "sa"; $cfg['sql_pass'] = "1234"; $cfg['sql_db'] = "SRO_VT_ACCOUNT";
$sqlLink = mssql_connect($cfg[sql_host],$cfg[sql_user],$cfg[sql_pass]); if(!$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?"); else { mssql_select_db($cfg[sql_db],$sqlLink); } ?>
|
|
|
02/16/2015, 23:53
|
#3
|
elite*gold: 0
Join Date: May 2014
Posts: 200
Received Thanks: 25
|
Quote:
Originally Posted by Crue*
PHP Code:
<?php
/* Simple registration page for silkroad server, by Chernobyl
* Settings are at _inc/config.php
* If you get an mssql connection error, while defining totally correct data
* Just use older ntwdblib.dll for your webserver
*/
require_once('_inc/security.class.php');
require_once('_inc/config.php');
if(!isset($_POST['submit']))
{
echo "<table border='1'>
<form method='post'>
<td>Username</td><td><input type='text' name='username' maxlength='16'></td><tr/>
<td>Password[1]</td><td><input type='password' name='pw1' maxlength='32'></td><tr/>
<td>Password[2]</td><td><input type='password' name='pw2' maxlength='32'></td><tr/>
<td></td><td><input type='submit' name='submit' value='Register'></td>
</form>
</table>";
}
else
{
if(is_array($user) == true) $err[] = "Username is array, n00p";
if(is_array($pass1) == true) $err[] = "Pw1 is array, n00p";
if(is_array($pass2) == true) $err[] = "Pw2 is array, n00p";
if(strlen($_POST['username']) < 3) $msg[] = "Username too short";
if(strlen($_POST['username']) > 16)$msg[] = "Username too long";
if(strlen($_POST['pw1']) < 6) $msg[] = "Password [1] too short";
if(strlen($_POST['pw1']) > 32)$msg[] = "Password [1] too long";
if(strlen($_POST['pw2']) < 6) $msg[] = "Password [2] too short";
if(strlen($_POST['pw']) > 32) $msg[] = "Password [2] too long";
if($_POST['pw1'] != $_POST['pw2']) $msg[] = "Passwords are not the same";
$sec = new security();
if($sec->is_secure($_POST['username']) == false) $msg[] = "Username contains forbidden symbols";
if($sec->is_secure($_POST['pw1']) == false) $msg[] = "Password [1] contains forbidden symbols";
if($sec->is_secure($_POST['pw2']) == false) $msg[] = "Password [2] contains forbidden symbols";
if(count($msg) > 0)
{
for($i = 0; $i < count($msg); $i++)
{
echo $msg[$i]."<br/>";
}
return;
}
else
{
//checking damn mssql stuff
$accountExists = mssql_num_rows(mssql_query("select StrUserID from TB_User where StrUserID='$_POST[username]'"));
if($accountExists > 0) echo "Account with such username already exists<br/>";
else
{
$pwd = md5($_POST['pw1']);
mssql_query("insert into TB_User(StrUserID,password,sec_primary,sec_content) values('$_POST[username]','$pwd','3','3')");
echo "Account successfully created<br/>";
}
}
}
?>
PHP Code:
<?php
class security
{
function is_secure($string)
{
$pattern = "#[^a-zA-Z0-9_\-]#";
if(preg_match($pattern,$string)==true)return false;
else
return true;
}
}
?>
PHP Code:
<?php
$cfg['sql_host'] = ".\SQLEXPRESS";
$cfg['sql_user'] = "sa";
$cfg['sql_pass'] = "1234";
$cfg['sql_db'] = "SRO_VT_ACCOUNT";
$sqlLink = mssql_connect($cfg[sql_host],$cfg[sql_user],$cfg[sql_pass]);
if(!$sqlLink) die("MSSQL server is not accessable, why should we try to select database ?");
else
{
mssql_select_db($cfg[sql_db],$sqlLink);
}
?>
|
and where i will put this? or i will make me new folder anywhere?
|
|
|
02/17/2015, 00:20
|
#4
|
elite*gold: 28
Join Date: Aug 2014
Posts: 4,096
Received Thanks: 2,653
|
Quote:
Originally Posted by seriouscos
and where i will put this? or i will make me new folder anywhere?
|
At your web server folder
|
|
|
02/17/2015, 00:22
|
#5
|
elite*gold: 0
Join Date: May 2014
Posts: 200
Received Thanks: 25
|
i put this in c/input/wwwroot and now work when i open localhost/index.php or with port 80 or 8080 no work who can hellp me with TeamVieWer or explain me slow cuz no know much about php.
up some 1 can hellp me?
|
|
|
All times are GMT +1. The time now is 09:50.
|
|