I recently came across this error while attempting to make a script(register script). This error has never, ever occurred before so I don't see why it would happen.
Script(Class.php(where the function is called from))
THIS IS ONLY A SNIPPET
class SQL
{
public function connect()
{
$connect = mssql_connect("SERVER", "sa", "password") or die("[Class SQL Error]: SQL->connect() returned False while trying to connect to the SQL Server.");
}
public function numrows($query)
{
$queryexec = mssql_query($query);
return mssql_num_rows(mssql_query($query)) or die(/*"[Function Error]: Cannot return number of rows. Query Given: ($query)"*/mssql_get_last_message());
}
}
class Website
{
private $SQL;
public function __construct()
{
$this->SQL = new SQL;
}
public function checkString($string)
{
if($this->SQL->numrows("SELECT * FROM [ACCOUNT_DBF].dbo.[ACCOUNT_TBL] WHERE unique_key='$string'") == 0)
{
return TRUE;
}
else
{
return FALSE;
}
}
}
Script: register.php(Where everything is called)
THIS IS THE FULL SCRIPT
<?php
if(isset($_POST['register']))
{
$username = $Website->antiinject(strip_tags($_POST['username']));
$password = $Website->antiinject(strip_tags($_POST['password']));
$rpassword = $Website->antiinject(strip_tags($_POST['rpassword']));
$email = $Website->antiinject(strip_tags($_POST['email']));
$remail = $Website->antiinject(strip_tags($_POST['remail']));
$randomString = $Website->generateRandomString();
if(!$username || !$password || !$rpassword || !$email || !$remail)
{
echo "[Error]: You didn't fill in all the fields.";
}
else
if($password != $rpassword)
{
echo "[Error]: The two passwords you entered do not match.";
}
else
if($email != $remail)
{
echo "[Error]: The two e-mails you entered do not match.";
}
else
if(!$Website->checkEmail($email))
{
echo "[Error]: The e-mail you entered isn't a valid e-mail";
}
else
if(!$Website->checkString(md5($randomString)))
{
echo "[Error]: Please refresh the page and register again. An internal coding error has occurred.";
}
else
{
$pass = md5($salt.$password);
$Website->checkAccount($username, $password, $pass, $email, $date, $time, $ip, $randomString);
}
}
echo "
<form method='post'>
<table border='0'>
<tr>
<td>
<b>Username:</b>
</td>
<td>
<input type='text' name='username'>
</td>
</tr>
<tr>
<td>
<b>Password:</b>
</td>
<td>
<input type='password' name='password'>
</td>
</tr>
<tr>
<td>
<b>Repeat Password:</b>
</td>
<td>
<input type='password' name='rpassword'>
</td>
</tr>
<tr>
<td>
<b>E-Mail:</b>
</td>
<td>
<input type='text' name='email'>
</td>
</tr>
<tr>
<td>
<b>Repeat E-Mail:</b>
</td>
<td>
<input type='text' name='remail'>
</td>
</tr>
<tr>
<td>
</td>
<td>
<input type='submit' name='register' value='Register'>
</td>
</tr>
</table>
</form>";
?>
I don't see the problem either.
When the "mssql_get_last_message" was removed, the error:
Any help?