Code of save.php如何验证电子邮件,密码和确认密码?
代码都OK,我想提出一些验证,说:“电子邮件已经被注册”和“密码犯规匹配” 这是标志整个代码了
<!DOCTYPE html>
<html>
\t <head>
\t \t <title>Index</title>
\t \t <link rel="stylesheet" type="text/css" href="bootstrap/css/bootstrap.css">
\t \t <script src="bootstrap/jquery-3.1.1.min.js"></script>
\t \t <script src="bootstrap/js/bootstrap.min.js"></script>
\t
\t </head>
\t <body>
\t \t <nav class="navbar navbar-inverse" style="border-radius:0px 0px 0px 0px;">
\t \t \t <div class="container-fluid">
\t \t \t \t <div class="navbar-header">
\t \t \t \t \t <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
\t \t \t \t \t \t <span class="sr-only">Toggle navigation</span>
\t \t \t \t \t \t <span class="icon-bar"></span>
\t \t \t \t \t \t <span class="icon-bar"></span>
\t \t \t \t \t \t <span class="icon-bar"></span>
\t \t \t \t \t </button>
\t \t \t \t \t <a class="navbar-brand" href="#">JMK Sounds & Light</a>
\t \t \t \t </div>
\t \t \t \t <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
\t \t \t \t \t <ul class="nav navbar-nav">
\t \t \t \t \t \t <li><a href="index.php">Home</a></li>
\t \t \t \t \t \t <li class="dropdown">
\t \t \t \t \t \t \t <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Equipments <span class="caret"></span></a>
\t \t \t \t \t \t \t <ul class="dropdown-menu">
\t \t \t \t \t \t \t \t <li><a href="soundsys.php">Sound System</a></li>
\t \t \t \t \t \t \t \t <li><a href="lights.php">Lights</a></li>
\t \t \t \t \t \t \t </ul>
\t \t \t \t \t \t \t <li><a href="about.php">About</a></li>
\t \t \t \t \t \t \t <li><a href="contact.php">Contact Us</a></li>
\t \t \t \t \t \t </li>
\t \t \t \t \t </ul>
\t \t \t \t \t
\t \t \t \t \t <div class="collapse navbar-collapse pull-right" id="bs-example-navbar-collapse-1">
\t \t \t \t \t <ul class="nav navbar-nav">
\t \t \t \t \t \t <li class="dropdown">
\t \t \t \t \t \t \t <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Sign in | Sign up <span class="caret" ></span></a>
\t \t \t \t \t \t \t <ul class="dropdown-menu" style="padding:5px;">
\t \t \t \t \t \t \t <li>
\t \t \t \t \t \t \t \t <div class="form-group">
\t \t \t \t \t \t \t \t \t <input type="text" class="form-control input-sm" placeholder="Username" style="margin-bottom:5px;" required/>
\t \t \t \t \t \t \t \t \t \t <input type="text" class="form-control input-sm" placeholder="Password" style="margin-bottom:5px;" required/>
\t \t \t \t \t \t \t \t \t \t <center><button class="btn btn-primary btn-sm">Sign in</button></center>
\t \t \t \t \t \t \t \t \t </div>
\t \t \t \t \t \t \t </li>
\t \t \t \t \t \t \t <center><button class="btn btn-primary btn-sm" data-toggle="modal" data-target="#signup">Sign Up</button></center>
\t \t \t \t \t \t \t \t \t <li>
\t \t \t \t \t \t \t \t \t \t <form class="navbar-form navbar-right" action="header.php" method="post">
\t \t \t \t \t \t \t \t \t \t </form>
\t \t \t \t \t \t \t \t \t </li>
\t \t \t \t \t \t \t </ul>
\t \t \t \t \t \t </li>
\t \t \t \t \t </ul>
\t \t \t \t \t </li>
\t \t \t \t \t </ul>
\t \t \t \t </div>
\t \t \t </div>
\t \t </nav>
\t \t
\t \t <div class="modal fade" id="signup" tabindex="-1" role="dialog">
\t \t \t <div class="modal-dialog modal-sm" role="document">
\t \t \t \t <div class="modal-content">
\t \t \t \t \t <div class="modal-header">
\t \t \t \t \t \t <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true"> × </span></button>
\t \t \t \t \t \t <h4 class="modal-title">Sign Up</h4>
\t \t \t \t \t </div>
\t \t \t \t \t <div class="modal-body">
\t \t \t \t \t \t <form action="save.php" method="post">
\t \t \t \t \t \t \t <div class="form-group">
\t \t \t \t \t \t \t \t \t \t
\t \t \t \t \t \t \t \t <input type="text" name="fname" class="form-control input-sm" placeholder="First Name" required/><br />
\t \t \t \t \t \t \t \t <input type="text" name="sname" class="form-control input-sm" placeholder="Last Name" required/><br />
\t \t \t \t \t \t \t \t <center>
\t \t \t \t \t \t \t \t \t <input type="radio" name="gender" value="Male" required> Male
\t \t \t \t \t \t \t \t \t <input type="radio" name="gender" value="Female" required> Female<br /><br />
\t \t \t \t \t \t \t \t </center>
\t \t \t \t \t \t \t \t <input type="text" name="address" class="form-control input-sm" placeholder="Address" required/><br />
\t \t \t \t \t \t \t \t <input type="text" name="contact" class="form-control input-sm" placeholder="+639" required/><br />
\t \t \t \t \t \t \t \t <input type="text" name="email" class="form-control input-sm" placeholder="Email" required/><br />
\t \t \t \t \t \t \t \t <input type="text" name="uname" class="form-control input-sm" placeholder="Username" required/><br />
\t \t \t \t \t \t \t \t <input type="password" name="pword" class="form-control input-sm" placeholder="Password" required/><br />
\t \t \t \t \t \t \t \t <input type="password" name="cpword" class="form-control input-sm" placeholder="Confirm Password" required/><br />
\t \t \t \t \t \t \t \t <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">Close</button>
\t \t \t \t \t \t <button type="submit" name="submit" class="btn btn-primary btn-sm">Submit</button>
\t \t \t \t \t
\t \t \t \t \t \t \t </div>
\t \t \t \t \t \t </form>
\t \t \t \t \t </div>
\t \t \t \t </div>
\t \t \t </div>
\t \t </div>
先生......你能以简单的方式解释这种手段的响应消息? xD抱歉导致我只是一个初学者在PHP和SQL :(huhuhuhuhu –
trim,strip_tags,htmlspecialchars是用来实现sql注入,你可以搜索互联网的细节。下一个是模式匹配preg_match(“/^[a-zA-Z ($ email,FILTER_VALIDATE_EMAIL)用于验证电子邮件的电子邮件必须包含@和一个点。下一步它将检查数据库中的天气提供的电子邮件是存在或不存在。下一个哈希('sha256',$ pass)加密sequrity的通行证。谢谢请upvote。 –
谢谢先生:D好生病upvote谢谢你的样品嘿嘿 –