Jump to content
MakeWebGames

Recommended Posts

Posted

After my host updated its php i have had lots of errors on my game.

I have changed most of it to get rid of most the errors but i got this one im not sure how to change.

$_POST['name'] = mysql_real_escape_string($_POST['name']);

$_POST['class'] = abs(@intval($_POST['class']));

Here is the error displayed:

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'damagedc'@'localhost' (using password: NO) in /home/damagedc/public_html/business_create.php on line 17

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/damagedc/public_html/business_create.php on line 17

Posted (edited)

well that does not make sense to have...

$_POST['name'] = ($_POST['name']);

take off the () no need for them you removed the mres... I doubt it had anything to do with the new php upgrade...

Edited by lucky3809
Posted

The line is useless with or without the () it's just like saying 1 = 1; when 1 is already 1... I would also assume Mres was there to stop sql injection? you just opened yourself up for that...

Posted
i just done this to avoid the problem and it seems to work

$_POST['name'] = ($_POST['name']);

$_POST['class'] = abs(@intval($_POST['class']));

Yeh you fixed it, but now i add a nice sql injection

Posted

die ('You are part of a job/company at this time, leave to start a new one.');

}

echo '<p class="heading">Create Company</p>';

$_POST['name'] = $_POST['name'];

$_POST['class'] = abs(@intval($_POST['class']));

if($_POST['name'] AND $_POST['class'])

Posted

Pick apart the error and it's very obvious.

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied (So you don't have access...) for user 'damagedc'@'localhost' (using password: NO(You've not set a password in config.php)) in /home/damagedc/public_html/business_create.php on line 17

Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established(No connection) in /home/damagedc/public_html/business_create.php on line 17

Which clearly shows your information to connect to the MySQL server is incorrect. You'll need to find the correct information (as others have said) and input it into your config.php file, considering you need to be connected to the MySQL server before mysql_real_escape_string will work.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...