Jump to content

[SOLVED] help with login.php


jsucupira

Recommended Posts

I got the code: but I am not sure how the login.php and logout.php files should be. can anyone gimme a example? i'll highly appreciate

 

<?php

if(isset($session[userid])){  // Member is logged in so we have to display welcome message with userid and one logout link

echo "<tr><td align=center'><strong><font color='#FFFFFF'>Welcome $session[username]</font></strong></td></tr>

<tr> <td><font color='#FFFFFF'><strong><a href='logout.php'>LOGOUT</a></strong></font></td></tr>

";

 

}else {  // Member has not logged in so we can display the login form allowing member to login with user id and password

 

echo "<form name='login' method='post' action='loginck.php' style='margin:0px'>

<tr><td width='37%'><strong><font color='#FFFFFF'>Username</font></strong></td>

<td width='58%'><input name='id' type='text' class='field' id='username22' size='14'></td>

</tr>

 

<tr><td><strong><font color='#FFFFFF'>Password</font></strong></td>

<td><input name='pw' type='password' class='field' id='password227' size='14'></td>

</tr>

 

<tr><td> <a href='forgot.php'>Forgot password</a></td>

</tr></form>";

 

}    // End of else condtiion

 

echo "</table>";

?>

Link to comment
https://forums.phpfreaks.com/topic/67182-solved-help-with-loginphp/
Share on other sites

I wanted to know how to code the page login.php, I wanted to find an example of a login.php page.  also what do you mean not by "post code between [ code ] [ /code ] tags (without the spaces)."

 

Notice that when you posted your PHP it looked like this

 

<?php

// I am php

echo "blah";

?>

 

if you put them in

[code][/code] tags it'll look like this

<?php
// I am php
echo "blah";
?>

 

And it is a lot easier to read.  You can auto-insert these code tags by clicking the hash button in the menu located above where you type your post.

 

<?php
if(isset($session[userid])){  // Member is logged in so we have to display welcome message with userid and one logout link
echo "<tr><td align=center'><strong><font color='#FFFFFF'>Welcome $session[username]</font></strong></td></tr>
<tr> <td><font color='#FFFFFF'><strong><a href='logout.php'>LOGOUT[/url]</strong></font></td></tr>
";

}else {  // Member has not logged in so we can display the login form allowing member to login with user id and password

echo "<form name='login' method='post' action='loginck.php' style='margin:0px'>
<tr><td width='37%'><strong><font color='#FFFFFF'>Username</font></strong></td>
<td width='58%'><input name='id' type='text' class='field' id='username22' size='14'></td>
</tr>

<tr><td><strong><font color='#FFFFFF'>Password</font></strong></td>
<td><input name='pw' type='password' class='field' id='password227' size='14'></td>
</tr>

<tr><td> <a href='forgot.php'>Forgot password[/url]</td>
</tr></form>";

}    // End of else condtiion

echo "</table>";
?>

 

Your code will look like that.  After reading your code, realise that you can't end an <a> tag with [/url].  That's BBCode.

I'm sorry, but there are many tutorials already written that cover the subject of php logins (many free on the net). This board is for help with specific problems with existing code.

 

As for the [ code ] tags. f you place your code within them you will get it properly formated like so...

 

<?php

 echo "this is foo";

?>

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.