Jump to content

[SOLVED] How would i go about adding..


blyz

Recommended Posts

Here is my script at the moment it displays a html form if the user is logged in, and displays nothing if the user is not logged in, what bit would i need to change to display text if the user is not logged in and where would i put it, i'm a complete php noob this is someone elses script, thanks.

 

<?

if(isset($_SESSION['useredit'])){
   unset($_SESSION['useredit']);
   
   echo "<h1>User Account Edit Success!</h1>";
   echo "<p><b>$session->username</b>, your account has been successfully updated. "
       ."<a href=\"login.php\">Main</a>.</p>";
}
else{
?>



<h1>User Account Edit : <? echo $session->username; ?></h1>
<?
if($form->num_errors > 0){
   echo "<td><font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font></td>";
}
?>
<form action="process.php" method="POST">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>Current Password:</td>
<td><input type="password" name="curpass" maxlength="30" value="
<?echo $form->value("curpass"); ?>"></td>
<td><? echo $form->error("curpass"); ?></td>
</tr>
<tr>
<td>New Password:</td>
<td><input type="password" name="newpass" maxlength="30" value="
<? echo $form->value("newpass"); ?>"></td>
<td><? echo $form->error("newpass"); ?></td>
</tr>
<tr>
<td>Email:</td>
<td><input type="text" name="email" maxlength="50" value="
<?
if($form->value("email") == ""){
   echo $session->userinfo['email'];
}else{
   echo $form->value("email");
}
?>">
</td>
<td><? echo $form->error("email"); ?></td>
</tr>
<tr><td colspan="2" align="right">
<input type="hidden" name="subedit" value="1">
<input type="submit" value="Edit Account"></td></tr>
<tr><td colspan="2" align="left"></td></tr>
</table>
</form>

<?

}

?>

Link to comment
https://forums.phpfreaks.com/topic/61137-solved-how-would-i-go-about-adding/
Share on other sites

Lol... its really not hard

 

 

<?

 

if($_SESSION['name']){

 

//COPY AND PASTE HERE EVERYTHING FOM ABOVE THAT YOU WANT TO BE DISPLAYED IF THEY ARE LOGGED IN

 

}

 

else {

 

// COPY AND PASTE HERE EVERYTHING FROM ABOVE YOU WANT DISPLAYED IF THEY ARE NOT LOGGED IN

 

}

 

?>

 

:)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.