简体   繁体   中英

/../ in PHP After ['DOCUMENT_ROOT']

I am working on Contact form , and i found a strange code.

$request_method = $_SERVER["REQUEST_METHOD"];
    if($request_method == "GET"){
      $query_vars = $_GET;
    } elseif ($request_method == "POST"){
      $query_vars = $_POST;
    }
    reset($query_vars);
    $t = date("U");

    $file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;
    $fp = fopen($file,"w");
    while (list ($key, $val) = each ($query_vars)) {
     fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
     fputs($fp,"$val\n");
     fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
     if ($key == "redirect") { $landing_page = $val;}
    }
    fclose($fp);

The line

$file = $_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t;

Confused me where should i go to get a gdform.php file , and to pass a new filed variable.

Looking forward for your inputs.

Thanks

if you directory structure is as follows:

html
..data
..webroot

$_SERVER['DOCUMENT_ROOT'] . "/../data/gdform_" . $t; will take you to the data directory. So, it means one level up

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM