📄 client.php
字号:
<?php
if (isset($_COOKIE["name"])) {
$name = $_COOKIE["name"];
}
?>
<html>
<head>
<script>
function uploadNanoGong() {
var username = document.getElementById("username").getAttribute("value");
var message = document.getElementById("msg").getAttribute("value");
document.getElementById("msg").setAttribute("value", "");
// Find the applet object
var applet = document.getElementById("nanogong");
var duration = applet.sendGongRequest("GetMediaDuration", "audio");
if (duration <= 0) {
alert("No recorded audio!");
return;
}
// Tell the applet to post the voice recording to the
// backend PHP code
var currentDate = new Date();
var filename = currentDate.getTime() + ".wav";
var ret = applet.sendGongRequest("PostToForm", "process_nanogong.php", "voicefile",
"username=" + username + ";file=" + filename + ";message=" + message, "temp");
if (ret == null || ret == "")
alert("Failed to submit the voice recording!");
}
function load() {
var myName = "<?php print $name; ?>";
document.getElementById("username").setAttribute("value", myName);
window.parent.frames["message"].document.getElementById("username").setAttribute("value", myName)
setTimeout("document.getElementById('msg').focus()",100);
}
function logout() {
window.parent.frames["message"].location.reload();
}
</script>
</head>
<body bgcolor="#CCCCFF" onload="load()" >
<table>
<tr><td width="560" >
<form action="add_message.php" method="POST" enctype="multipart/form-data">
Type your message:<br />
<input type="text" name="message" id="msg" style="width: 540px" />
<br />
<input type="hidden" name="MAX_FILE_SIZE" value="2097152" />
<input type="hidden" name="username" value="<?php print $name; ?>
" />
<br />
Please select the file to be uploaded:<br />
<input type="file" name="userfile" style="width: 540px" /><br />
<input type="submit" value="Send" />
</form>
<form action="logout.php" method="POST" onsubmit="logout();">
<input type="submit" value="Logout" />
</form>
</td>
<td width="1" bgcolor="white">
</td>
<td align="right" valign="top" width="200">
<applet id="nanogong" archive="nanogong.jar" code="gong.NanoGong" width="180" height="40" ></applet>
<br /><br />
<input type="button" value="Send voice recording" onclick="uploadNanoGong()" />
</td>
</tr>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -