Вопрос:

как исправить следующую ошибку 404. это проблема с кешем?

php

8 просмотра

1 ответ

1 Репутация автора

введите описание изображения здесь Я пытался исправить следующий код, и перенаправление должно работать нормально, но иногда я получаю ошибку 404, как показано ниже на рисунке. Я подумал, что, выполнив ../, вы вернетесь к каталогу, но вместо этого он будет искать две папки с включенными файлами ... Сейчас я даже не могу выйти из системы, потому что путь кажется неправильным. Я просто надеюсь, что это проблема с кешем и что она решится вовремя?

<?php
include_once __DIR__.'/../header2.php';


    include_once __DIR__.'/dbh.php';
    $uid = strip_tags($_POST['user_uid']);
    $temporary_password = strip_tags($_POST['temporary_password']);
    $password = strip_tags($_POST['password']);
    $confirm_password = strip_tags($_POST['confirm_password']);

    $hashedpassword = password_hash($temporary_password, PASSWORD_DEFAULT);

    $password_verify =  password_verify($temporary_password, $hashedpassword);







        $hashednewpassword = password_hash($confirm_password, PASSWORD_DEFAULT);

        if (!preg_match('/^(?=.*\d)(?=.*[A-Za-z])[0-9A-Za-z!@#$%]{8,20}$/', $password)) {
                       echo "<meta http-equiv='refresh' content='0;url=changepassword.php?changepassword2=notalphanumeric'>";
                       exit();
                      } else {

       if ($password !== $confirm_password) {
            echo "<meta http-equiv='refresh' content='0;url=changepassword.php?changepassword2=notmatched'>";
                       exit();
       } else {

        $sql = "SELECT * FROM users where user_uid = ? AND user_token = ?;";

    $stmt = mysqli_stmt_init($conn);

    if (!mysqli_stmt_prepare($stmt, $sql)) {
        echo "SQL error";
    } else {
        mysqli_stmt_bind_param($stmt, "ss", $uid, $temporary_password);
        mysqli_stmt_execute($stmt);
        $result = mysqli_stmt_get_result($stmt);
        $resultCheck = mysqli_num_rows($result);
        $row = mysqli_fetch_assoc($result);

       if ($resultCheck < 1) {
          echo "<meta http-equiv='refresh' content='0;url=changepassword.php?changepassword2=norecords'>";
                       exit(); 
       } else {


                $token = null;
                 $user_activate = 0;

                 $sql = "UPDATE users
                    SET user_password = ?, user_token = ?, user_activate = ?
                    WHERE user_uid = ?
                   ";

             $stmt = mysqli_stmt_init($conn);

             if (!mysqli_stmt_prepare($stmt, $sql)) {
                 echo "SQL error";

             } else {

               mysqli_stmt_bind_param($stmt, "ssis", $hashednewpassword, $token, $user_activate, $uid);
               mysqli_stmt_execute($stmt);

                 // Edit this path if PHPMailer is in a different location.


//$mail->SMTPDebug = 2;
include_once __DIR__.'/../PHPMailer/Exception.php';
include_once __DIR__.'/../PHPMailer/PHPMailer.php';
include_once __DIR__.'/../PHPMailer/SMTP.php';
$mail = new PHPMailer\PHPMailer\PHPMailer();
//$mail->isSMTP();  enable this for localhost and disable for live host??? 
$mail->isHTML(true);

/*
 * Server Configuration
 */

$mail->Host = 'smtp.gmail.com'; // Which SMTP server to use.
$mail->Port = 587; // Which port to use, 587 is the default port for TLS and 465 for SSL security.
$mail->SMTPSecure = 'tls'; // Which security method to use. TLS is most secure.
$mail->SMTPAuth = true; // Whether you need to login. This is almost always required.
$mail->Username = "pianocourseforkids101@gmail.com"; // Your Gmail address.
$mail->Password = "*******"; // Your Gmail login password or App Specific Password.

/*
 * Message Configuration
 */

$mail->setFrom('Admin@pianocourse101.com', 'PianoCourse101 Activate your Primer Level Account'); // Set the sender of the message.
$mail->addAddress($row['user_email'], 'PianoCourse101 Activate your Primer Level Account'); // Set the recipient of the message.
$mail->Subject = 'PianoCourse101 Activate your Primer Level Account'; // The subject of the message.

/*
 * Message Content - Choose simple text or HTML email
 */

// Choose to send either a simple text email...
$mail->Body = "Dear ".$row['user_first']." ".$row['user_last'].", <br /></br />

You have received this e-mail because either you or someone claiming to be you has registered with PianoCourse101.<br /><br /> You must activate your Primer Level account before you can login by clicking on the link below and we encourage you to check through your details under the &#34;Student&#39;s General Information&#34;, which is found under the &#34;Member&#39;s&#34;section to make sure that it is correct. <br /></br />Any incorrect information can be updated under the &#34;Student&#39;s Update Profile&#34 section, which can also be found under the &#34;Member&#39;s&#34;section. <br /></br />Lessons can be found under the &#34;Watch Videos&#39;&#34; section, in the &#34;Member&#39;s&#34; and we also strongly encourage you to utilise the &#34;Practice Diary&#34;, which can also be found under the &#34;Member&#39;s&#34;section to record your practice. <br /></br />More importantly, we would like you to have fun when practising and make sure that you are also doing your homework on a regular basis.<br></br>If you cannot activate your account for any reasons, then you can always activate it manually by going to the &#34;Activate Manually&#34 section, which can be found under the &#34;About PianoCourse101&#34; Section. You can also request a new token for the primer level under the &#34;Token Request: Primer Level&#34; section, which can also be found under the &#34;About PianoCourse101&#34; section and it will send another token that should work.<br /></br />If all else fails, then you could send an e-mail under the &#34;Contact Us&#34; section, which is also found under the &#34;About PianoCourse101&#34; section and we will assist in activating your e-mail for you.<br /></br />In order to filter out spam, please reply to the link below and write a paragraph or two about why you want to join our site.<br /><br />If we do not receive this within 24 hours, your account will be deleted.<br /><br />

To activate your Primer Level account, click here:

<a href='https://www.pianocourse101.com/includes/activate.php?email=".htmlspecialchars($row['user_email'])."&activatetoken=".htmlspecialchars($token)."'>Activate your Primer Level here!</a>

<br /><br />
From,

<br /><br />
PianoCourse101";
// ... or send an email with HTML.
//$mail->msgHTML(file_get_contents('contents.html'));
// Optional when using HTML: Set an alternative plain text message for email clients who prefer that.
//$mail->AltBody = 'This is a plain-text message body'; 

// Optional: attach a file
$mail->addAttachment('images/phpmailer_mini.png');
if ($mail->send()) {
   echo "<meta http-equiv='refresh' content='0;url=../header2.php?resetpassword=success'>";

 // echo "<meta http-equiv='refresh' content='0;url=http://www.pianocourse101.com/includes/student_registration.php?id=$userid'";

 //  echo "<meta http-equiv='refresh' content='2;url=https//www.pianocourse101/student_registration.php?id=$userid')";
                    exit();
} else {
    echo "Mailer Error: " . $mail->ErrorInfo;
}        
             } 


             } 


        }
                      }    


                      }
Автор: piano0011 Источник Размещён: 11.08.2019 08:40

Ответы (1)


0 плюса

11 Репутация автора

Чтобы выйти, вы можете просто убить куки. Я не знаю, что это проблема с кешем, вы можете попробовать удалить кеш с помощью ctrl+shift+suppr(в Google Chrome). Вы также можете попытаться установить абсолютный путь или прямой путь HTML, который может решить вашу проблему.

Вы можете попробовать это:

$aURL = __DIR__."/"; // results in the absolute path (you can also try sith the `realpath()` php native function
$wURL = "http://$_SERVER[HTTP_HOST]/"; // results in http://localhost/ for images of links for examples

Надеюсь, это поможет вам.

Автор: tholeb Размещён: 11.08.2019 08:47
Вопросы из категории :
32x32