Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Warning: mssql_connect() [function.mssql-connect]: Unable to connect to server

142 views
Skip to first unread message

JJ

unread,
May 15, 2011, 12:02:41 PM5/15/11
to
and also "Warning: mssql_query() [function.mssql-query]: message:
Login failed for user '(null)'."

The user is ok, I reset the pwd too to be sure. SQL services up and
running.

The full error message is as follows:

Warning: mssql_connect() [function.mssql-connect]: Unable to connect
to server: CRIMINALMU_lj97\SQLEXPRESS in C:\MuServer\Portale
\config1.php on line 8
Warning: mssql_select_db(): supplied argument is not a valid MS SQL-
Link resource in C:\MuServer\Portale\config1.php on line 9
Warning: mssql_query() [function.mssql-query]: message: Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection. (severity 14) in C:\MuServer\Portale\config1.php on line
12
Warning: mssql_query() [function.mssql-query]: Unable to connect to
server: (null) in C:\MuServer\Portale\config1.php on line 12
Warning: mssql_query() [function.mssql-query]: A link to the server
could not be established in C:\MuServer\Portale\config1.php on line 12
Warning: mssql_query() [function.mssql-query]: message: Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection. (severity 14) in C:\MuServer\Portale\config1.php on line
13
Warning: mssql_query() [function.mssql-query]: Unable to connect to
server: (null) in C:\MuServer\Portale\config1.php on line 13
Warning: mssql_query() [function.mssql-query]: A link to the server
could not be established in C:\MuServer\Portale\config1.php on line 13
Warning: mssql_query() [function.mssql-query]: message: Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection. (severity 14) in C:\MuServer\Portale\config1.php on line
14
Warning: mssql_query() [function.mssql-query]: Unable to connect to
server: (null) in C:\MuServer\Portale\config1.php on line 14
Warning: mssql_query() [function.mssql-query]: A link to the server
could not be established in C:\MuServer\Portale\config1.php on line 14
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-
result resource in C:\MuServer\Portale\config1.php on line 15
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-
result resource in C:\MuServer\Portale\config1.php on line 16
Warning: mssql_num_rows(): supplied argument is not a valid MS SQL-
result resource in C:\MuServer\Portale\config1.php on line 17
Warning: mssql_query() [function.mssql-query]: message: Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection. (severity 14) in C:\MuServer\Portale\config1.php on line
82
Warning: mssql_query() [function.mssql-query]: Unable to connect to
server: (null) in C:\MuServer\Portale\config1.php on line 82
Warning: mssql_query() [function.mssql-query]: A link to the server
could not be established in C:\MuServer\Portale\config1.php on line 82
Warning: mssql_fetch_array(): supplied argument is not a valid MS SQL-
result resource in C:\MuServer\Portale\config1.php on line 84
Warning: mssql_query() [function.mssql-query]: message: Login failed
for user '(null)'. Reason: Not associated with a trusted SQL Server
connection. (severity 14) in C:\MuServer\Portale\config1.php on line
88
Warning: mssql_query() [function.mssql-query]: Unable to connect to
server: (null) in C:\MuServer\Portale\config1.php on line 88
Warning: mssql_query() [function.mssql-query]: A link to the server
could not be established in C:\MuServer\Portale\config1.php on line 88
Warning: mssql_fetch_array(): supplied argument is not a valid MS SQL-
result resource in C:\MuServer\Portale\config1.php on line 90

And here's the config1.php file:

<?php
//
DATABASE
$dbhost = "CRIMINALMU_lj97\SQLEXPRESS";
$dbuser = "sa";
$dbpasswd = "********";

// CONNESSIONE
$msconnect = mssql_connect("$dbhost","$dbuser","$dbpasswd");
$msdb=mssql_select_db("CriminalMu",
$msconnect);

// STATUS SERVER
$status_gilde = mssql_query("SELECT * FROM Guild WHERE G_Name!
=null");
$status_account = mssql_query("SELECT * FROM MEMB_INFO WHERE
memb_name!=null");
$status_personaggi = mssql_query("SELECT * FROM Character WHERE Name!
=null");
$status_gilde = mssql_num_rows($status_gilde);
$status_account = mssql_num_rows($status_account);
$status_personaggi = mssql_num_rows($status_personaggi);
if ($fp=@fsockopen("127.0.0.1","44405",$ERROR_NO,$ERROR_STR,
(float)0.5))
{
fclose($fp);
$status_server="<font color=\"00FF00\">Online</font>";
}
else
{
$status_server="<font color=\"FF0000\">Offline</font>";
}

// SETTAGGIO LOGIN
$login = @$HTTP_GET_VARS["login"];
if(strpos($login, " ") > 0){$login = "";}
if($login == 1){
$username = @$HTTP_POST_VARS["_username"];
if(strpos($username, " ") > 0){$username = "";}
$password = @$HTTP_POST_VARS["_password"];
if(strpos($password, " ") > 0){$password = "";}
$sql = "SELECT * FROM MEMB_INFO WHERE memb___id='$username' AND
memb__pwd='$password'";
$query = mssql_query($sql, $msconnect);
$numero = mssql_num_rows($query);
if($numero == 1){
$_SESSION['login'] = 1;
$_SESSION['nome'] = $username;

// per aggiungere un nuovo account che abbia i privilegi da admin
sul sito
// bisogna inserire questa stringa -> || ($username ==
"NomeAccount")
// con il nome dell'account al posto di "NomeAccount" all'interno
di questo IF

if(($username == "danilo")
|| ($username == "diablo")
|| ($username ==
"accountDiEsempioCheNonPuoMaiEsistere") // <--- Stringa di esempio
|| ($username == "accountDiEsempioCheNonPuoMaiEsistere2") // <---
Stringa di esempio
){
$_SESSION['admin'] = 1;
}
}
}

//SETTAGGIO ADMIN
$login_admin = 0;
$login_admin = @$HTTP_GET_VARS["login_admin"];
if(strpos($login_admin, " ") > 0){$login_admin = "";}
if($login_admin == 1){
$username = @$HTTP_POST_VARS["_username"];
if(strpos($username, " ") > 0){$username = "";}
$password = @$HTTP_POST_VARS["_password"];
if(strpos($password, " ") > 0){$password = "";}
$codice_admin = @$HTTP_POST_VARS["_codice"];
if(strpos($codice_admin, " ") > 0){$codice_admin = "";}
$sql = "SELECT * FROM MEMB_INFO WHERE memb___id='$username' AND
memb__pwd='$password'";
$query = mssql_query($sql, $msconnect);
$numero = mssql_num_rows($query);
if(($numero == 1)&&($codice_admin == "asterix")&&($_SESSION['admin']
== 1)){
$_SESSION['login'] = 1;
$_SESSION['nome'] = $username;
$_SESSION['admin'] = 2;
}
}

//N° PG ONLINE
$a = 1;
$server1 = "CriminalMu01";
$server2 = "CriminalMu02";
$query = mssql_query("SELECT memb___id FROM MEMB_STAT WHERE
ConnectStat='$a' AND ServerName='$server1'");
$id = 0;
while($array = mssql_fetch_array($query, MSSQL_ASSOC)){
$id++;
}
$n_pg_online_1 = $id;
$query = mssql_query("SELECT memb___id FROM MEMB_STAT WHERE
ConnectStat='$a' AND ServerName='$server2'");
$id = 0;
while($array = mssql_fetch_array($query, MSSQL_ASSOC)){
$id++;
}
$n_pg_online_2 = $id;
$n_pg_totali = $n_pg_online_1 + $n_pg_online_2;
//

?>


I tried calling the dbhost in many different ways, tried using a
different user with administrator rights both under windows users and
sql users, and whatnot.

I'm not an expert in this field, but I really did a lot of research on
this matter... alas with little success.

Peace out, J

JJ

unread,
May 16, 2011, 5:16:48 PM5/16/11
to
Nothin'? Seriously?!?! Mmm... not bad! Adn you have the chutzpah to
call yourself "php.windows" group? mmm... ;) :P #FLAME
0 new messages