• Home
  • Article License
  • Contact us
  • Forum
  • Privacy Policy

Free PLR Articles

Check out the largest database of Free PLR Articles on internet. Freeplrarticle cover more than 1000 categories and niches. Use our free plr articles for your blogs and websites

Web Design

A Login System With Php And Mysql

Many interactive websites nowadays require a user to log in into the website’s system to provide a customized experience for the user. Once the user has logged in, the website will be able to provide a presentation that is personalized to the user’s preferences.

A basic login system typically contains 3 components which can be created using PHP and MySQL :

Component 1: Allows registration of preferred login Id and password.

This is created in simple HTML form that contains 3 fields and 2 buttons:

1. A preferred login id field

2. A preferred password field

3. A valid email address field

4. A Submit button

5. A Reset button

Lets say the form is coded into a file named register.html. The following HTML code extract is a typical example. When the user has filled in all the fields and clicks on the submit button, the register.php page is called for.

[form name=”register” method=”post” action=”register.php”]

[input name=”login id” type=”text” value=”loginid” size=”20″/][br]

[input name=”password” type=”text” value=”password” size=”20″/][br]

[input name=”email” type=”text” value=”email” size=”50″/][br]

[input type=”submit” name=”submit” value=”submit”/]

[input type=”reset” name=”reset” value=”reset”/]

[/form]

The following code extract can also be used as part of register.php to process the registration. The code connects to the MySQL database and inserts a line of data into the table used to store the registration information.

@mysql_connect(“localhost”, “mysql_login”, “mysql_pwd”) or die(“Cannot connect to DB!”);

@mysql_select_db(“tbl_login”) or die(“Cannot select DB!”);

$sql=”INSERT INTO login_tbl (loginid, password and email) VALUES (“.$loginid.”,”.$password.”,”.$email.”)”;

$r = mysql_query($sql);

if(!$r) {

$err=mysql_error();

print $err;

exit();

}

The code extract assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The values of the $loginid, $password and $email variables are passed in from the form in register.html using the post method.

Component 2: Verification and authentication of the user.

In this the HTML form typically contains 2 fields and 2 buttons:

1. A login id field

2. A password field

3. A Submit button

4. A Reset button

Assume that such a form is coded into a file named authenticate.html. The following HTML code extract is a typical example. When the user has filled in all the fields, the authenticate.php page is called when the user clicks on the Submit button.

[form name=”authenticate” method=”post” action=”authenticate.php”]

[input name=”login id” type=”text” value=”loginid” size=”20″/][br]

[input name=”password” type=”text” value=”password” size=”20″/][br]

[input type=”submit” name=”submit” value=”submit”/]

[input type=”reset” name=”reset” value=”reset”/]

[/form]

The following code extract can be used as part of authenticate.php to process the login request. It connects to the MySQL database and queries the table used to store the registration information.

@mysql_connect(“localhost”, “mysql_login”, “mysql_pwd”) or die(“Cannot connect to DB!”);

@mysql_select_db(“tbl_login”) or die(“Cannot select DB!”);

$sql=”SELECT loginid FROM login_tbl WHERE loginid=’”.$loginid.”‘ and password=’”.$password.”‘”;

$r = mysql_query($sql);

if(!$r) {

$err=mysql_error();

print $err;

exit();

}

if(mysql_affected_rows()==0){

print “no such login in the system. please try again.”;

exit();

}

else{

print “successfully logged into system.”;

//proceed to perform website’s functionality – e.g. present information to the user

}

As in component 1, the code excerpt assumes that the MySQL table that is used to store the registration data is named tbl_login and contains 3 fields – the loginid, password and email fields. The values of the $loginid and $password variables are passed in from the form in authenticate.html using the post method.

Component 3: When the user forgets his logion password this 3rd component sends his password to the users registered email address.

The HTML form typically contains 1 field and 2 buttons:

What’s your Reaction?
Love
Love
0
Smile
Smile
0
Haha
Haha
0
Sad
Sad
0
Star
Star
0
Weary
Weary
0
0 Shares
Facebook Twitter Whatsapp Gmail Linkedin
×

Share this post!

Facebook Twitter Whatsapp Gmail Linkedin Pinterest Messenger Reddit Telegram Tumblr VKontakte Email
Tagged Email, Form, Login, Loginid, Mysql, Password, Submit

Related Posts

Web Design The Pros And Cons Of Flash

November 1, 2022

Tips To Making Your Own Web Site For Free

November 1, 2022

Bring A New Status For Your Web

November 1, 2022

Post navigation

Cheap Mortgage Protection Cover Can Be Found
Profiting With Affiliate Programs

Categories

  • Acne
  • Adsense
  • Advertising
  • Affiliate Marketing
  • After School Activities
  • Air Purifiers
  • Alternative Energy
  • Alternative Medicine
  • American History
  • Anger Management
  • Article Marketing
  • Article Writing
  • Arts Entertainment
  • Aspen Nightlife
  • Astronomy
  • Atkins Diet
  • Attraction
  • Atv
  • Auctions
  • Audio Video Streaming
  • Autism Articles
  • Auto Leasing
  • Auto Navigation Systems
  • Auto Responders
  • Auto Sound Systems
  • Autoresponders
  • Aviation
  • Baby
  • Backyard Activities
  • Bargain Hunting
  • Bathroom Remodeling
  • Bbqs
  • Beach Vacations
  • Beauty
  • Biking
  • Black History
  • Blogging
  • Bluetooth Technology
  • Boating
  • Boats
  • Book Marketing
  • Book Reviews
  • Breast Cancer
  • Breast Feeding
  • Buying A Boat
  • Buying Paintings
  • Candle Making
  • Car Rental
  • Car Stereo
  • Cardio
  • Careers
  • Carpet
  • Cars
  • Cats
  • Cd Duplication
  • Celebrities
  • Cell Phone
  • Choosing The Right Golf Clubs
  • Christmas Shopping
  • Cigars
  • Closet Organizers
  • Clothing
  • Coaching
  • Coffee
  • Coin Collecting
  • College
  • College Scholarship
  • Colon Cancer
  • Colon Cleanse
  • Commentary
  • Communications
  • Computer Certification
  • Computer Games Systems
  • Computers Technology
  • Consumer Electronics
  • Contact Lenses
  • Cooking
  • Copywriting
  • Crafts
  • Craigslist
  • Creating An Online Business
  • Creativity
  • Credit
  • Credit Card Debt
  • Credit Cards
  • Criminology
  • Cruises
  • Currency Trading
  • Current Events
  • Customer Service
  • Dance
  • Data Recovery
  • Dating
  • Dating Women
  • Debt
  • Debt Consolidation
  • Decorating For Christmas
  • Dental
  • Dental Assistant
  • Depression
  • Destinations
  • Diabetes
  • Diamonds
  • Diesel Vs Gasoline Vehicles
  • Dieting
  • Digital Camera
  • Digital Products
  • Disease Illness
  • Disneyland
  • Divorce
  • Dogs
  • Domains
  • Ebay
  • Ebooks
  • Ecommerce
  • Education
  • Elderly Care
  • Electric Cars
  • Elliptical Trainers
  • Email Marketing
  • Entrepreneurs
  • Environmental
  • Ethics
  • Excavation Equipment
  • Exercise
  • Extreme
  • Ezine Marketing
  • Family Budget
  • Fashion
  • Finance
  • Financial
  • Fishing
  • Fitness Equipment
  • Food Beverage
  • Forex
  • Forums
  • Fruit Trees
  • Fundraising
  • Gambling
  • Games
  • Gardening
  • Goal Setting
  • Golden Retriever
  • Golf
  • Google Adsense
  • Gourmet
  • Grief
  • Hair Loss
  • Happiness
  • Health Fitness
  • History
  • Hobbies
  • Holidays
  • Home Family
  • Home Improvement
  • Home Security
  • Homeschooling
  • Hunting
  • Innovation
  • Inspirational
  • Insurance
  • Interior Design
  • Internet Business
  • Internet Marketing
  • Investing
  • K12 Education
  • Landscaping
  • Language
  • Leadership
  • Leasing
  • Legal
  • Leukemia
  • Loans
  • Marriage
  • Martial Arts
  • Medicine
  • Meditation
  • Mens Issues
  • Mesothelioma
  • Misc
  • Mortgage
  • Motivation
  • Motorcycles
  • Movie Reviews
  • Multiple Sclerosis
  • Muscle Building
  • Music Reviews
  • Mutual Funds
  • Nutrition
  • Organizing
  • Outdoors
  • Ovarian Cancer
  • Parenting
  • Personal Finance
  • Pets
  • Philosophy
  • Podcasts
  • Politics
  • Ppc Advertising
  • Pregnancy
  • Product Reviews
  • Prostate Cancer
  • Psychology
  • Public Speaking
  • Real Estate
  • Recipes
  • Recreation Sports
  • Reference Education
  • Relationships
  • Religion
  • Rss
  • Running
  • Rvs
  • Science
  • Security
  • Self Improvement
  • Seo
  • Site Promotion
  • Skin Cancer
  • Society
  • Sociology
  • Spam
  • Spirituality
  • Stock Market
  • Stress Management
  • Success
  • Supplements
  • Taxes
  • Tennis
  • Time Management
  • Traffic Generation
  • Travel Leisure
  • Travel Tips
  • Trucks Suvs
  • Uncategorized
  • Vacations
  • Vehicles
  • Wealth Building
  • Weather
  • Web Design
  • Web Hosting
  • Weddings
  • Weight Loss
  • Wine
  • Womens Issues
  • Writing
  • Yoga

Tags

Body Business Car Card Cards Children Companies Company Credit Day Debt Don'T Find Free Game Good Great Health Home Information Insurance Interest Internet Life Loan Loans Market Marketing Money Mortgage Online Pay People Person Product Products Search Site Sites Time Water Web Website Work World

Recent Posts

  • Advertising – Are You Wasting Your Money?
  • Advertisers Embrace ‘Rich Media’ Format
  • Advertise, no matter if you are big or small
  • Advertise, Advertise, Advertise
  • Action Figures: Antiques for the Common Man

Recent Comments

No comments to show.

Copyright 2022 © Freeplrarticle.net. All Rights Reserved.
Blog Way by ProDesigns