Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 236
  • Last Modified:

Create a user registration page to access a certain page on a website

Hi,

I would like to create a user registration page on my website which allows users to register their details online [Name, Username, password, etc] which in turn would grant them access to a specific page on my site [a company download page].  

The item i do need in the registration is to be able to check that the customer code entered is an actual customer code - via MySQL database.  All the avaialble customer codes will be stored on a MySQL database so that they can be verified.

If anyone knows how i can go about this either with coded examples or with software which i can puchase i would very much appreciate it.

Kind Regards,
Anthony
0
d10u4v
Asked:
d10u4v
  • 3
  • 2
2 Solutions
 
qmicCommented:
You have not to buy any software. Here you have good tutorial for php:
http://www.swish-db.com/tutorials/view.php/tid/601
Feel free to ask if something isn`t clear.
0
 
d10u4vAuthor Commented:
Thank you for the link.  It looks very intresting, i will get to work modifying it a little.  I may need your assistance later?

Instead of checking that a registering customer actually is a current customer [via customer code], would you suggest not allowing customers to register themselves and only allow me to add customer accounts to the database, granting them permission?

Anthony
0
 
qmicCommented:
This tutorial should explain everything clearly, but don`t hesitate to ask.

I don`t know how many customers you have, but you can save your time if you force customers to make accounts by themselves and make only verification of submitted data (if you afraid of guessing Customer`s ID, you should request more than it in form - like a VAT Registration Number
0
 
d10u4vAuthor Commented:
Hi,

I have two Password fields that i want to check to make sure they have entered the correct password twice duign registration.  How do i check the the two Password Fields on the form match?

Anthony
0
 
qmicCommented:
Use this function in php
http://pl.php.net/strcmp

Or try Javascript
IN PHP:
if (strcmp($_POST['pass1'],$_POST['pass2']==0) {
 
do something if equal
 
} else {
show again form
}
 
IN PHP (better version for me)
 
if ($_POST['pass1']==$_POST['pass2'] {
 
do something if equal
 
} else {
show again form
}
 
 
 
 
In Javascript:
EXAMPLE HTML CODE (IN <BODY> SECTION 
form 
   name="FormName" 
   method="POST" 
   action="/cgi-bin/script.cgi">
<input 
   type="text" 
   name="FieldA" 
   size="19" />
<input 
   type="text" 
   name="FieldB" 
   size="19" />
<input 
   type="submit" 
   onclick="return BothFieldsIdenticalCaseSensitive();" 
   value="Click Me" />
</form>
 
EXAMPLE JAVASCRIPT CODE IN <HEAD> SECTION - shows alert button if password mismatch on button submit  click (more elegant for user way)
 
script type="text/javascript" language="JavaScript">
<!--
 
function BothFieldsIdenticalCaseSensitive() {
var one = document.FormName.FieldA.value;
var another = document.FormName.FieldB.value;
if(one == another) { return true; }
alert("Password mismatch");
return false;
}
 
function BothFieldsIdenticalCaseInsensitive() {
var one = document.FormName.FieldA.value.toLowerCase();
var another = document.FormName.FieldB.value.toLowerCase();
if(one == another) { return true; }
alert("Password mismatch.");
return false;
}
 
//-->
</script>

Open in new window

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now