これらのページを作成しようとしています。最初のページは、ユーザーの情報を取得し、それをphpadminに保存してから、エントリと終了ページの選択日にuを使います。ただし、ユーザーが入力および終了のタイミングを入力し、次に属性の表を入力する場合は、no、入力日付、終了日およびユーザー名が保存されます。しかし、問題は、ユーザー名が同じではないということです。昨日、これらのページを作成したときと同じように、すべてうまくいっていましたが、今問題があり、顧客名を削除して新しい名前を再入力しましたが、PHPを使用しようとすると古いユーザー名が表示されます。ここでは一例であり、この画像では は、ちょうど私が入力データに登録フォーム上で選択した後、既に削除人のユーザ名とパスワードが表示されて起動します:php/username:ページにまだ削除されたデータが表示されています
このイメージで、私が入力した後、それ以前のユーザー名とは違って、私の古い削除されたデータベースのユーザー名が引き続きphpadminに入れられます。例えば、私は、画面の一番上に見られるように、ユーザ名を入れxand1入れ、ユーザ名は私の古いデータベースからの値のandy91を取った:ここ
は、登録のために私のコードです:
<?php
$firstnameError = $lastnameError = $usernameError = $passwordError = $birthdateError = $mobileError = $emailError = "";
// Check if data are posted.
if (isset($_POST['submit'])){
$firstname = $lastname = $username = $password = $birthdate = $mobile = $email = "";
$errorOccured = false;
if (isset($_POST['tsmFirstName'])){
$firstname = trim($_POST['tsmFirstName']);
if (strlen($firstname) == 0){
$firstnameError = "First Name is missing";
$errorOccured = true;
}
}
else{
$firstnameError = "First Name is missing";
}
//Checking last name
if (isset($_POST['tsmLastName'])){
$lastname = trim($_POST['tsmLastName']);
if (strlen($lastname) == 0){
$lastnameError = "First Name is missing";
$errorOccured = true;
}
}
else{
$lastnameError = "First Name is missing";
}
//checking the username
if (isset($_POST['tsmUserName'])){
$username = trim($_POST['tsmUserName']);
$usernameLenght = strlen($username);
if ($usernameLenght == 0){
$usernameError = "First Name is missing";
$errorOccured = true;
}
elseif ($usernameLenght < 4){
$usernameError = "Your username should be minimum 4 characters";
$errorOccured = true;
}
}
else{
$usernameError = "First Name is missing";
}
//checking the password
if (isset($_POST['tsmPassword'])){
$password = trim($_POST['tsmPassword']);
if (strlen($password) == 0){
$passwordError = "First Name is missing";
$errorOccured = true;
}
}
else{
$passwordError = "First Name is missing";
}
//checking the birthdate
if (isset($_POST['tsmBirthDate'])){
$birthdate = trim($_POST['tsmBirthDate']);
if (strlen($birthdate) == 0){
$birthdateError = "First Name is missing";
$errorOccured = true;
}
}
else{
$birthdateError = "First Name is missing";
}
// checking the mobile
if (isset($_POST['tsmMobile'])){
$mobile = trim($_POST['tsmMobile']);
if (strlen($mobile) == 0){
$mobileError = "First Name is missing";
$errorOccured = true;
}
}
else{
$mobileError = "Mobile is missing";
}
//checking the email
if (isset($_POST['tsmEmail'])){
$email = trim($_POST['tsmEmail']);
if (strlen($email) == 0){
$emailError = "Email is missing";
$errorOccured = true;
}
}
else{
$emailError = "Email is missing";
}
if(!$errorOccured){
require_once("connection.php");
$_SESSION['tsmUserName']=$username;
var_dump($_SESSION);
$keychain= sha1($username);
$my_query="INSERT INTO users (id, firstname, lastname, username, password, birthdate, mobile, email, status, keychain) VALUES (NULL,'$firstname','$lastname','$username','$password','2016-1-1','$mobile','$email','0','$keychain')";
$result=mysqli_query($connection,$my_query);
if($result){
$message_mail = "Dear $firstname, <br> Thank You for registering with us. Click now on the link below to activate your account. <br> $keychain <br><br> Thank You.";
$subject_mail= "Your account has been created";
$to_mail = $email;
$headers[]= 'MIME-Version 1.0';
$headers[]= 'content-type:text/html; charset=utf8';
$headers[]= 'From: [email protected]';
mail($to_mail,$subject_mail,$message_mail,implode("\r\n",$headers));
//after email is sent redirect to thank you page.
header("Location:completed.php?task=done");
exit();
echo 'Thank You';
}
else{
echo "<b> Error unable to post. </b>";
mysqli_error($connection);
}
mysqli_close($connection);
}
}
?>
ここ
と はタイミング
<?php
session_start();
$EntryError=$ExitError="";
if (isset($_POST['submit'])){
$entrydate = $exitdate = "";
$errorOccured = false;
if (isset($_POST['tsmdate'])){
$entrydate = trim($_POST['tsmdate']);
if (strlen($entrydate) == 0){
$EntryError = "date is missing";
$errorOccured = true;
}
}
else{
$EntryError = "date is missing";
}
// checking for last name
if (isset($_POST['tsmexit'])){
$exitdate = trim($_POST['tsmexit']);
if (strlen($exitdate) == 0){
$ExitError = "First Name is missing";
$errorOccured = true;
}
}
else{
$ExitError = "last Name is missing";
}
$ids=$_SESSION['tsmUserName'];
var_dump($_SESSION);
if(!$errorOccured){
require_once("connection.php");
$my_query="INSERT INTO timing (`No`, `Entry Date and Time`, `Exit Date and Time`, `Username`) VALUES (NULL,'$EntryError','$exitdate','$ids')";
$result=mysqli_query($connection,$my_query);
if($result)
{
echo 'thank you';
}
else
{
echo 'error';
}
mysqli_close($connection);
}
}
?>
あなたはこのすべてのコードを持っていますか? –
あなたが美しい写真を投稿するつもりなら、私たちはあなたを助けません。これとオハイオ州と幸運...答えを受け入れることを開始するいくつかはあなたに解決策を与えた。 –
@ Fred-ii-申し訳ありませんが私のコードを入れて忘れています..そして、あなたは答えを受け入れることによって何を意味するのですか? –