dongshan0202405 2014-05-14 13:46
浏览 26

错误尝试上一页或返回按钮

My index who included my login page . WHen I enter username and password I go to connection page who include choixsheet. And I have a button in choixcsheet to go to modifiersheet.

When I'm on page modifiersheet and I press previous page or previous button I made in my browser I have this error :

   ! ) SCREAM: Error suppression ignored for
    ( ! ) Notice: Undefined index: usrPassword in C:\wamp\www\testing\connection.php on line 11
    Call Stack
    #   Time    Memory  Function    Location
    1   0.0005  148488  {main}( )   ..\connection.php:0

    ( ! ) SCREAM: Error suppression ignored for
    ( ! ) Notice: Undefined index: usrUserName in C:\wamp\www\testing\connection.php on line 12
    Call Stack

Here is my login page :

<div align = "center"> 
<form method="get" action ='connection.php'  >

<p> Entrer vos informations  </p>

 <label for="usrUserName">Votre code d'usager </label> <input
id="usrUserName" name="usrUserName" /><br />

<label for="usrPassword">Votre mot de passe </label> <input
id="usrPassword" name="usrPassword"type="password" /><br />

here is my connection page

<?php 
    $bdd = new PDO('mysql:host=10.82.182.165;dbname=ohmega', 'zabbix', 'ohmega');
    session_start(); 
    //inclut la librairie pour valider le mot de passe
    include("PasswordHash.php");    
    //prend le user et le pass entrée

    $usrPassword = $_GET['usrPassword'] ;
    $usrUserName = $_GET['usrUserName'] ;

?>
</br>
<?php
 if (isSet($_GET['usrUserName']) AND isSet ($_GET['usrPassword'])) 
    {   
        $req = $bdd->prepare('SELECT usrUserName,usrPassword FROM users WHERE usrUserName = :usrUserName ');
        $req->execute(array('usrUserName'=> $_GET['usrUserName'])) or die(print_r($requete->errorInfo()));
        $resultat = $req->fetch();  
        //Si pas le bon user
        if (!$resultat) 
            {
                $_SESSION['usrUserName'] =  $_GET['usrUserName'];
                echo 'Vous avez entré un mauvais identifiant !';
                ?>  
                </br>
                <?php 
                echo("Essayer de nouveau.");
                ?>
                <form action = 'Index.php' method="get">
                    <input type="submit" value="retour" />
                </form> 
                <?php   
            }
        //Si bon user 
            else 
            {           
            //Si bon mot de passe on affiche 
                $validHash = $resultat['usrPassword'];
                $result = validate_password($usrPassword, $validHash);
                if ($result)
                {
                    ?>

                    <title>Feuille de temps</title>
                    <body>
                        <div id=maincontainer>
                            <?php 
                            $_SESSION['usrUserName'] = $usrUserName;

                            include 'choixsheet.php'
                            ?>
                        </div>
                        <?php

                } else {
                    //Si mauvais mot de passe
                        ?>
                        </br>
                        <?php 
                        echo("Vous avez entré un mauvais mot de passe. ");
                        ?>  
                        </br>
                        <?php 
                        echo("Essayer de nouveau.");
                        ?>
                        <form action = 'Index.php' method="post">

                            <input type="submit" value="retour" />
                        </form> 
                        <?php
                        }   
            }
    }       


    <input type="submit" value="submit"   onsubmit="return create_hash()">
    </div>
    </form>

How I keep my password and username save when I navigate between all my page with no error?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 Vue3 大型图片数据拖动排序
    • ¥15 划分vlan后不通了
    • ¥15 GDI处理通道视频时总是带有白色锯齿
    • ¥20 用雷电模拟器安装百达屋apk一直闪退
    • ¥15 算能科技20240506咨询(拒绝大模型回答)
    • ¥15 自适应 AR 模型 参数估计Matlab程序
    • ¥100 角动量包络面如何用MATLAB绘制
    • ¥15 merge函数占用内存过大
    • ¥15 使用EMD去噪处理RML2016数据集时候的原理
    • ¥15 神经网络预测均方误差很小 但是图像上看着差别太大