⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 process_nanogong.php

📁 shooting flash game with script
💻 PHP
字号:
<?php

// Check validity of file upload
if (!is_uploaded_file($_FILES["voicefile"]["tmp_name"])) exit;

// Move the file to the voice directory
mkdir($_COOKIE["username"], 0700);

// Generate a filename using the time value
$i = 0;
do {
    if ($i > 0) sleep(1);
    $filename = $_COOKIE["username"]."/".$_COOKIE["file"];
    $i++;
} while ($i < 3 && file_exists($filename)); // try 3 times for unique
                                            // filename
if (file_exists($filename) ||
    !move_uploaded_file($_FILES['voicefile']['tmp_name'], $filename))
    exit;

require_once("xmlHandler.php");
$fn_xml = "chatroom.xml";
$xmlh = new xmlHandler($fn_xml);
if (!$xmlh->fileExist()) 
	exit;
$xmlh->openFile();
$messages_n = $xmlh->getElement("messages");
$message_n = $xmlh->addElement($messages_n, "message");
$xmlh->setAttribute($message_n, "name", $_COOKIE["username"]);
$xmlh->setAttribute($message_n, "file", $filename);
if ($_COOKIE['message'] == "" )
	$xmlh->addText($message_n, "_EMPTY_");
else
	$xmlh->addText($message_n, $_COOKIE['message']);

$xmlh->saveFile();

// Return to the JavaScript
print $filename;

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -