search

Home  >  Q&A  >  body text

A question from a php newbie

Why the value entered by $p is the same as the value of $w but the if judgment is still different?

Let’s look at the code——

<?php

$p =$_GET['pw'];

$a=file('data.php');

$w=$a[9];//Get the file number of data.php 10 lines of content

if($p == $w){

echo "Welcome back";

}else{

$url = " 403.html";

echo "<script language='javascript' type='text/javascript'>";

echo "window.location.href='$url' ";

echo "</script>";

}

?>

The following data.php——

<?php

//Prohibit accessing this file through url

$url = "403.html";

echo "<script language='javascript' type='text/javascript'>";

echo "window.location.href='$url'";

echo "</script>";

//Accessing this file will jump to the forbidden page

die("This page is forbidden");//Just in case

?>

6117

手机用户1608450838手机用户16084508381478 days ago958

reply all(1)I'll reply

  • 天蓬老师

    天蓬老师2020-12-21 14:05:39

    The editor has a code block function, but plain text without highlighting looks inconvenient

    reply
    0
  • Cancelreply