hi
i want to ceate a login form using php and mysql.The new user should first sign up and then login.
thank you.
login form. need help
Moderator: General Moderators
- social_experiment
- DevNet Master
- Posts: 2793
- Joined: Sun Feb 15, 2009 11:08 am
- Location: .za
Re: login form. need help
Do you have any code that you have created?mavrick_12 wrote:hi
i want to ceate a login form using php and mysql.The new user should first sign up and then login.
thank you.
“Don’t worry if it doesn’t work right. If everything did, you’d be out of a job.” - Mosher’s Law of Software Engineering
-
mavrick_12
- Forum Newbie
- Posts: 2
- Joined: Fri Apr 16, 2010 7:45 am
Re: login form. need help
yes
<?php
if (isset($_POST['btn_login']) && $_POST['btn_login']) {
$username = $_POST['txt_username'];
$password = $_POST['txt_password'];
login($username, $password);
}
?>
<form method="POST" action="login.php">
<table align="center" width="30%" class="decorated">
<thead>
<tr>
<th colspan="2">Login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Username : </td><td class="odd"><input type="text" name="txt_username"></td>
</tr>
<tr>
<td>Password : </td><td class="odd"><input type="password" name="txt_password"></td>
</tr>
<tr>
<td></td><td><input type="submit" name="btn_login" value="Login"></td>
</tr>
</tbody>
</table>
</form>
</fieldset>
</P>
<?php
if (isset($_POST['btn_login']) && $_POST['btn_login']) {
$username = $_POST['txt_username'];
$password = $_POST['txt_password'];
login($username, $password);
}
?>
<form method="POST" action="login.php">
<table align="center" width="30%" class="decorated">
<thead>
<tr>
<th colspan="2">Login</th>
</tr>
</thead>
<tbody>
<tr>
<td>Username : </td><td class="odd"><input type="text" name="txt_username"></td>
</tr>
<tr>
<td>Password : </td><td class="odd"><input type="password" name="txt_password"></td>
</tr>
<tr>
<td></td><td><input type="submit" name="btn_login" value="Login"></td>
</tr>
</tbody>
</table>
</form>
</fieldset>
</P>
Re: login form. need help
Hi Mavrick
OK so you have the basics in place, but you have login($username, $password) which won't do anything unless you've got a function defined and haven't posted it. You will need to create a function to verify the user like so
Regards
Jay
OK so you have the basics in place, but you have login($username, $password) which won't do anything unless you've got a function defined and haven't posted it. You will need to create a function to verify the user like so
Code: Select all
function login($username, $password) {
//Code here to validate against database/file containing username/password pairs
//Return the result here
}Jay