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
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.

Link to comment
Share on other sites

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";

?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.