NameSilo

Problem

Spaceship Spaceship
Watch
Impact
1
What do I need to change? Im stumped


Parse error: parse error, unexpected $ in /home/owner05/public_html/includes/mood_change.php on line 33


Here is the code:

PHP:
<?php
if (isset($_POST['mood']))
{
	$change_mood = $_POST['mood'];
}
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_GET_VARS['sid']) )
		{
			$session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid'];

			if (!preg_match('/^[A-Za-z0-9]*$/', $session_id)) 
			{
				$session_id = '';
			}
			if ( $session_id )
			{
					$user_id = $userdata['$user_id'];
	
					$sql = "INSERT INTO " . USERS_TABLE . "(  u.user_mood )
							VALUES ('" .  $change_mood .  "') WHERE user_id=" . $user_id;
					if ( !($result = $db->sql_query($sql)) )
					{
						message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
					}

					if ( !($row = $db->sql_fetchrow($result)) )
					{
						message_die(GENERAL_MESSAGE, 'UID Not found');
					}

					$user_mood = $row['user_mood'];

		}
?>
 
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
#33 is the last line ?
Maybe there is a missing } at the end of your code (nesting of IF blocks)
 
0
•••
sdsinc said:
#33 is the last line ?
Maybe there is a missing } at the end of your code (nesting of IF blocks)
Yep, appears so...

PHP:
<?php
if (isset($_POST['mood']))
{
    $change_mood = $_POST['mood'];
}
if ( isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) || isset($HTTP_GET_VARS['sid']) )
        {
            $session_id = isset($HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid']) ? $HTTP_COOKIE_VARS[$board_config['cookie_name'] . '_sid'] : $HTTP_GET_VARS['sid'];

            if (!preg_match('/^[A-Za-z0-9]*$/', $session_id))
            {
                $session_id = '';
            }
            if ( $session_id )
            {
                    $user_id = $userdata['$user_id'];

                    $sql = "INSERT INTO " . USERS_TABLE . "(  u.user_mood )
                            VALUES ('" .  $change_mood .  "') WHERE user_id=" . $user_id;
                    if ( !($result = $db->sql_query($sql)) )
                    {
                        message_die(GENERAL_ERROR, 'Could not obtain newer/older topic information', '', __LINE__, __FILE__, $sql);
                    }

                    if ( !($row = $db->sql_fetchrow($result)) )
                    {
                        message_die(GENERAL_MESSAGE, 'UID Not found');
                    }

                    $user_mood = $row['user_mood'];

            }
        }
        
?>
 
0
•••
Found the problem... there was an empty line after the ?>


Now, does any one know how to get the users_id for the logged in user?
 
0
•••
Splinter Freelance said:
Found the problem... there was an empty line after the ?>


Now, does any one know how to get the users_id for the logged in user?
Now, does any one know how to get the users_id for the logged in user? What are you talking about?? How to keep the user logged in??
-CP
 
0
•••
you gotta use cookies for that, and then once you set the cookie, u gotta retrieve it.

i wud help you, but cookies arent one of my php strengths X_X so i dont wanna give misinformation.
 
0
•••
0
•••
I need someone who is familiar with phpBB...
 
0
•••
Issue Resolved... thanx for the help
 
0
•••
Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the pageโ€™s height.
Back