PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am trying to piece together my first script and I am getting an error. I think that I may have my function braces out of whack. anybody have any suggestions?
<?php
session_start();
$loggedIn = $_SESSION['loggedIn'];
$username = $_SESSION['username'];
if ( $loggedIn != true )
{
die('Verification failed! You must be logged in to view this page.');
}
?>
<p>Welcome to the page <?php echo $username ?>!</p>
<p><a href="logout.php">Logout</a></p>
<?php
if(file_exists("./proofs/".$username.".gif")){ ?>
<TABLE>
<TR>
<TD colspan="2" CLASS="articlehead">Please review proof and click approve/disapprove once you have made your decision. More help <a href="../help" >here</a></TD>
</TR>
<TR>
<TD><img src="<?php echo $image; ?>"></TD>
<TD><form action="./proofs/handler.php">
<input type="radio" name="approve" value="1">Approve<br>
<input type="radio" name="approve" value="0">Disapprove<br>
<textarea name="comments" cols="12">Please enter any comments here...</textarea><br>
<input type="hidden" name="username" value="<?php echo $username; ?>">
<input type="submit" value="Send notice">
</form></TD>
</TR>
</TABLE>
<?php
}
else { ?>
<TABLE>
<TR><TD>There aren't any proofs available to view at this time. Please contact us if you think this is a mistake.</TD></TR>
</TABLE>
which is when something to the effect of
Parse error: parse error, unexpected $ in /home/jssilk/public_html/login/user.php on line 49
prints.
thanks for any help.
Last edited by szac on Thu Dec 30, 2004 4:30 pm, edited 2 times in total.
It looks like you have a variable being declared or modified in a syntactically incorrect manner. It's not guaranteed to be on the 49th line, but I'd look around there. Good luck.
well I got it working by removing the function. when I add it back to the script it prints nothing within the function, not even the last else statement.
here's what I got: I basically just want it to check into a directory for a username gif or jpeg call it $image and print away...
The way you have it with one equals sign, $exists will be set to true instead of its value being checked to be true and code inside the else block will never be executed.