Hello dear Professionals.
I’m not really good in Programming so its really hard for me to change a php script.
I need help in converting this script.
If anyone can convert it from MSSQL to SQLSRV for me that would be be very very helpful.
Here is my phpCode
[php]<?php
//MSSQL settings
$host = “xxxxxx”; //like Naty/SQLEXPRESS or Naty or Naty/SQL
$sql_user = ‘xxxxxx’; //user name of mssql
$sql_pwd = ‘xxxxxx’; //password of mssql
$base = “xxxxxx”; //database name - dont edit!
//script started
$reg_open = true;
$tabelka = '<form action=main.php?idx=register method=post>
Username: | 4~16 digs | |
Password: | 4~16 digs | |
Repeat Password: | 4~16 digs | |
Email: | ||
|
||
if($reg_open AND isset($_POST[‘login’]))
{
$conn=mssql_connect($host,$sql_user,$sql_pwd) or die(“Fatal Error
Unable to connect to the Database
Back”);
@mssql_select_db($base, $conn) or die(“Fatal Error
The Database does not exist, or you do not have permission to access it
Back”);
$login = $_POST[‘login’];
$pw = $_POST[‘pass’];
$cpw = $_POST[‘cpass’];
$sex = $_POST[‘sex’];
$sls = $_POST[‘sls’];
$email = $_POST[‘email’];
$login = safety($login);
$pw = safety($pw);
$sls = safety($sls);
$cpw = safety($cpw);
if(ereg("[^0-9a-zA-Z]", $login, $str))
{
echo “”;
echo “”;
break;
}
elseif(ereg("[^0-9a-zA-Z]", $pw, $str))
{
echo “”;
echo “”;
break;
}
elseif(!ereg("([a-zA-Z0-9]+)@([^[:space:]]*)([[:alnum:]]+).([a-z])", $email) )
{
echo “”;
echo “”;
break;
}
elseif (empty($login))
{
echo “”;
echo “”;
break;
}
elseif (empty($pw))
{
echo “”;
echo “”;
break;
}
elseif (empty($cpw))
{
echo “”;
echo “”;
break;
}
else
{
$login_test = strtolower($login);
session_start();
$login_result = mssql_query(“SELECT * FROM MKZ_LUserDB_30.dbo.T_UserCore WHERE F_UserName = ‘$login’”) or die(fail);
$numRows = mssql_num_rows($login_result);
if($numRows >= 1)
{
echo “”;
echo “”;
break;
}
if($_SESSION['security_code']!=$_POST['norobot']) { // Check
echo "<script>alert('Wrong Security Code , Are you sure you are a human ?');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
$login_results = mssql_query("SELECT * FROM MKZ_LUserDB_30.dbo.T_UserCore WHERE F_email = '$email'") or die(fail);
$numRowss = mssql_num_rows($login_results);
if ($numRowss >= 1)
{
echo "<script>alert('Email Already Taken!');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
elseif (strlen($login) < 4)
{
echo "<script>alert('Username less then 4 digs');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
elseif (strlen($pw) < 4)
{
echo "<script>alert('Password less then 4 digs');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
elseif (strlen($pw) > 12)
{
echo "<script>alert('Password is longer then 12 digs');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
elseif (strlen($login) > 12)
{
echo "<script>alert('Username is longer then 12 digs');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
elseif ($pw != $cpw)
{
echo "<script>alert('Passwords does not match!');</script>";
echo "<script>window.location='main.php?idx=register';</script>";
break;
}
else
{
$query= mssql_query("SELECT top 1 * FROM MKZ_LUserDB_30.dbo.T_UserCore WHERE F_Type = '0' order by F_ID desc");
$row=mssql_fetch_array($query);
$ad= $row["F_ID"];
$ID = $ad+1;
mssql_query(“INSERT INTO MKZ_LUserDB_30.dbo.T_UserCore (F_ID, F_UserName, F_PassWord, F_Seconds, F_FreeSeconds, F_email)
VALUES (’$ID’,’$login’, ‘$pw’, 0, 0, ‘$email’)”);
echo “”;
echo “”;
exit();
}
}
}
elseif($reg_open)
{
echo $tabelka;
}
else
{
echo ‘…’;
}
?>[/php]
Thanks in Advance.