help simple web

08/02/2013 12:26 @nDroid22#1
shaiya server
win7 ultimate 32bit
sql server 2008 management studio
appserv 2.6


i used this
LAN: 192.168.1.22
SQL id: godcn
SQL Pass: database55

config.php

Quote:
<?php
//User defined variables
$host = "192.168.1.22"; //Database Host. (IP to DB)
$user = "godcn"; //Database Username
$pass = "database55"; //Database Password
$link = mssql_connect($host,$user,$pass) or die('Connection Error.');
//Custom Function
function mssql_escape_string($data) {
if ( !isset($data) or empty($data) ) return '';
if ( is_numeric($data) ) return $data;

$non_displayables = array(
'/%0[0-8bcef]/', // url encoded 00-08, 11, 12, 14, 15
'/%1[0-9a-f]/', // url encoded 16-31
'/[\x00-\x08]/', // 00-08
'/\x0b/', // 11
'/\x0c/', // 12
'/[\x0e-\x1f]/' // 14-31
);
foreach ( $non_displayables as $regex )
$data = preg_replace( $regex, '', $data );
$data = str_replace("'", "''", $data );
return $data;
}

?>

index.php

Quote:
<?php
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Account Registration</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="jquery/QapTcha.jquery.css" type="text/css" />
<script type="text/javascript" src="jquery/jquery.js"></script>
<script type="text/javascript" src="jquery/jquery-ui.js"></script>
<script type="text/javascript" src="jquery/jquery.ui.touch.js"></script>
<script type="text/javascript" src="jquery/QapTcha.jquery.js"></script>
<script type="text/javascript" src="jquery/jquery.validate.min.js"></script>
<style type="text/css">
form{margin:30px;width:300px}
label{float:left;clear:both;width:100px;margin-top:10px}
input{float:left;margin-top:10px}
.clr{clear:both}
.notice {background-color:#d8e6fc;color:#35517c;border:1px solid #a7c3f0;padding:10px}
.code {
margin:30px;
border:1px solid #F0F0F0;
background-color:#F8F8F8;
padding:10px;
color:#777;
}
.error {color: red; font:10px arial,sans-serif;}
</style>
<script type="text/javascript">
$(document).ready(function(){
$("#reg").validate({
debug: false,
rules: {
UserID: "required",
Pw: "required",
Pw2: "required",
},
messages: {
UserID: "Please enter a Username.",
Pw: "Please provide a password.",
Pw2: "Please confirm your password.",
},
submitHandler: function(form) {
$.post('verify.php', $("#reg").serialize(), function(data) {
$('#results').html(data);
$('#UserID').val("");
$('#Pw').val("");
$('#Pw2').val("");
});
}
});
});
</script>
</head>
<body>
<h3>Shaiya Account Registration</h3>
<div id="results" style="list-style-type:none;"></div>
<?php
// if form is submit
if(isset($_POST['submit']))
{
$response = '<div class="notice">';

if(isset($_POST['iQapTcha']) && empty($_POST['iQapTcha']) && isset($_SESSION['iQaptcha']) && $_SESSION['iQaptcha'])
{
$response .= 'Form can be submited';
unset($_SESSION['iQaptcha']);
}
else
$response .= 'Form can not be submited';

$response .= '</div>';

echo $response;
}
?>
<form action="verify.php" id="reg" method="post">
<fieldset>
<label>Username</label> <input name="UserID" maxlength="16" id="UserID" />
<label>Password</label> <input type="password" id="Pw" maxlength="16" name="Pw" />
<label>Confirm Password</label> <input type="password" id="Pw2" maxlength="16" name="Pw2" />
<div class="clr"></div>
<div id="QapTcha"></div>
<input type="submit" name="submit" value="Register" />
</fieldset>
</form>
<script type="text/javascript">
$('#QapTcha').QapTcha({});
</script>
</body>
</html>
verify.php

Code:
<?php
require_once('config.php');
$UserIp = $_SERVER['REMOTE_ADDR'];
$UserID = mssql_escape_string(trim($_POST['UserID']));
$Pw = mssql_escape_string(trim($_POST['Pw']));
$Pw2 = mssql_escape_string(trim($_POST['Pw2']));
$Error = array();
$Success=false;

if (isset($UserID,$Pw,$Pw2)) {
$Try = mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserID = '{$UserID}'") or die('Failed to verify username in Users_Master.');
	
//Verify data exists	
if(empty($UserID)){
	$Error['UserID'] = 'Please provide a user name.';
}else if(strlen($UserID) < 3 || strlen($UserID) > 16){
	$Error['UserID'] = 'Username must be between 3 and 16 characters in length.';
}else if(ctype_alnum($UserID) === false){
	$Error['UserID'] = 'Username must consist of numbers and letters only.';
}else if(mssql_num_rows($Try)){
	$Error['UserID'] = 'Username already exists, please choose a different username.';
}

if(empty($Pw)){
	$Error['Pw'] = 'Please provide a password.';
}else if(strlen($Pw) < 3 || strlen($Pw) > 16){
	$Error['Pw'] = 'Password must be between 3 and 16 characters in length.';
}else if($Pw != $Pw2){
	$Error['Pw2'] = 'Passwords do not match.';
}
	
//Check for errors. If there is none, insert the account into the database.
if(count($Error) == 0){
mssql_query("INSERT INTO PS_UserData.dbo.Users_Master (UserID,Pw,JoinDate,Admin,AdminLevel,UseQueue,Status,Leave,LeaveDate,UserType,Point,UserIp) VALUES ('{$UserID}','{$Pw}',GETDATE(),0,0,0,0,0,GETDATE(),'N',0,'{$UserIp}')");
$Check = mssql_query("SELECT * FROM PS_UserData.dbo.Users_Master WHERE UserID = '{$UserID}'");
if(mssql_num_rows($Check) != 1){$Error[]='Failed to create account';}}
if(count($Error) != 0){foreach($Error as $Errors){echo "<li>".$Errors."</li>";}}else{echo "Account \"".$UserID."\" successfully created!";}
}
?>



when i try to register this is the result

Shaiya Account Registration

Fatal error: Call to undefined function mssql_connect() in C:\AppServ\www\reg\config.php on line 6
08/02/2013 15:30 -Torben-#2
As your error says, you need to install the mssql libary for php.
look here:
[Only registered and activated users can see links. Click Here To Register...]
08/02/2013 17:48 @nDroid22#3
Quote:
Originally Posted by -Torben- View Post
As your error says, you need to install the mssql libary for php.
look here:
[Only registered and activated users can see links. Click Here To Register...]
i will chek this one..

it is for linux??

my sysmtem is win7 ultimate 32bit
SQLserver 2008
php for shaiya registration
08/02/2013 23:16 robertomoran10#4
Hello friends someone wants to create a shaiya private sever can add me on facebook roberto carlos moran
08/02/2013 23:53 -Torben-#5
Quote:
Originally Posted by @nDroid22 View Post
i will chek this one..

it is for linux??

my sysmtem is win7 ultimate 32bit
SQLserver 2008
php for shaiya registration
Its for php. The registration Scripts are running with php on a webserver (or maybe in your case local idk).

But anyway your php version needs a packet so that it can understand the mssql-functions like mssql_connect().

It is obvious that you use windows and microsoft sql-server (mssql) for your server to run. But not every php insatllation can connect to mssql.

Conclusion: So you need a packet/libary for your installed php version on your webserver.
08/03/2013 05:19 @nDroid22#6
Quote:
Originally Posted by -Torben- View Post
Its for php. The registration Scripts are running

It is obvious that you use windows and microsoft sql-server (mssql) for your server to run. But not every php insatllation can connect to mssql.

Conclusion: So you need a packet/libary for your installed php version on your webserver.
what kind of packet /library sir?? do u have a link for it??
thanks for advance...
08/08/2013 08:27 @nDroid22#7
problem SOLVE
08/08/2013 13:40 [ADM]Alcest#8
Haha, appache server was fecked up right? thats why your scripts didnt worked.
09/07/2013 06:40 Autrux#9
#moved

#closed