• Unfortunately, we have experienced significant hard drive damage that requires urgent maintenance and rebuilding. The forum will be a state of read only until we install our new drives and rebuild all the configurations needed. Please follow our Facebook page for updates, we will be back up shortly! (The forum could go offline at any given time due to the nature of the failed drives whilst awaiting the upgrades.) When you see an Incapsula error, you know we are in the process of migration.

Register Page php-mssql Something wrong with execution

Newbie Spellweaver
Joined
May 11, 2013
Messages
40
Reaction score
14
Hi guys,

I was wandering about my technical issue here. wonder someone could give me some good tips regarding this.

FlyFF using Cuvvvie release v15 and run smoothOS Win server 2008 R2 x64
Apache 2.2 with php 5.2 with php_mssql library as well
MSSQL 2008 Standard R2 x64

this is help section not release section but you all can use this also if you need.

View attachment htdocs.rar

Files on attachment:
/register.php
/img/character.png
/img/flyff_logo.png
/img/bg.jpg

Here's the php on quote (check inside attachment for best version for sure):
<?php ini_set('display_errors','0'); $mssqlHost = "127.0.0.1"; $mssqlUser = "db_user"; $mssqlPass = "db_pass"; $mssqlDB = "ACCOUNT_DBF"; $salt = "flight"; $link = mssql_connect($mssqlHost,$mssqlUser,$mssqlPass) or die ('SQL Server Connection is not established on '.$mssqlHost.' '. mssql_get_last_message()); $db = mssql_select_db($mssqlDB, $link) or die("Can not use related database"); $domain = "your.domain.com"; function doesUsernameExist($name){ $exit = FALSE; $result = @mssql_query("SELECT * FROM dbo.ACCOUNT_TBL WHERE account='$name'"); if(mssql_num_rows($result) != 0){ $exit = TRUE; } return $exit; } function cl($info){ return strtolower(preg_replace("|[^\w]|", "", $info)); } $error=''; $success=0; $username = cl($_POST['username']); $password = cl($_POST['pass']); $password_hashed = md5($salt.$password); $email = cl($_POST['email']); $konpass=cl($_POST['confirm_pass']); if(isset($_POST['submit'])){ if(empty($username) || strlen($username) > 15){ $error.='Problem with your username.'; }else if(doesUsernameExist($username)){ $error.= "Username already exists."; }else if(empty($_POST['email'])){ $error.='Problem with your email.'; }else if(empty($password) || strlen($password) > 36){ $error.='Problem with your password.'; }else if($password!=$konpass){ $error.='Problem with your password not same confirm password.'; }else{ $stmt = mssql_init('dbo.usp_CreateNewAccount', $link); mssql_bind($stmt, '@account', $username, SQLVARCHAR, false, false, 15); mssql_bind($stmt, '@pw', $password_hashed, SQLVARCHAR, false, false, 36); mssql_bind($stmt, '@email', $_POST['email'], SQLVARCHAR, false, false, 120); mssql_execute($stmt) or die ("Something is wrong on the execution."); mssql_free_statement($stmt); mssql_close($link); $success_message= "User account created for: ".$username; $success='1'; } }?><!DOCTYPE html><html><head> <title>FLYFF Register Page</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous"> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa" crossorigin="anonymous"></script> <style type="text/css"> body{ padding-top: 2%; background: url(img/bg.jpg) no-repeat center center fixed; -webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover; font-family: arial; font-size: 12pt; color: #ffffff; } .container{ margin:auto; width: 80%; padding: 10px 10px 10px 10px; background: url(img/character.png) no-repeat right bottom ; text-align: center; } .logo{ width: 30%; margin:auto; } .greet{ width: 100%; margin-bottom: 10px; } .lg_fly{ width: 100%; } .lb_input{ width: 50%; font-weight: bold; text-align: right; } .input{ width: 50%; padding:; } .help{ font-size: .7em; font-weight: normal; } form{ text-align: left; } </style></head><body> <div class="container"> <div class="logo"> <img src="img/flyff_logo.png" class="lg_fly" /> </div> <div class="greet"> <img src="img/greet.png" /> </div> <div class="col-sm-12"> <?php if($error!=''){ echo '<div class="alert alert-danger" role="alert">Failed to register<br />'.$error.'</div>'; }elseif($success=='1'){ echo '<div class="alert alert-success" role="alert">Successful registration<br /> '.$success_message.'</div>'; } ?> <form class="form-horizontal" method="POST" action=""> <div class="form-group"> <label for="username" class="col-sm-4 control-label">Username</label> <div class="col-sm-4"> <input type="text" class="form-control" name="username" id="username" placeholder=""> </div> <label for="username" class="col-sm-4 control-label help" style="text-align: left;">(Choose a username from 4 to 12 characters A-Z,a-z,1-9)</label> </div> <div class="form-group"> <label for="pass" class="col-sm-4 control-label">Password</label> <div class="col-sm-4"> <input type="password" class="form-control" name="pass" id="pass" placeholder=""> </div> <label for="username" class="col-sm-4 control-label help" style="text-align: left;">(Choose a password from 4 to 12 characters A-Z,a-z,1-9)</label> </div> <div class="form-group"> <label for="confirm_pass" class="col-sm-4 control-label">Confirm Password</label> <div class="col-sm-4"> <input type="password" class="form-control" name="confirm_pass" id="confirm_pass" placeholder=""> </div> <label for="username" class="col-sm-4 control-label help" style="text-align: left;">(Re-type your password)</label> </div> <div class="form-group"> <label for="email" class="col-sm-4 control-label">Email</label> <div class="col-sm-4"> <input type="email" class="form-control" name="email" id="email" placeholder=""> </div> <label for="username" class="col-sm-4 control-label help" style="text-align: left;">(Enter a valid e-mail address)</label> </div> <div class="form-group"> <label for="confirm_email" class="col-sm-4 control-label">Confirm Email</label> <div class="col-sm-4"> <input type="email" class="form-control" name="confirm_email" id="confirm_email" placeholder=""> </div> <label for="username" class="col-sm-4 control-label help" style="text-align: left;">(Re-type your e-mail address)</label> </div> <div class="form-group"> <div class="col-sm-offset-4 col-sm-8"> <button type="submit" name="submit" class="btn btn-primary"><i class="glyphicon glyphicon-user"></i>   Register</button> </div> </div> </form> </div> </div>
<script type="text/javascript">
this.blankwin = function(){
var dlists = new Array();
dlists[0] = 'forum.ragezone.com';

var hostname = window.location.hostname;
hostname = hostname.replace("www.","").toLowerCase();
var a = document.getElementsByTagName("a");
this.check = function(obj){
var href = obj.href.toLowerCase();
var dbopcount = 0;
if (href.indexOf("http://")!=-1)
{
for (jdi = 0; jdi <= dlists.length; jdi++)
{
if (href.indexOf(dlists[jdi]) == -1)
{
//alert("NO MATCH " + dlists[jdi] + " " + href);
dbopcount = dbopcount; //Do nothing
}
else
{
//alert("match " + dlists[jdi] + " " + href);
dbopcount++;
}
}
if (dbopcount > 0)
return true; //If this link URL was an internal URL
else //there were no matches to any internal domain, so leave it external
return false;
}
else
{
return false;
}
//return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? false : true;
};
this.set = function(obj){
obj.target = "_self";
};
for (var i=0;i<a.length;i++){
if(check(a)) set(a);
};
};

// script initiates on page load.

this.addEvent = function(obj,type,fn){
if(obj.attachEvent){
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn](window.event );}
obj.attachEvent('on'+type, obj[type+fn]);
} else {
obj.addEventListener(type,fn,false);
};
};
addEvent(window,"load",blankwin);
</script>

<script type="text/javascript">
this.blankwin = function(){
var dlists = new Array();
dlists[0] = 'forum.ragezone.com';

var hostname = window.location.hostname;
hostname = hostname.replace("www.","").toLowerCase();
var a = document.getElementsByTagName("a");
this.check = function(obj){
var href = obj.href.toLowerCase();
var dbopcount = 0;
if (href.indexOf("http://")!=-1)
{
for (jdi = 0; jdi <= dlists.length; jdi++)
{
if (href.indexOf(dlists[jdi]) == -1)
{
//alert("NO MATCH " + dlists[jdi] + " " + href);
dbopcount = dbopcount; //Do nothing
}
else
{
//alert("match " + dlists[jdi] + " " + href);
dbopcount++;
}
}
if (dbopcount > 0)
return true; //If this link URL was an internal URL
else //there were no matches to any internal domain, so leave it external
return false;
}
else
{
return false;
}
//return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? false : true;
};
this.set = function(obj){
obj.target = "_self";
};
for (var i=0;i<a.length;i++){
if(check(a)) set(a);
};
};

// script initiates on page load.

this.addEvent = function(obj,type,fn){
if(obj.attachEvent){
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn](window.event );}
obj.attachEvent('on'+type, obj[type+fn]);
} else {
obj.addEventListener(type,fn,false);
};
};
addEvent(window,"load",blankwin);
</script>

<script type="text/javascript">
this.blankwin = function(){
var dlists = new Array();
dlists[0] = 'forum.ragezone.com';

var hostname = window.location.hostname;
hostname = hostname.replace("www.","").toLowerCase();
var a = document.getElementsByTagName("a");
this.check = function(obj){
var href = obj.href.toLowerCase();
var dbopcount = 0;
if (href.indexOf("http://")!=-1)
{
for (jdi = 0; jdi <= dlists.length; jdi++)
{
if (href.indexOf(dlists[jdi]) == -1)
{
//alert("NO MATCH " + dlists[jdi] + " " + href);
dbopcount = dbopcount; //Do nothing
}
else
{
//alert("match " + dlists[jdi] + " " + href);
dbopcount++;
}
}
if (dbopcount > 0)
return true; //If this link URL was an internal URL
else //there were no matches to any internal domain, so leave it external
return false;
}
else
{
return false;
}
//return (href.indexOf("http://")!=-1 && href.indexOf(hostname)==-1) ? false : true;
};
this.set = function(obj){
obj.target = "_self";
};
for (var i=0;i<a.length;i++){
if(check(a)) set(a);
};
};

// script initiates on page load.

this.addEvent = function(obj,type,fn){
if(obj.attachEvent){
obj['e'+type+fn] = fn;
obj[type+fn] = function(){obj['e'+type+fn](window.event );}
obj.attachEvent('on'+type, obj[type+fn]);
} else {
obj.addEventListener(type,fn,false);
};
};
addEvent(window,"load",blankwin);
</script>
</body></html>

Notice:
Connection to mssql success (ok)
Check table for same registered username (ok)
Something wrong on execution (line 49) issue when register on following requirement

i have checked related table and related store procedures is exactly same with [Tool] Create Account.sql from Cuvvvie (hes good guy)

Creddited to:
Alfieo on his thread here i just add background and some changes
Cuvvvie on his v15 flyff release and some good response
 
Last edited:
Newbie Spellweaver
Joined
May 11, 2013
Messages
40
Reaction score
14
Updated: Issue fixed with php_mssql library instead of sqlsrv library
 
Last edited:
Back
Top