Need help in the code....

Discussion in 'PHP' started by Bernice susana, Oct 3, 2009.

  1. #1
    Hi friends,

    Check with the below coding and pls let me know for which purpose is the following code is used....

    <?php
    $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);
    if ($landing_page != ""){
    header("Location: http://".$_SERVER["HTTP_HOST"]."/$landing_page");
    } else {
    header("Location: http://".$_SERVER["HTTP_HOST"]."/");
    }
    
    
    ?>
    PHP:
    Pls help...Waiting.

    Thanks.
     
    Bernice susana, Oct 3, 2009 IP
  2. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #2
    As I can see this code dumps all request parameters into files in $SERVER['DOCUMENT_ROOT'] . "/../data/gdform" folder.
    It makes some kind of template maybe structure.
    
    fputs($fp,"<GDFORM_VARIABLE NAME=$key START>\n");
    fputs($fp,"$val\n");
    fputs($fp,"<GDFORM_VARIABLE NAME=$key END>\n");
    
    PHP:
     
    AsHinE, Oct 3, 2009 IP
  3. racklane

    racklane Peon

    Messages:
    98
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    its just openeing a file and writing values, most likely a txt
     
    racklane, Oct 3, 2009 IP
  4. lmao

    lmao Guest

    Messages:
    93
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    i think it is storing all GET and POST variables in to a text file in a special format may be that file is going to be use by any other script or program or may be to log the form variables
     
    lmao, Oct 3, 2009 IP