[HELP] Reg Page Errors...

02/07/2011 23:51 *[F]rea[K]*#1
Hey EPvP,

i got some errors on reg page:

Warning: mssql_connect() [function.mssql-connect]: message: Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection. (severity 14) in C:\Program Files (x86)\WebServ\httpd\website\regaccount.php on line 80

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server: in C:\Program Files (x86)\WebServ\httpd\website\regaccount.php on line 80

Warning: mssql_query(): supplied argument is not a valid MS SQL-Link resource in C:\Program Files (x86)\WebServ\httpd\website\regaccount.php on line 81

Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-result resource in C:\Program Files (x86)\WebServ\httpd\website\regaccount.php on line 82



^this are my errors...


php script:


<?php


// fill in your mssql info here
$mssql = array(
'host' => "host",
'user' => "user",
'pass' => "pass",
);

function anti_injection($sql) {
$sql = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$sql);
$sql = trim($sql);
$sql = strip_tags($sql);
$sql = addslashes($sql);
return $sql;
}


echo "<center>";

if($_POST['activ'] == '1') {

$accname = anti_injection($_POST['accname']);
$accmail = anti_injection($_POST['accmail']);

$accpass1 = anti_injection($_POST['accpass1']);
$accpass2 = anti_injection($_POST['accpass2']);

$con = mssql_connect($mssql['host'],$mssql['user'],$mssql['pass']);

$result1 = mssql_query("SELECT * FROM account.dbo.USER_PROFILE WHERE user_id = '".$accname."'",$con);
$result2 = mssql_query("SELECT * FROM account.dbo.Tbl_user WHERE user_id = '".$accname."'",$con);
$result3 = mssql_query("SELECT * FROM account.dbo.Tbl_user WHERE user_mail = '".$accmail."'",$con);

$row1 = mssql_num_rows($result1);
$row2 = mssql_num_rows($result2);
$row3 = mssql_num_rows($result3);

$dk_time=strftime("%y%m%d%H%M%S");
list($usec1, $sec1) = explode(" ",microtime());
$dk_user_no=$dk_time.substr($usec1,2,2);


if(empty($accname) || empty($accpass1) || empty($accpass2)|| empty($accname) || empty($accmail)) {
echo "<br>You didnt fill in all fields<a href='javascript:history.back()'>Go Back</a>";
} elseif($row1 > '0' || $row2 > '0') {
echo "<br>This Account name already exists.<a href='javascript:history.back()'>Go Back</a>";
} elseif($row3 > '0') {
echo "<br>This E-Mail is already in use.<a href='javascript:history.back()'>Go Back</a>";
} elseif($accpass1 != $accpass2) {
echo "<br>The passwords did not match<a href='javascript:history.back()'>Go Back</a>";
} elseif($accpass1 == $accname) {
echo "<br>Account name and password are the same.<a href='javascript:history.back()'>Go Back</a>";
} elseif(!preg_match("/^[0-9a-zA-Z]{3,15}$/i", $accname)) {
echo "<br>Enter a account name only with 0-9 , a-z and A-Z.<a href='javascript:history.back()'>Go Back</a>";
} elseif(!preg_match("/^[0-9a-zA-Z]{3,15}$/i", $accpass1)) {
echo "<br>Enter a password only with 0-9 , a-z and A-Z.<a href='javascript:history.back()'>Go Back</a>";
} elseif(!preg_match("/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/i",$accmail)) {
echo "<br>Your e-Mail is not correct.<a href='javascript:history.back()'>Go Back</a>";
} elseif(strlen($accname) < 3 || strlen($accname) > 15) {
echo "<br>The Accountname must at least 3 indications long and may maximally 15 indications long.<a href='javascript:history.back()'>Go Back</a>";
} elseif(strlen($accpass1) < 3 || strlen($accpass1) > 15) {
echo "<br>The Password must at least 3 indications long and may maximally 15 indications long.<a href='javascript:history.back()'>Go Back</a>";
} else {

$accpass = md5($accpass1);

mssql_query("INSERT INTO account.dbo.USER_PROFILE (user_no,user_id,user_pwd,resident_no,user_type,lo gin_flag,login_tag,ipt_time,login_time,logout_time ,user_ip_addr,server_id) VALUES ('$dk_user_no','".$accname."','".$accpass."','8010 11000000','1','0','Y','".$date."',null,null,null,' 000')",$con);
mssql_query("INSERT INTO account.dbo.Tbl_user (user_no,user_id,user_pwd,user_mail,user_answer,us er_question) VALUES ('$dk_user_no','".$accname."','".$accpass1."','".$ accmail."','0','0')",$con);

echo "<center><b><u>The account was successfully created. Have fun !</b></u></center><br><br>";
echo "<center>Here is your login info again:</center>";
echo "<center>Your account name is: <b>".$accname."</b></center>";
echo "<center>Your password is: <b>".$accpass1."</b></center>";
echo "DO NOT LOOSE THIS INFO, YOU MAY WRITE IS DOWN AND HIDE IT";
}

} else {

$con = mssql_connect($mssql['host'],$mssql['user'],$mssql['pass']);
$result1 = mssql_query("SELECT * FROM account.dbo.USER_PROFILE",$con);
$row1 = mssql_num_rows($result1);

echo "<center><b><u>This time we have ".$row1." Registed Accounts on our Server<br>Join us.</b></u></center><br>";
echo "<form action='".$_SEVER['PHP_SELF']."' method='POST'>";
echo "<center><table>";
echo "<tr><td colspan='2' align='center'><b><u>Your Account Info</u></b></td></tr>";
echo "<tr><td>Account Name</td><td><input type='text' name='accname' maxlength='12'></td></tr>";
echo "<tr><td>Password</td><td><input type='password' name='accpass1' maxlength='12'></td></tr>";
echo "<tr><td>Again pass.</td><td><input type='password' name='accpass2' maxlength='12'></td></tr>";
echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
echo "<tr><td colspan='2' align='center'><b><u>Other account info</u></b></td></tr>";
echo "<tr><td>Email</td><td><input type='text' name='accmail' maxlength='50'></td></tr>";
echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
echo "<tr><td colspan='2' align='center'>
<input type='hidden' name='activ' value='1'>
<input type='submit' value='Create Account'></td></tr>";
echo "</table></center>";
echo "</form>";

}

echo "</center>";

?>


host, user and i got changed i changed just for post back if u understand what i mean

hope you can help me...

thank you
02/08/2011 00:06 T04STY#2
Quote:
'host' => "host",
'user' => "user",
'pass' => "pass",
you need to change that to the login information of you mssql server, host is normally "127.0.0.1" user and pass should be the same as you filled into the ini files at your serverfiles.
02/08/2011 00:39 ҉ THT ҉#3
Yup, that will fix all errors
02/08/2011 01:11 6shadow6#4
its not helping

In addition, by going to C: \ drive to the Windows \ system does not display any files. Despite this, it is enabled to show hidden and system files. go back up the missing library and still nothing it does not give, except that the mass of left accounts in SQL. The former administrator of the server messed up terribly hard but it will clean up everything to be done. The matter is really not funny.
I had a similar problem as FREAK but I managed to fix the issue, an obsolete library ntwdblib.dll uploading and everything now works correctly.

Next TIPS:
Another thing you may reinstall the entire MSSQL due to unspecified errors.
Despite the mobilization of Client Network Utility and Named Pipes inclusion, I turned the TCP \ IP.
I decided to look deeper and found that the SQL Server Network Utility and found that there is the same as both of these things have been disabled. I turned it on again and still nothing that can not.

Do you have any interesting ideas, in addition to reinstall the system and SQL Server.
02/08/2011 05:56 *[F]rea[K]*#5
Quote:
Originally Posted by T04STY View Post
you need to change that to the login information of you mssql server, host is normally "127.0.0.1" user and pass should be the same as you filled into the ini files at your serverfiles.

nope its not helping dude
and dont forget what i wrote on my files it is changed i just wrote "host, user and pass" for epvp...
02/08/2011 08:06 gedimazs#6
I think he trying to use other user than SA in his DB, cause I see problem here:
Code:
Login failed for[B] user '(null)'[/B]. Reason: Not associated with a trusted SQL Server connection.
02/08/2011 10:51 6shadow6#7
Quote:
Originally Posted by gedimazs View Post
I think he trying to use other user than SA in his DB, cause I see problem here:
Code:
Login failed for[B] user '(null)'[/B]. Reason: Not associated with a trusted SQL Server connection.
I have my own server and I never use SA account. I use your account and everything works. And here in the case of a server which has a FREAK, a really bad mess in the settings. Something will show you some pictures of the databases where they are assigned to the account.
Try not to use SA account since this account has too much power and to create an account through register.php is not required as big powers


My data are hidden from safety reasons
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]

And as you can see there are no other type DKserver accounts and other accounts that are not needed are available when you restore the database.

I entered the relevant data and yet it is still a problem, the most common problem with this behavior is the lack of some libraries in the system and server-side web


Code:
<center><font color="red" face="Verdana"><b>
<br>Podstawowe Informacje dotyczące zakładania konta<br>
Minimlna długość NAZWY KONTA i HASŁA to 3 znaki, maxymalna długość 15 znaków.<br>
Dozwolone znaki dla nazwy konta i hasła to; 0-9 , a-z i A-Z<br></b></font>
<br></center>
<font color="red" face="Verdana">
<?php

// fill in your mssql info here
[COLOR="Red"]$mssql = array(
		'host' => "IP",
		'user' => "LOGIN",
		'pass' => "PASS"
	);[/COLOR]

function anti_injection($sql) {
   $sql = preg_replace(sql_regcase("/(from|select|insert|delete|where|drop table|show tables|#|\*|--|\\\\)/"),"",$sql);
   $sql = trim($sql);
   $sql = strip_tags($sql);
   $sql = addslashes($sql);
   return $sql;
}


echo "<center>";

if($_POST['activ'] == '1') {

		$accname = anti_injection($_POST['accname']);
		$accmail = anti_injection($_POST['accmail']);
		
		$accpass1 = anti_injection($_POST['accpass1']);
		$accpass2 = anti_injection($_POST['accpass2']);
	
		[COLOR="#ff0000"]$con = mssql_connect($mssql['IP'],$mssql['LOGIN'],$mssql['PASS']);[/COLOR]

		$result1 = mssql_query("SELECT * FROM account.dbo.USER_PROFILE WHERE user_id = '".$accname."'",$con);
		$result2 = mssql_query("SELECT * FROM account.dbo.Tbl_user WHERE user_id = '".$accname."'",$con);
		$result3 = mssql_query("SELECT * FROM account.dbo.Tbl_user WHERE user_mail = '".$accmail."'",$con);

		$row1 = mssql_num_rows($result1);
		$row2 = mssql_num_rows($result2);
		$row3 = mssql_num_rows($result3);
		
		$dk_time=strftime("%y%m%d%H%M%S");
     	list($usec1, $sec1) = explode(" ",microtime());
     	$dk_user_no=$dk_time.substr($usec1,2,2);


		if(empty($accname) || empty($accpass1) || empty($accpass2)|| empty($accname) || empty($accmail)) {
			echo "<br><font color='blue'>Nie wypełnione wszystkie pola<a href='javascript:history.back()'>Powrót</a>";
		} elseif($row1 > '0' || $row2 > '0') {
			echo "<br><font color='blue'>Konto o podanej nazwie już ISTNIEJE.<a href='javascript:history.back()'>Powrót</a>";
		} elseif($row3 > '0') {
			echo "<br><font color='blue'>Podany adres E-mail jest już zajęty.<a href='javascript:history.back()'>Powrót</a>";
		} elseif($accpass1 != $accpass2) {
			echo "<br><font color='blue'>Podane HASŁA nie są takie same.<a href='javascript:history.back()'>Powrót</a>";
		} elseif($accpass1 == $accname) {
			echo "<br><font color='blue'>Nazwa konta i hasło nie mogą być takie same.<a href='javascript:history.back()'>Powrót</a>";
		} elseif(!preg_match("/^[0-9a-zA-Z]{3,15}$/i", $accname)) {
			echo "<br><font color='blue'>Dozwolone znaki dla nzawy KONTA to; 0-9 , a-z and A-Z.<a href='javascript:history.back()'>Powrót</a>";
		} elseif(!preg_match("/^[0-9a-zA-Z]{3,15}$/i", $accpass1)) {
			echo "<br><font color='blue'>Dozwolone znaki dla HASŁA to; 0-9 , a-z and A-Z.<a href='javascript:history.back()'>Powrót</a>";
		} elseif(!preg_match("/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/i",$accmail)) {
			echo "<br><font color='blue'>Podany E-mail jest błędny.<a href='javascript:history.back()'>Powrót</a>";
		} elseif(strlen($accname) < 3 || strlen($accname) > 15) {
			echo "<br><font color='blue'>Minimalna długość nazwy konta to 3 znaki, maxymalna długość nazwy 15 znaków.<a href='javascript:history.back()'>Powrót</a>";
		} elseif(strlen($accpass1) < 3 || strlen($accpass1) > 15) {
			echo "<br><font color='blue'>Minimlna długość HASŁA to 3 znaki, maxymalna długość 15 znaków.<a href='javascript:history.back()'>Powrót</a>";
		} else {

			$accpass = md5($accpass1);

			mssql_query("INSERT INTO account.dbo.USER_PROFILE (user_no,user_id,user_pwd,resident_no,user_type,login_flag,login_tag,ipt_time,login_time,logout_time,user_ip_addr,server_id) VALUES ('$dk_user_no','".$accname."','".$accpass."','801011000000','1','0','Y','".$date."',null,null,null,'000')",$con);
			mssql_query("INSERT INTO account.dbo.Tbl_user (user_no,user_id,user_pwd,user_mail,user_answer,user_question) VALUES ('$dk_user_no','".$accname."','".$accpass1."','".$accmail."','0','0')",$con);

			echo "<center><b><u><font color='blue'>Konto założone POPRAWNIE. Życzymy Miłej ZABAWT ! BlooD-TEAM</b></u></center><br><br>";
			echo "<center><font color='blue'>Dane dla twojego KONTA:</center>";
			echo "<center><font color='blue'>Nazwa twojego KONTA: <b>".$accname."</b></center>";
			echo "<center><font color='blue'>Twoje HASŁO to: <b>".$accpass1."</b></center>";
			echo "<font color='blue'>Nie zapomnij swoich danych, Zapisz swoje dane i nie podaj DANYCH LOGOWANIA NIKOMU";
		}

} else {

	[COLOR="#ff0000"]$con = mssql_connect($mssql['IP'],$mssql['LOGIN'],$mssql['PASS']);[/COLOR]
	$result1 = mssql_query("SELECT * FROM account.dbo.USER_PROFILE",$con);
	$row1 = mssql_num_rows($result1);
	
	echo "<center><b>Aktualna liczba KONTA na Serwerze <blink>" .$row1." </blink><br> Dołącz do NAS</b></center><br>";
	echo "<form action='".$_SEVER['PHP_SELF']."' method='POST'>";
	echo "<center><table>";
	echo "<tr><td colspan='2' align='center'><b>Dane dla twojego KONTA</b></td></tr>";
	echo "<tr><td><font color='blue'>Nazwa KONTA</td><td><input type='text' name='accname' maxlength='12'></td></tr>";
	echo "<tr><td><font color='blue'>Hasło</td><td><input type='password' name='accpass1' maxlength='12'></td></tr>";
	echo "<tr><td><font color='blue'>Ponów Hasło</td><td><input type='password' name='accpass2' maxlength='12'></td></tr>";
	echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
	echo "<tr><td colspan='2' align='center'><b>Inne informacje</b></td></tr>";
	echo "<tr><td><font color='blue'>E-mail</td><td><input type='text' name='accmail' maxlength='50'></td></tr>";
	echo "<tr><td>&nbsp;</td><td>&nbsp;</td></tr>";
	echo "<tr><td colspan='2' align='center'>
		<input type='hidden' name='activ' value='1'>
		<input type='submit' value='Zakładam KONTO'></td></tr>";
	echo "</table></center>";
	echo "</form>";

}

echo "</center>";

?>
<br>
<center>
<br><br><br>
<font color="yellow" face="Verdana" size="3"><b>
W razie problemów informować mnie wysyłając PW na naszej stronie.<br></b>
</font>
</center>
My data are hidden from safety reasons
And here are the authorization for the user
example: serveradmin



[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]