-3
<!DOCTYPE html>
<?php
session_start();
error_reporting(0);
$submit=$_POST['submit'];
$firstName=strip_tags($_POST['firstName']);
$lastName=strip_tags($_POST['lastName']);
$email=strip_tags($_POST['email']);
$username=strip_tags($_POST['username']);
$password=strip_tags($_POST['password']);
$DateTime=strip_tags($_POST['DateTime']);
if ($submit)
{
\t //open Database
\t $connect = mysql_connect("localhost", "root", "");
\t mysql_select_db("mitch");
//select database
\t
\t $namecheck = mysql_query ("SELECT username FROM tbmitch WHERE username='$username'");
\t $count = mysql_num_rows($namecheck);
\t if ($count!=0)
\t {
\t \t
\t \t echo "<script type='text/javascript'>alert('Control number already exists')</script>"; \t \t
\t }
\t
\t //check for existence
\t else
\t if($username)
\t \t {
\t
\t $queryreg = mysql_query("INSERT INTO tbmitch VALUES ('$username','$lastName','$firstName','$email','$password',now())");
\t \t
\t $_SESSION['username']=$username; \t \t \t
\t \t \t header('location:home.php');
\t \t \t
\t \t \t echo '
\t \t \t <script type="text/javascript">alert("Record/s saved.");
\t \t \t window.location.href = "home.php";
\t \t \t </script>';
\t \t \t
\t \t \t \t \t
\t \t }
\t
\t else
\t \t echo "<script type='text/javascript'>alert('Please fill in all fields')</script>"; \t \t
}
?>
<html>
\t <head>
\t \t <title>MobileApp-SignUp</title>
<body>
\t \t <link rel="stylesheet" type="text/css" href="css/960_12_col.css" />
\t \t <style>
\t \t \t * {
\t \t \t \t font-family: Georgia;
\t \t \t \t color: black;
\t \t \t \t text-align: top;
\t \t \t \t font-size: 16px;}
\t \t \t li {
\t \t \t \t display: inline;
\t \t \t \t padding: 5px;}
\t \t \t ul {
\t \t \t \t position: fixed;
\t \t \t \t top: 0px;
\t \t \t \t left: 0px;
\t \t \t \t padding: 15px;
\t \t \t \t margin: 0px;
\t \t \t \t width: 100%;
\t \t \t \t color: #b5c1ad;
\t \t \t \t text-align: left;
\t \t \t \t text-decoration: none;
\t \t \t \t background: #4EE2EC;}
\t \t \t a {
\t \t \t \t color: black;
\t \t \t \t text-decoration: none;}
\t \t \t a:hover {
\t \t \t \t color: #ffffff;}
\t \t \t header {
\t \t \t \t text-align: right;}
\t \t \t
\t \t \t \t
\t \t </style>
\t \t
\t \t
<meta name=viewport content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="css/form.css" />
<script type="text/javascript">
function formatTextArea(textArea) {
textArea.value = textArea.value.replace(/(^|\r\n|\n)([^*]|$)/g, "$1*$2");
}
window.onload = function() {
var textArea = document.getElementByusername("t");
textArea.onkeyup = function(evt) {
evt = evt || window.event;
if (evt.keyCode == 13) {
formatTextArea(this);
}
};
};
</script>
\t </head>
<center>
<br>
<br>
<br>
<br>
<br>
<br>
\t \t <div class="container_12 clearfix">
\t \t \t <div username="header" class="grusername_12">
\t \t \t \t
\t \t \t \t <img src = "images/img.gif" height="200" width="200" border="3" align="center"></p>
\t \t \t \t <div username="nav" style="width:450">
\t \t \t \t
\t \t \t \t \t <ul>
\t \t \t \t \t \t <li><a href="home.php">Back to Home</a>|</li>
\t \t \t \t \t \t <br>
\t \t \t \t \t \t <br>
\t \t \t \t \t \t <img src="images/header.gif" width="95" class="logo" /><br>
\t \t \t \t \t \t <img src="images/underheader.gif" width="75" class="logo" />
\t \t \t \t \t </ul>
\t \t \t \t \t
\t \t \t \t \t
\t \t \t \t </div>
\t \t \t </div>
\t \t \t <span class="right">
\t \t \t \t \t <?php echo " Welcome ".$_SESSION['UserID']." |"; ?>
</span>
</head>
</body>
<br>
\t \t
\t \t <style type="text/css">
\t \t \t body {
\t \t \t \t background-image: url("bg/bgcloud.jpeg");
\t \t \t \t background-repeat: no-repeat;
\t \t \t \t background-attachment: fixed;
\t \t \t \t color: black;
\t \t \t \t padding: 20px;
\t \t \t \t font-family: Georgia;}
\t \t \t p {
\t \t \t \t padding: 5px;
\t \t \t \t margin: 0px;
\t \t \t \t color: red;}
\t \t \t p.ab {
\t \t \t \t color: black;}
\t \t \t .button {
\t \t \t \t padding: 7px 20px;
\t \t \t \t font-size: 24px;
\t \t \t \t text-align: center;
\t \t \t \t cursor: pointer;
\t \t \t \t outline: none;
\t \t \t \t color: #fff;
\t \t \t \t background-color: #7FE817;
\t \t \t \t border: none;
\t \t \t \t border-radius: 8px;
\t \t \t \t box-shadow: 0 5px #999;}
\t \t \t .button:hover {
\t \t \t \t background-color: #ffffff;}
\t \t \t
</style>
<body>
<p class = "ab">[Signup to check your Cacao plant]</p>
<p class = "ab">Signup here <p>↓ ↓ ↓ ↓ ↓ ↓</p>
<br>
<br>
<form action="done.php" method="post">
\t \t \t <div>
\t \t \t \t <label for="name" class="title">First Name:</label>
\t \t \t \t <input type="text" username="firstName" name="firstNamename" size="30" name='firstName' maxlength="100" required="required"/>
\t \t \t </div>
\t \t \t <br>
\t \t \t <div>
\t \t \t \t <label for="name" class="title">Last Name:</label>
\t \t \t \t <input type="text" username="lastName" name="lastName" size="30" name='lastName' maxlength="100" required="required"/>
\t \t \t </div>
\t \t \t <br>
\t \t \t <div>
\t \t \t \t <label for="email" class="title">E-mail add:</label>
\t \t \t \t <input type="email" username="email" name="email" size="30" name='email' maxlength="100" required="required"/>
\t \t \t </div>
\t \t \t <br>
\t \t \t <div class="radio-buttons">
\t \t \t \t <span class="title" required="required">Gender:</span>
\t \t \t \t <input type="radio" name="gender" username="male" value="M" />
\t \t \t \t <label for="male">M</label>
\t \t \t \t <input type="radio" name="gender" username="female" value="F" />
\t \t \t \t <label for="female">F</label><br />
\t \t \t </div>
\t \t \t <br>
\t \t \t <br>
\t \t \t <div>
\t \t \t <p>*the next entry must be remembered for logging in*</p>
\t \t \t <label for="username">Username:</label>
\t \t \t <input type="text" name="username" required="required" size="20" name='username' maxlength="100"/></title><br />
\t \t \t <br>
\t \t \t <label for="password">Password :</label>
\t \t \t <input type="password" name="password" required="required" size="20" name='password' maxlength="100" />
\t \t \t <br>
\t \t \t <br>
\t \t \t
\t \t \t <a href="done.php"><button class="button"><span>Submit</span></button></a>
\t \t
\t \t </div>
\t \t
\t \t </form>
</body>
<br>
<br>
<br>
<br>
<br>
<p class = "ab" align="right">
© 2017 BSCT-2B MobileApp
</p>
</form>
</center>
</body>
</html>
我到PHP,我覺得很難我的文件傳遞給mysql數據庫(我使用的XAMPP這裏,如果有幫助),我想在我的網站上註冊,然後登錄到註冊數據,如果我指的是其他用戶,我想阻止沒有先註冊數據庫的用戶,那麼怎麼做我這麼做?要改變什麼?
太寬泛。發佈您的源代碼以獲取幫助 – Akintunde007
這就是您擁有登錄頁面的原因。無效憑證會使用戶停留在登錄頁面上。這與您所稱的「阻止未經註冊登錄的用戶」相同。這是我從你的問題 – Venky
理解這可能是在互聯網 – Strawberry