Skip to content

Commit

Permalink
Initial upload of the registration form code
Browse files Browse the repository at this point in the history
  • Loading branch information
prasanthmj committed Jan 6, 2012
1 parent a21e169 commit 5331da4
Show file tree
Hide file tree
Showing 18 changed files with 4,892 additions and 0 deletions.
62 changes: 62 additions & 0 deletions README
@@ -0,0 +1,62 @@
___Simple Registration/Login code from html-form-guide.com___

See the article here:
http://www.html-form-guide.com/php-form/php-registration-form.html

http://www.html-form-guide.com/php-form/php-login-form.html


Installation____

1. Edit the file membersite_config.php in the includes folder and
update the configuration information (like your email address, Database login etc)

*Note*:
========
The script will create the table in the database when you submit the registration form
the first time.

2. Upload the entire 'source' folder to your web site.

3. You can customize the forms and scripts as required.


Files____

register.php
This script displays the registration form. When the user submits the form,
the script sends a confirmation email to the user. The registration is complete only when
the user clicks the confirmation link that they received in the email

confirmreg.php
Confirms a user's email address. The user clicks the confirmation link that they receive
at their email address and is send to this script. This script verifies the user and
marks the user as confirmed. The user can login only after he has confirmed himself.

login.php
The user can login through this login page. After successful login, the user is sent to the page login-home.php

access-controlled.php
This is a sample accesscontrolled page. If the user is logged in, he can view this page. Else the user is
sent to login.php

includes/membersite_config.php
Update your confirguration information in this file

includes/fg_membersite.php
This file contains the main class that controls all the operations (validations, database updation, emailing etc)
If you want to edit the email message or make changes to the logic, edit this file

includes/class.phpmailer.php
This script uses PHPMailer to send emails. See:http://sourceforge.net/projects/phpmailer/

includes/formvalidator.php
For form validations on the server side, the PHP form validator from HTML form guide is used
See:http://www.html-form-guide.com/php-form/php-form-validation.html


License____
This program is free software published under the terms of the GNU Lesser General Public License.
You can freely use it on commercial or non-commercial websites.


27 changes: 27 additions & 0 deletions source/access-controlled.php
@@ -0,0 +1,27 @@
<?PHP
require_once("./include/membersite_config.php");

if(!$fgmembersite->CheckLogin())
{
$fgmembersite->RedirectToURL("login.php");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>An Access Controlled Page</title>
<link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css">
</head>
<body>
<div id='fg_membersite_content'>
<h2>This is an Access Controlled Page</h2>
This page can be accessed after logging in only. To make more access controlled pages,
copy paste the code between &lt;?php and ?&gt; to the page and name the page to be php.
<p>
Logged in as: <?= $fgmembersite->UserFullName() ?>
<p>
</div>
</body>
</html>
62 changes: 62 additions & 0 deletions source/confirmreg.php
@@ -0,0 +1,62 @@
<?PHP
require_once("./include/membersite_config.php");

if(isset($_GET['code']))
{
if($fgmembersite->ConfirmUser())
{
$fgmembersite->RedirectToURL("thank-you-regd.html");
}
}

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'/>
<title>Confirm registration</title>
<link rel="STYLESHEET" type="text/css" href="style/fg_membersite.css" />
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
</head>
<body>

<h2>Confirm registration</h2>
<p>
Please enter the confirmation code in the box below
</p>

<!-- Form Code Start -->
<div id='fg_membersite'>
<form id='confirm' action='<?php echo $fgmembersite->GetSelfScript(); ?>' method='get' accept-charset='UTF-8'>
<div class='short_explanation'>* required fields</div>
<div><span class='error'><?php echo $fgmembersite->GetErrorMessage(); ?></span></div>
<div class='container'>
<label for='code' >Confirmation Code:* </label><br/>
<input type='text' name='code' id='code' maxlength="50" /><br/>
<span id='register_code_errorloc' class='error'></span>
</div>
<div class='container'>
<input type='submit' name='Submit' value='Submit' />
</div>

</form>
<!-- client-side Form Validations:
Uses the excellent form validation script from JavaScript-coder.com-->

<script type='text/javascript'>
// <![CDATA[

var frmvalidator = new Validator("confirm");
frmvalidator.EnableOnPageErrorDisplay();
frmvalidator.EnableMsgsTogether();
frmvalidator.addValidation("code","req","Please enter the confirmation code");

// ]]>
</script>
</div>
<!--
Form Code End (see html-form-guide.com for more info.)
-->

</body>
</html>

0 comments on commit 5331da4

Please sign in to comment.