2021年1月2日星期六

session_start(); in php not working in live linux webserver

*/ I have put in beginning of file this is index.php */

<?php session_start();?>  <?php   include "connection.php";    if(isset($_POST['submit']))  {  $username=$_POST['username'];  $password=$_POST['pwd'];      $sql="select *from login where username='$username' && password='$password'";  $data=$conn->query(sql);  $data=mysqli_query($conn,$sql);  $total=mysqli_num_rows($data);      if($total==1)  {            $_SESSION["username"]=$_POST['username'];      echo "<script> window.location.href='welcome.php'; </script>";      exit();     }  

*/ this is another file welcome.php where I want to session variable to display user */

<?php session_start();?>    <?php       echo "Welcome ". $_SESSION["username"]."<br/>";          echo "<a href='logout.php'> Logout </a> <br/> </br>";          echo "<a href='display.php'>View</a> Your application Status";          ?>  
https://stackoverflow.com/questions/65546517/session-start-in-php-not-working-in-live-linux-webserver January 03, 2021 at 12:00PM

没有评论:

发表评论