473,396 Members | 2,052 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

user authentication with SESSION and FORGOT PASSWORD script

17
Can anybody supply me with a script the does what is in the title above please?

I have tried so many different methods!

here is what im currently trying to get to work

SIGN IN

Expand|Select|Wrap|Line Numbers
  1. <!doctype html public "-//w3c//dtd html 3.2//en">
  2.  
  3. <html>
  4.  
  5. <head>
  6.  
  7.  
  8. <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
  9.  
  10. <table border='0' width='50%' cellspacing='0' cellpadding='0' align=center><form name=form1 method=post action=signupck.php onsubmit='return validate(this)'><input type=hidden name=todo value=post>
  11.  
  12. <tr bgcolor='#f1f1f1'><td align=center colspan=2><font face='Verdana' size='2' ><b>Signup</b></td></tr>
  13. <tr ><td >&nbsp;<font face='Verdana' size='2' >Username</td><td ><font face='Verdana' size='2'><input type=text name=username></td></tr>
  14.  
  15. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >Password</td><td ><font face='Verdana' size='2'><input type=text name=password></td></tr>
  16. <tr ><td >&nbsp;<font face='Verdana' size='2' >Re-enter Password</td><td ><font face='Verdana' size='2'><input type=text name=password2></td></tr>
  17.  
  18.  
  19. <tr bgcolor='#f1f1f1'><td ><font face='Verdana' size='2' >&nbsp;First Name</td><td  ><input type=text name=f_name></td></tr>
  20. <tr ><td >&nbsp;<font face='Verdana' size='2' >Sirname</td><td ><font face='Verdana' size='2'><input type=text name=l_name></td></tr>
  21.  
  22. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >Email</td><td ><font face='Verdana' size='2'>  <input type=text name=email</td></tr>
  23.  
  24. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >Address 1</td><td ><font face='Verdana' size='2'>  <input type=text name=address1</td></tr>
  25. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >Address 2</td><td ><font face='Verdana' size='2'>  <input type=text name=address2</td></tr>
  26. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >County</td><td ><font face='Verdana' size='2'>  <input type=text name=county</td></tr>
  27. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >Post Code</td><td ><font face='Verdana' size='2'>  <input type=text name=postcode</td></tr>
  28. <tr bgcolor='#f1f1f1'><td >&nbsp;<font face='Verdana' size='2' >Telephone Number</td><td ><font face='Verdana' size='2'>  <input type=text name=number</td></tr>
  29.  
  30. <tr ><td >&nbsp;<font face='Verdana' size='2' >I agree to terms and conditions</td><td ><font face='Verdana' size='2'><input type=checkbox name=agree value='yes'></td></tr>
  31.  
  32. <tr bgcolor='#f1f1f1'><td align=center colspan=2><input type=submit value=Signup></td></tr>
  33. </table>
  34.  
  35. <center>
  36. <br><br><font face='Verdana' size='2' ><a href='login.html'>Already a member ? Please Login</a></font></center> 
  37.  
  38.  
  39. <center>
  40. <br><br><font face='Verdana' size='2' ><a href='#'>link</a></font></center> 
  41.  
  42. </body>
  43.  
  44. </html>
  45.  
  46.  
AND THIS CHECKS THE ABOVE


Expand|Select|Wrap|Line Numbers
  1. <?
  2. include "connection.inc.php";// database connection details stored here
  3. ?>
  4. <!doctype html public "-//w3c//dtd html 3.2//en">
  5.  
  6. <html>
  7.  
  8. <head>
  9. <title>(Type a title for your page here)</title>
  10. </head>
  11.  
  12. <body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
  13. <?
  14. if(isset($todo) and $todo=="post"){
  15.  
  16. $status = "OK";
  17. $msg="";
  18.  
  19. // if userid is less than 3 char then status is not ok
  20. if(!isset($username) or strlen($username) <3){$msg=$msg.'Username should be =3 or more than 3 char length<BR>';
  21. $status= "NOTOK";}                    
  22.  
  23.  
  24.  
  25. if(mysql_num_rows(mysql_query("SELECT username FROM auth_users WHERE username = '$username'"))){
  26. $msg=$msg.'Userid already exists. Please try another one<BR>';
  27. $status= "NOTOK";}                    
  28.  
  29.  
  30.  
  31. if ( strlen($password) < 3 ){
  32. $msg=$msg.'Password must be more than 3 char legth<BR>';
  33. $status= "NOTOK";}                    
  34.  
  35.  
  36. if ( $password <> $password2 ){
  37. $msg=$msg.'Both passwords are not matching<BR>';
  38. $status= "NOTOK";}                    
  39.  
  40.  
  41.  
  42. if ($agree<>"yes") {
  43. $msg=$msg.'You must agree to terms and conditions<BR>';
  44. $status= "NOTOK";}    
  45.  
  46.  
  47.  
  48. if($status="NOTOK"){ 
  49. echo "<font face='Verdana' size='2' color=red>$msg</font><br><input type='button' value='Retry' onClick='history.go(-1)'>";
  50. }else{ // if all validations are passed.
  51. $query=mysql_query("insert into auth_users(f_name,l_name,email,username,password,address1,address2,county,postcode,number) values('f_name','$l_name','$email','$username','$password','$address1','$address2','$county','$postcode','$number')");
  52. echo "<font face='Verdana' size='2' color=green>Welcome, You have successfully signed up<br><br><a href=login.php>Click here to login</a><br></font>";
  53. }
  54. }
  55. ?>
  56. <center>
  57. <br><br><a href='#'>#</a></center> 
  58.  
  59. </body>
  60.  
  61. </html>
  62.  
Nov 12 '07 #1
2 2796
Atli
5,058 Expert 4TB
Hi.

We are happy to help you out if you run into any problems while writing your code, but we will not write it for you. Check out the Posting Guidelines for more info on this.

If you run into any problems while writing the code, post it here and we will do our best to help you out.

As to the code you posted.
What exactly is the code supposed to do?
Why (how) is it not working?

You can check out this article for an example of how to use Sessions to handle user logins.
Nov 12 '07 #2
whitey
17
Hi,

That is no problem at all, i wouldnt expect it to be done for me.

The first piece of code simply is for registering an account

the second piece of code checks everything is ok with what has been entered before submitting. When i run it, it just writes the code to the screen. No issues with first piece as it is posting fine
Nov 13 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Joshua Beall | last post by:
Hi All, What is the best way to use a cookie to remember a logged in user? Would you store the username and password in two separate cookies? Should the password be plain text? Hashed? Not...
6
by: Lou | last post by:
Please can someone put me out my misery! Im trying to find a multiple user/password protection script that will redirect the specific user to a specific directory. At the moment I have set up...
4
by: Trevor Andrew | last post by:
Hi There, Hopefully this isn't too difficult a question to express here. I have a 3 tier application. 1. Presentation Tier: ASP.NET web application. 2. Middle Tier: ASP.NET Web Services that...
19
by: Siobhan | last post by:
Hi What is the recommended way to store a user's database credentials across the pages of a web application so that each time the database is accessed the system doesn't have to ask them for their...
3
by: Funky | last post by:
Hi, I have developed an ASP.NET application which has been running in production for around 3 months without any major glitches. Recently, a user was attempting to upload a rather large CSV file...
1
by: nasirmajor | last post by:
dear all, a simple quetion from still a bigginer in asp.net i have a simple webpage with username and password which is linked with database. now when user gives his username and password and if...
9
by: webrod | last post by:
Hi all, how can I check a user/password in a LDAP ? I don't want to connect with this user, I would like to connect to LDAP with a ADMIN_LOG/ADMIN_PWD, then do a query to find the user and...
2
by: underground | last post by:
Hi, everyone I've been trying to figure out a way for a user to update there information. I'm using sections to identify the specific user..Here is the form <? include("include/session.php");...
12
by: Hejman | last post by:
ok i had some problems before with imaging, but that is all solved. but now i need help with some user authentication. basically, when you add a user to my database, "busted" under table "user_info",...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.