0

What am I doing wrong?

I have a error about a undefined variable but it is defined or not?

Undefined variable: url in /mnt/web121/d2/33/58167933/htdocs/includes/functions.php on line 74

$url = "http://www.crime-world.eu";



function logincheck(){
    if (empty($_SESSION['username'])){
        check_legit($url);
        echo "<SCRIPT LANGUAGE='JavaScript'>window.location='index.php';</script>";
        exit();
    }
    check_legit($url);
}
LF00
  • 27,015
  • 29
  • 156
  • 295

2 Answers2

0

$url is a global variable. Declare it as global in your function.

function logincheck(){
    global $url;
    ...
}
0

$url is not in the function checklogin scope, you can pase it to the function with function parameter or use it as a global variable.

LF00
  • 27,015
  • 29
  • 156
  • 295