 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
veasna
Joined: 15 May 2007 Posts: 56
|
Posted: Tue Nov 06, 2007 6:35 pm Registration Form Code |
|
|
|
I have my personal website. And I want to create
User Account Form to give permittion view my inside
content. Can you tell me about the codes for
Registration Form? Sample like hi5.com or yahoo.com
Whatever you think it's better and popular for
Registration Form.
PS: My website is for personal use only, non-
commercial. Just want to let friends create their
account to view my content only. |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8749 Location: Castle Pines North, CO USA
|
|
veasna
Joined: 15 May 2007 Posts: 56
|
Posted: Wed Nov 07, 2007 11:38 pm |
|
|
|
| Is there any free for that? |
|
Corey Bryant Site Admin

Joined: 15 May 2004 Posts: 8749 Location: Castle Pines North, CO USA
|
|
babbal
Joined: 04 Feb 2009 Posts: 4
|
Posted: Wed Feb 04, 2009 11:47 pm |
|
|
|
Form page source (registration_f.php)
| Code: |
<?php include('vdaemon.php'); ?>
<html>
<head>
<title>Registration Form Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="samples.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Registration Form Sample</h1>
<form id="Register" action="registration_p.php" method="POST" runat="vdaemon" disablebuttons="all">
<table cellpadding="2" cellspacing="0" border="0">
<tr>
<td width="130">
<vllabel validators="UserID,UserIDExist" errclass="error" for="UserID" cerrclass="controlerror">User ID:</vllabel>
</td>
<td width="140">
<input name="UserID" type="text" class="control" id="UserID" size="15">
<vlvalidator name="UserID" type="required" control="UserID" errmsg="User ID required">
<vlvalidator name="UserIDExist" type="custom" control="UserID" errmsg="User ID already exist" function="UserIDCheck">
</td>
<td width="300" rowspan="7" valign="top">
<vlsummary class="error" headertext="Error(s) found:" displaymode="bulletlist">
</td>
</tr>
<tr>
<td>
<vllabel errclass="error" validators="Password,PassCmp" for="Password" cerrclass="controlerror">Password:</vllabel>
</td>
<td>
<input name="Password" type="password" class="control" id="Password" size="15">
<vlvalidator type="required" name="Password" control="Password" errmsg="Password required">
<vlvalidator name="PassCmp" type="compare" control="Password" comparecontrol="Password2"
operator="e" validtype="string" errmsg="Both Password fields must be equal">
</td>
</tr>
<tr>
<td>
<vllabel validators="Password,PassCmp" errclass="error" for="Password2" cerrclass="controlerror">Confirm Password:</vllabel>
</td>
<td>
<input name="Password2" type="PASSWORD" class="control" id="Password2" size="15">
</td>
</tr>
<tr>
<td>
<vllabel errclass="error" validators="NameReq,NameRegExp" for="Name" cerrclass="controlerror">Name:</vllabel>
</td>
<td>
<input name="Name" type="text" class="control" id="Name" size="15">
<vlvalidator type="required" name="NameReq" control="Name" errmsg="Name required">
<vlvalidator type="regexp" name="NameRegExp" control="Name" regexp="/^[A-Za-z'\s]*$/" errmsg="Invalid Name">
</td>
</tr>
<tr>
<td>
<vllabel errclass="error" validators="EmailReq,Email" for="Email" cerrclass="controlerror">E-mail:</vllabel>
</td>
<td>
<input name="Email" type="TEXT" class="control" id="Email" size="15">
<vlvalidator type="required" name="EmailReq" control="Email" errmsg="E-mail required">
<vlvalidator type="format" format="email" name="Email" control="Email" errmsg="Invalid E-mail">
</td>
</tr>
<tr>
<td colspan=2>
<input name="Agreement" type="checkbox" id="Agreement" value="1">
<vllabel errclass="error" validators="Agreement" for="Agreement">I agree with the terms of service</vllabel>
<vlvalidator type="required" name="Agreement" control="Agreement" errmsg="Agreement checkbox must be selected">
</td>
</tr>
<tr>
<td colspan="2">
<input type="submit" class="control" value="Register">
<input type="reset" class="control" value="Reset">
</td>
</tr>
</table>
</form>
</body>
</html>
<?php VDEnd(); ?>
|
Action page source (registration_p.php)
| Code: |
<?php
$sDatabase = 'db_name';
$sHostname = 'localhost';
$sPort = 3306;
$sUsername = 'user_name';
$sPassword = 'password';
$sTable = 'Customers';
$rConn = mysql_connect("$sHostname:$sPort", $sUsername, $sPassword) or die(mysql_error());
mysql_select_db($sDatabase);
define('VDAEMON_PARSE', false);
include('vdaemon.php');
function UserIDCheck($sValue, &$oStatus)
{
global $sTable;
$sUserID = addslashes($sValue);
$oStatus->bValid = false;
$oStatus->sErrMsg = "User ID '$sValue' already exist";
$sQuery = "SELECT UserID FROM $sTable WHERE UserID = '$sUserID'";
if ($rRecordset = mysql_query($sQuery))
{
$oStatus->bValid = mysql_num_rows($rRecordset) == 0;
mysql_free_result($rRecordset);
}
}
// VDFormat - VDaemon function for adding or removing slashes
$sUserID = VDFormat($_POST['UserID'], true);
$sQuery = "INSERT INTO $sTable SET UserID = '$sUserID'";
mysql_query($sQuery);
?>
<html>
<head>
<title>Registration Form Sample</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="samples.css" rel="stylesheet" type="text/css">
</head>
<body>
<h1>Registration Form Sample</h1>
<p>Your data has been written to the database</p>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td width="100">User ID:</td>
<td width="300"><?php echo $_POST['UserID']; ?></td>
</tr>
<tr>
<td>Password:</td>
<td><?php echo $_POST['Password']; ?></td>
</tr>
<tr>
<td>Name:</td>
<td><?php echo $_POST['Name']; ?></td>
</tr>
<tr>
<td>E-mail:</td>
<td><?php echo $_POST['Email']; ?></td>
</tr>
</table>
</body>
</html>
|
|
|
humajuma
Joined: 30 Apr 2009 Posts: 1
|
Posted: Thu Apr 30, 2009 8:23 am help please |
|
|
|
| babbal how do i change the page it redirects to when you click register |
|
reasse
Joined: 06 Aug 2009 Posts: 1
|
Posted: Thu Aug 06, 2009 2:21 am |
|
|
|
hah to create simple registration form you need this
FOR Register.php
| Code: |
<?php
include ("config.php");
if ("config.php"); {die
print (err("no sql found"));
}
mysql connect ($host,$user,$pass) {die
print (err("sql not found)) else}
select ($db,connection);
?>
<html>
<form name="register" method="post">
<input type="text" name="username" size="30">
<input type="password" name="password" size="30">
<input type="button" class="post" method="insert" name="register" value="Register">
</html>
<?php
if ("register"="name"+"password");
insert into table´users´ values (name,password);
if (username="") {err
print (Please enter Username);
}
if (password="") {err
print (Please enter Password);
}
?> |
FOR DB.sql
| Code: |
structura for table ´user´
create table ´user´
´username´ int(255) default (0) not null,
´password´ int(30) default (0) not null,
´class´ int(6) default (0) not null;
insert into table ´user´ ,´username´ values (admin);
insert into table ´user´,´password´ values (admin);
insert into table ´user´,´class´ values (6); |
FOR CONFIG.php
| Code: |
<?php
$host="sql_host"
$user="sql_user"
$pass="sql_pass"
$db="sql_db"
mysql_connect($db_host,$db_user,$db_pass);
@mysql_select_db(tonrea_game) or die( "SQL NOT FOUND");
?> |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|
|
 |
|
|
|
|
|
|
|