PHP code examples with database connectivity

ASP.TheDemoSite.co.uk

PHP code examples with database connectivity
 PHP.TheDemoSite.co.uk

Just examples of PHP code, linking to your MySQL database and JavaScript.
1. Home | 2. The Database | 3. Add a User | 4. Login | 5. Get your db online

PHP code examples with database connectivity

PHP Form Mailer - phpFormMailer (easy to use and more secure than many cgi form mailers)

Need web hosting try: PHP hosting or need to host several domain names? Try Reseller hosting

PHP MySQL auto members area: phpAutoMembersArea (phpAMA)

PHP Job scheduler: phpJobScheduler

download-the-login-demo-pages FREE Download
complete LOGIN
demo pages
of this website
Size: 27 Kbytes

This page shows the PHP and JavaScript code used in the "Login" section.

login.php

<?php include("header.inc"); ?>
<?php include("validateform.inc"); ?>
<p align="center"><big><strong>4. Login</strong></p></big>
<p align="center"><strong>The status was:</strong><big></p>
<blockquote>
<blockquote>
<?php include("getresult.inc"); ?>
</blockquote>
</blockquote>

<blockquote>
</big><blockquote>
<big><p align="center"></big>Enter your login details you added on the previous page and
test the login.<br>
The success or failure will be shown above.</p>
</blockquote>
</blockquote>

<form ACTION="login.php" name="saveform" METHOD="POST" align="center">
<div align="center"><center><table border="0" width="704" cellspacing="0" cellpadding="0">
<tr>
<td width="385"><div align="right"><table border="0" height="59" width="226"
bgcolor="#FFFFFF" cellspacing="1" cellpadding="0">
<tr>
<td width="154" height="19" bgcolor="#000080"><div align="right"><p><font color="#FFFFFF"><small>Username:</small></font></td>
<td width="133" height="19" bgcolor="#000080"><div align="left"><p><input NAME="username"
VALUE SIZE="8" MAXLENGTH="16" tabindex="1"></td>
<td width="64" height="19" bgcolor="#C0C0C0" align="center"><div align="center"><center><p><a
href="javascript:alert('The username must be between 4 and 16 characters long.')"><small><small>Help</small></small></a></td>
</tr>
<tr align="center">
<td width="154" height="17" bgcolor="#000080"><div align="right"><p><font color="#FFFFFF"><small>Password:</small></font></td>
<td height="17" width="133" bgcolor="#000080"><div align="left"><p><input type="password"
name="password" size="8" tabindex="2" maxlength="8"></td>
<td height="17" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('The password must be between 4 and 8 characters long.')"><small><small>Help</small></small></a></td>
</tr>
<tr align="center">
<td width="154" height="1" bgcolor="#000080"></td>
<td width="133" height="1" bgcolor="#000080"><div align="left"><p><input TYPE="button"
NAME="FormsButton2" VALUE="Test Login" ONCLICK="validateForm()" tabindex="3"
style="font-family: Verdana; font-size: 8pt"></td>
<td width="64" height="1" bgcolor="#C0C0C0" align="center"><a
href="javascript:alert('Click to save the details')"><small><small>Help</small></small></a></td>
</tr>
</table>
</div></td>
<td align="center" width="319"><small><strong><a href="getyourowndbonline.php">Now move on
to the final section</a></strong></small></td>
</tr>
</table>
</center></div>
</form>

<p align="center">&nbsp;</p>

<p align="center"><a href="logincode.php">Click here to view the PHP and JavaScript code</a>
used for this page.</p>

<p align="center">&nbsp;</p>
<?php include("footer.inc"); ?>

 

getresult.inc

<?php
// version 1.1
if (isset($password)) // if a the password is set then the form has been submitted on login.php page
{
include("config.php");

$username = $_POST['username'];
$password = $_POST['password'];

$qstr = "SELECT * from members where username ='$username' and password ='$password'";

$result = mysql_query($qstr);
// check login info is correct
if (mysql_num_rows($result)) echo "<font color=#008000><Center><b>**Successful Login**</b></Center></font>";
else echo "<font color=#ff0000><Center><b>**Failed Login**</b></Center></font>";
mysql_close();
}
else echo "<font color=#ff8000><Center><b>**No login attempted**</b></Center></font>";
?>

< Go Back<

UK managed dedicated servers
No hassle managed dedicated servers
No bandwidth limits
www.S4Servers.com















download-the-login-demo-pages FREE Download
complete LOGIN
demo pages
of this website
Size: 27 Kbytes
download-phpFormMailer FREE Download phpFormMailer
including setup details
Size: 4 Kbytes



TheDemoSite.co.uk is a MySQL database and PHP FREE code example site hosted with:
Seiretto website hosting Copyright © 1996-2008 Seiretto Contact us.  All rights reserved.