Strange connection error

Discussion in 'PHP' started by Dirty-Rockstar, Jul 13, 2007.

  1. #1
    What would cause this




    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/user/public_html/messageboard/sphpforum-0.5-rc1/edit_profile.php on line 11

    Warning: mysql_real_escape_string() [function.mysql-real-escape-string]: A link to the server could not be established in /home/user/public_html/messageboard/sphpforum-0.5-rc1/edit_profile.php on line 11

    Warning: mysql_query() [function.mysql-query]: Access denied for user 'nobody'@'localhost' (using password: NO) in /home/user/public_html/messageboard/sphpforum-0.5-rc1/edit_profile.php on line 13

    Warning: mysql_query() [function.mysql-query]: A link to the server could not be established in /home/user/public_html/messageboard/sphpforum-0.5-rc1/edit_profile.php on line 13

    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/user/public_html/messageboard/sphpforum-0.5-rc1/edit_profile.php on line 13
    This user does not exist.

    Here are the files that are included:
    
    
    <?php
    
    require('config.php');
    
    include('header.php');
    
    
    PHP:
    The connection itself is fine. only happens when a user clicks "edit profile" when logged in

    edit_profile.php:

    
    <?php
    $dboff=!$_GET['id'];
    require('config.php');
    
    if (!$_SESSION['logged_in']) {
    	die('You must be logged on to edit your profile');
    }
    include('header.php');
    
    if(in_array($_SESSION['username'],$admin_users) && $_SESSION['id'] != $_GET['id']){
    	$id=mysql_real_escape_string($_GET['id']);
    	$sql="SELECT * FROM {$db_prefix}user WHERE id='$id'";
    	$row=mysql_fetch_array(mysql_query($sql));
    	if (!$row)
    	  die("This user does not exist.");  
    	$admin='<input type="hidden" name="id" value="'.$_row['username'].'">';
    }else{
    	$row=$_SESSION;
    }
    ?>
    <h2>Edit profile</h2>
    
    <p>Logged on as: <?=$row['username'] ?></p>
    
    <form method="post" action="update_profile.php">
    <?= $admin ?>
    <table>
    <tr><td>Password:</td><td><input name="password" type="password" /><br />Leave blank to keep current password</td></tr>
    <tr><td>E-mail:</td><td><input name="email" type="text" value="<?=$row['email'] ?>" /></td></tr>
    <tr><td>Real Name:</td><td><input name="realname" type="text" value="<?=$row['realname'] ?>" /></td></tr>
    </table>
    <input type="submit" name="submit" value="Update profile" class="button"/> 
    </form>
    
    <? include('footer.php'); ?>
    
    PHP:
     
    Dirty-Rockstar, Jul 13, 2007 IP
  2. Dirty-Rockstar

    Dirty-Rockstar Guest

    Messages:
    252
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Fixed

    I was messing with something in the config file that i shouldnt have. its half fixed anyway. broken for me the admin and works for all other users
     
    Dirty-Rockstar, Jul 13, 2007 IP