Javascript 丢失变量i脚本

Javascript 丢失变量i脚本,javascript,php,Javascript,Php,我的脚本中的变量有问题,我需要通过一些不同的文件“发送”变量 该变量来自以下链接: index.php?email=emailname@emailname.com 该脚本是一个文件上载脚本。正在使用3个文件,请点击此处: /public_html/upload/index.php /public_html/upload/content/index.php /public_html/upload/content/UploadHandler.php /public\u html/upload/i

我的脚本中的变量有问题,我需要通过一些不同的文件“发送”变量

该变量来自以下链接:

index.php?email=emailname@emailname.com
该脚本是一个文件上载脚本。正在使用3个文件,请点击此处:

/public_html/upload/index.php
/public_html/upload/content/index.php
/public_html/upload/content/UploadHandler.php
/public\u html/upload/index.php是运行脚本并从链接接收变量的:
index.php?电子邮件=emailname@emailname.com

/public\u html/upload/index.php的文件代码如下所示:

<?php

// change the name below for the folder you want
$dir = "content/".$_GET["email"];

$file_to_write = 'test.txt';
$content_to_write = "The content";

if( is_dir($dir) === false )
{
    mkdir($dir);
}

$file = fopen($dir . '/' . $file_to_write,"w");

// a different way to write content into
// fwrite($file,"Hello World.");

fwrite($file, $content_to_write);

// closes the file
fclose($file);

// this will show the created file from the created folder on screen
include $dir . '/' . $file_to_write;

$_SESSION['tmem']= $_GET["email"];
?>
'script_url' => $this->get_full_url().'/'.$this->basename($this->get_server_var('SCRIPT_NAME')),
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/'.$_GET['email'].'/',  
'upload_url' => $this->get_full_url().'/'.$_GET['email'].'/',           
'input_stream' => 'php://input',
'user_dirs' => false,
'mkdir_mode' => 0755,
'param_name' => 'files',
应将变量转发到下一个文件:

/public_html/upload/content/index.php
看起来是这样的:

session_start();
$dir = "content/" . $_GET["email"];
error_reporting(E_ALL | E_STRICT);
require('UploadHandler.php');
$upload_handler = new UploadHandler( array ('upload_url' =>$dir) );
代码应该将变量转发到上传补丁所在脚本的代码中。文件上的代码:
/public\u html/upload/content/UploadHandler.php
看起来像:

<?php

// change the name below for the folder you want
$dir = "content/".$_GET["email"];

$file_to_write = 'test.txt';
$content_to_write = "The content";

if( is_dir($dir) === false )
{
    mkdir($dir);
}

$file = fopen($dir . '/' . $file_to_write,"w");

// a different way to write content into
// fwrite($file,"Hello World.");

fwrite($file, $content_to_write);

// closes the file
fclose($file);

// this will show the created file from the created folder on screen
include $dir . '/' . $file_to_write;

$_SESSION['tmem']= $_GET["email"];
?>
'script_url' => $this->get_full_url().'/'.$this->basename($this->get_server_var('SCRIPT_NAME')),
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/'.$_GET['email'].'/',  
'upload_url' => $this->get_full_url().'/'.$_GET['email'].'/',           
'input_stream' => 'php://input',
'user_dirs' => false,
'mkdir_mode' => 0755,
'param_name' => 'files',

有人能看到我在过程中丢失变量的地方吗?

我想,在这部分代码中:

session_start();
$dir = "content/" . $_GET["email"];

您尝试从URI获取“电子邮件”,而不是从会话(tmem)获取它。

当有人这样做时会发生什么情况
/index.php?电子邮件=../index.php
?您必须添加
会话_start()到第一个php文件(/public_html/upload/index.php)的顶部。您还需要在第二个和第三个文件(/public\u html/upload/content/index.php),(/public\u html/upload/content/UploadHandler.php)中使用
$\u SESSION['tmem']
,而不是
$\u GET[“email”]
,请首先使用评论部分与OP沟通,并在确定最终答案后,然后把答案贴出来。我很乐意这样做。不幸的是,我不能评论原来的帖子,直到我达到50点的声誉。你只是在这件事上没有帮我…我知道,很抱歉投了反对票。但是发布不完整的答案并不是提高你声誉的好方法。。。