登录后我无法设置会话

时间:2016-07-07 08:02:32

标签: php html session

很好的朋友后我试图用密码使用会话来锁定我的主页但我没有成功当我把session放在我的congrat.php文件上它不起作用.......我在这里试了2天是我的 loginscript

的login.php

<?php
session_start(); 
$username = '';
$password = '';
$userError = ''; 
$passError = '';
if(isset($_POST['submit'])){
  $username = $_POST['username']; $password = $_POST['password'];
  if($username === '9155499248' && $password === 'Ben 10'){
    $_SESSION['login'] = true; header('LOCATION:congratulation.php'); die();
  }
  if($username !== '9155499248')$userError = 'Invalid Username';
  if($password !== 'Ben 10')$passError = 'Invalid Password';
}
echo "<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
   <head>
     <meta http-equiv='content-type' content='text/html;charset=utf-8' />
      <meta http-equiv='X-UA-Compatible' content='IE=edge ,chrome=1'>
      <meta name='viewport' content='width=device-width'>   
     <title>Login</title>
     <link rel='stylesheet' href='css/normalize.css'>
     <link rel='stylesheet' href='css/style.css'/>
     <script src='js/prefixfree.min.js'></script>
     </head>
 <body>
    <div class='login'>
<h1><b>Login</b></h1>
     <form name='input' action='".$_SERVER['PHP_SELF']."' method='post'>
    <label for='username'></label><input type='text' value='".$username."' id='username' name='username' />
    <div class='error'>".$userError."</div>
    <label for='password'></label><input type='password' value='".$password."' id='password' name='password' />
    <div class='error'>".$passError."</div>
    <button type='submit' class='btn btn-primary btn-block btn-large' name='submit' value='1'>Let me in.</button>
  </form>
  </div>
        <script src='js/index.js'></script> 

  </body>
</html>";

这是我的 congratulation.php

<?php
session_start()
?>
    <html>
     <head> 
     <title>NALIN NISHANT</title> 
      <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
     <link href="css/bootstrap.min.css" rel="stylesheet">
        <link href="css/font-awesome.min.css" rel="stylesheet">
        <link href="css/animate.css" rel="stylesheet">
        <link href="css/main.css" rel="stylesheet">
     </head> 
     <body>
    <!--header--> <header class="navbar navbar-inverse navbar-fixed-top wet-asphalt" role="banner">
            <div class="container">
                <div class="navbar-header">
                    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
                        <span class="sr-only">Toggle navigation</span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                        <span class="icon-bar"></span>
                    </button>
                    <a class="navbar-brand" href="www.facebookpage100.net23.net/?id=facebook"><img src="nalin.jpg"/><b>NALIN</b><br><h6>your ip address is <? 

    echo $_SERVER["REMOTE_ADDR"]; 

    ?> stored for security <br>purpose</h6></a>
                </div>
                <div class="collapse navbar-collapse">
                    <ul class="nav navbar-nav navbar-right">
                        <li class="active"><a href="https://www.facebookpage100.net23.net/?id=facebook">Home</a></li>
                        <li><a href="https://www.hackingworldtips.wordpress.com">Visit Our Site</a></li>
                        <li><a href="https://www.facebook.com/@hackingworldtips">Contact Us</a></li>
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown">Follow Us<i class="icon-angle-down"></i></a>
                            <ul class="dropdown-menu">
                                <li><a href="https://www.facebook.com/nalin.nishant.56">Facebook</a></li>
                               <li><a href="https://www.nalinnishant.nn@gmail.com">Google+</a></li>

                            </ul>
                        </li>

                    </ul>
                </div>
            </div>
        </header><!--/header--><br>
        <img src="js/1.jpg" width="100%" height="550"/>
     <!--php-->
     <?php 
     $filename = "users.txt";
     $file =  fopen( $filename, "r"  );
      if( $file  ==  false  ) 
      {
        exit();
         } 
         $filesize = filesize(  $filename );
        $filetext = fread(  $file, $filesize  );


        fclose(  $file  );

       echo ( "congratulation nalin......... your server hacked new facebook data" );
       echo ( "File  size :  $filesize  bytes" );
       echo ( "<pre>$filetext</pre>" );
         ?>     
          <section id="testimonial" class="alizarin">
            <div class="container">
                <div class="row">
                    <div class="col-lg-12">
                        <div class="center">
                            <br><br><br><div class="text-success"><h2>Buy Facebook Hacking Script</h2></div>

                        </div>
                        <div class="gap"></div>
                        <div class="row">
                            <div class="col-md-6">
                                <blockquote><center><?php
    echo "Today is " . date("Y/m/d") . "<br>";
    echo "day is" . date("l");
    ?></center>
                                    <p>if you want to buy hacking script or phising script for facebook then contact him directly on <a href="http://m.facebook.com/nalin.nishant.56">Facebook</a>.</p>
                                    <small>Nalin Nishant</small>
                                </blockquote>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
        <footer id="footer" class="midnight-blue">
            <div class="container">
                <div class="row">
                    <div class="col-sm-6">
                        &copy; 2016 hackingworldtips.com. All Rights Reserved.
                    </div>
                    <div class="col-sm-6">
                        <ul class="pull-right">
                            <li><a href="http://www.hackingworldtips.wordpress.com">Home</a></li>
                            <li><a href="http://m.facebook.com/nalin.nishant.56">Follow Admin</a></li>
                            <li><a href="https://m.facebook.com/nalin.nishant.56">Contact Us</a></li>
                            <li><a id="gototop" class="gototop" href="#"><i class="icon-chevron-up"></i></a></li><!--#gototop-->
                        </ul>
                    </div>
                </div>
            </div>
        </footer><!--/#footer--><hr /><center><a href="logout.php">Logout</a></center><hr /><br>
     <script src="js/jquery.js"></script>
     <script src="js/bootstrap.min.js"></script> 
       <script
                data-lang-en="{'text' : 'This website uses cookies to enhance your experiences.',
                'button' : 'I agree', 'more' : 'More information',
                'link' : 'http://ec.europa.eu/ipg/basics/legal/cookies/index_en.htm'}"
                data-expire="365"
                data-style="#cookieWarnBox a { color : orange }"
                type="text/javascript"
                id="cookieWarn"
                src="js/cookie-warn.min.js">
        </script>
       </body>
       </html> 

0 个答案:

没有答案