Beiträge von Reedy
-
-
Grüße Euch
Könnte mir vielleicht jemand kurz helfen ? und mir mein Html code Richten ??geht um http://betasilkroad.de/
und zwar wenn ich mir da nen account machen will, schreibt er es nicht Automatisch in die SQL datenbank und macht einfach garnichts ?
habt ihr da vielleicht nen kleinen tip ?Zitat<html>
<head>
<title>VSRO Register - by fl0w</title>
<link rel="stylesheet" type="text/css" href="regpage.css">
<body>
<center>
<div class="header">
</div>
<div class="boxbg">
</div>
<div class="footer">
<!--Do not delete this-->
Design by <a href=".">fl0w</a>
<!--Do not delete this-->
</div>
</center>
</body>
<center><table class='regtable'>
<form method='post'>
<td>Username</td><td><input type='text' name='username' class='ubox' maxlength='16'></td><tr/>
<td>Password</td><td><input type='password' name='pw1' class='pwbox1' maxlength='32'></td><tr/>
<td>Password</td><td><input type='password' name='pw2' class='pwbox2' maxlength='32'></td><tr/>
<td></td><td><input type='submit' name='submit' class='registerbutton' value=''></td>
</form>
</table></center></head>
</html>
<?php
/* Simple registration page for silkroad server, by fl0w
* 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 "<center><table class='regtable'>
<form method='post'>
<td>Username</td><td><input type='text' name='username' class='ubox' maxlength='16'></td><tr/>
<td>Password</td><td><input type='password' name='pw1' class='pwbox1' maxlength='32'></td><tr/>
<td>Password</td><td><input type='password' name='pw2' class='pwbox2' maxlength='32'></td><tr/>
<td></td><td><input type='submit' name='submit' class='registerbutton' value=''></td>
</form>
</table></center>";
}
else
{
if(is_array($user) == true) $err[] = "<div class='error'>Username is array, n00p</div>";
if(is_array($pass1) == true) $err[] = "<div align='center' class='error'>Pw1 is array, n00p</div>";
if(is_array($pass2) == true) $err[] = "<div align='center' class='error'>Pw2 is array, n00p</div>";
if(strlen($_POST['username']) < 3) $msg[] = "<div align='center' class='error'>Username too short</div>";
if(strlen($_POST['username']) > 16)$msg[] = "<div align='center' class='error'>Username too long</div>";
if(strlen($_POST['pw1']) < 6) $msg[] = "<div align='center' class='error'>Password [1] too short</div>";
if(strlen($_POST['pw1']) > 32)$msg[] = "<div align='center' class='error'>Password [1] too long</div>";
if(strlen($_POST['pw2']) < 6) $msg[] = "<div align='center' class='error'>Password [2] too short</div>";
if(strlen($_POST['pw']) > 32) $msg[] = "<div align='center' class='error'>Password [2] too long</div>";
if($_POST['pw1'] != $_POST['pw2']) $msg[] = "<div align='center' class='error'>Passwords are not the same</div>";$sec = new security();
if($sec->is_secure($_POST['username']) == false) $msg[] = "<div align='center' class='error'>Username contains forbidden symbols</div>";
if($sec->is_secure($_POST['pw1']) == false) $msg[] = "<div align='center' class='error'>Password [1] contains forbidden symbols</div>";
if($sec->is_secure($_POST['pw2']) == false) $msg[] = "<div align='center' class='error'>Password [2] contains forbidden symbols</div>";if(count($msg) > 0)
{
for($i = 0; $i < count($msg); $i++)
{
echo $msg[$i]."<center><br/></center>";
}
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 "<center><div class='msg'>Account with such username already exists<br/></div></center>";
else
{
$pwd = md5($_POST['pw1']);
mssql_query("insert into TB_User(StrUserID,password,sec_primary,sec_content) values('$_POST[username]','$pwd','3','3')");
echo "<center><div class='msg'>Account successfully created<br/></div></center>";
}
}}
?>
</head>
</html>und
Zitat<?php
$cfg['sql_host'] = "xxxxxx\SQLEXPRESS";
$cfg['sql_user'] = "sa";
$cfg['sql_pass'] = "xxxxx";
$cfg['sql_db'] = "SRO_VTxxxx";$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);
}
?>und
Zitat<?php
class security
{
function is_secure($string)
{
$pattern = "#[^a-zA-Z0-9_\-]#";
if(preg_match($pattern,$string)==true)return false;
else
return true;
}
}?>
Danke euch
Lg ReedY