473,385 Members | 1,752 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,385 software developers and data experts.

php validation help to match email and password

2
Expand|Select|Wrap|Line Numbers
  1. <?php
  2.  
  3. if (isset($_POST['submit'])){
  4.     $error = array()
  5.  
  6.  
  7. if (empty($_POST['mail'])) {
  8.         $error[] = 'Please Enter your Email and also confirm your mail';
  9.     } else {
  10.  
  11.  
  12.         if (preg_match("/^([a-zA-Z0-9])+([a-zA-Z0-9\._-])*@([a-zA-Z0-9_-])+([a-zA-Z0-9\._-]+)+$/", $_POST['mail'])) {
  13.             $Email = $_POST['mail'];
  14.         } else {
  15.              $error[] = 'Your Email Address is Invalid  ';
  16.         }
  17.  
  18.     }
  19.  
  20. if (empty($_POST['pass'])) {
  21.         $error[] = 'Please Enter your password';
  22.     } else {
  23.  
  24.         if (preg_match("/^[- a-z0-9,<>@()&\%$#!~`]{5,9}$/i", $_POST['pass'])) {
  25.  
  26.             $Password1 = $_POST['pass'];
  27.         } else {
  28.              $error[] = 'Your password must be between 5 and 9 characters';
  29.  
  30.         } else {
  31.  
  32.             if ($Password1!=$conpass trim($_POST['conpass']){
  33.  
  34.         $error[] = 'Your passwords do not match';
  35.  
  36.     }
  37.  
  38.     }
  39.  
  40. ?>
  41.  
  42. <form action= "" >
  43. <table>
  44. <tr>
  45.     <td width="117">Password</td>
  46.     <td width="237"><input type="password" name="pass" size="18">*</td>
  47.     <td width="120">Confirm Password</td>``
  48.     <td width="241">
  49.     <input type="password" name="conpass" size="18"></td>
  50.     <td width="25">&nbsp;</td>
  51.     <td width="38">&nbsp;</td>
  52.   </tr>
  53. </table>
  54. </form>
Dec 16 '15 #1
0 900

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

Similar topics

7
by: Mike | last post by:
I've been trying for the past week to put a simple code together. I have done a LOT of searching, found scripts showing the functions I would like to use, however when I mix them it all goes wrong,...
2
by: AGGoogle | last post by:
I might be doing something stupid here but I really need some help. Can someone please tell me why can't I get this xml to pass my validation when I use XmlValidatingReader? The XMLSpy seems to...
0
by: Andy G | last post by:
I have text box that the user needs to enter an email address that contains 'visionx' somewhere in the address after the @ symbol. I have been having issues coming up with a regular expression to...
1
by: Norman Khine | last post by:
Hello, What is the best way to generate a long authentication string and email this so that the user can reply and verify that the email address they have provided is authentic, similar I guess to...
2
by: mshajar | last post by:
How to validate an email address field about including the @ sign which is not a Hyperlink field.
3
by: satishknight | last post by:
Hi, Can some one tell me how to change the validation sequence for the code pasted below, actually what I want it when any one enters the wrong login information (already registered users) then it...
6
by: =?Utf-8?B?RGF2aWQsIHRoZSBncmVhdA==?= | last post by:
Hi, Is there a way to validate an email address and to check whether it is sendable? Function EmailTo(ToEmail, FromEmail, strSubject, strBody) Set objMessage = CreateObject("CDO.Message")...
7
by: creative1 | last post by:
I am trying form valdiation with javascript but it never call the function. can someone please test this code and see why it is like that. It screwed up my mind. here is my code: <!-- Java Script...
1
by: tutusaint | last post by:
I have a user login authentication scrip which validates users emailid and password. I want it to also check and validate users expiry date in the database. I have user details like name,...
1
by: Lea Valentine | last post by:
I'm having a hard time with the requirements asked of me since I'm really new to programming. What I'm making is a windows application. I've been able to have data validations for only one @ sign and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.