Nieuw lid |
|
Hallo, ik wil aan mijn socket aanroep een variabele doorgeven maar dit werkt nog niet, moeten nog meer knoppen worden vandaar het javascript iemand idee? thanks
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<HTML>
<HEAD>
<TITLE>Untitled</TITLE>
<META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ 2004">
</HEAD>
<script language="javascript">
function lamp(on_off) {
if(on_off == 1) {document.state.value = "LAMPUIT";
} else {
document.state.value = "LAMPUIT";
}
document.state.submit();
}
</script>
<BODY>
<?php
error_reporting(E_ALL);
/* Allow the script to hang around waiting for connections. */
set_time_limit(0);
/* Turn on implicit output flushing so we see what we're getting
* as it comes in. */
ob_implicit_flush();
$address = '156.52.221.45';
$port = 6000;
//connectie met socket ed
if (($sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP )) < 0) {
echo "socket_create() failed: reason: " . socket_strerror($sock) . "\n";
}
if (($ret = socket_connect($sock, $address, $port)) < 0) {
echo "socket_bind() failed: reason: " . socket_strerror($ret) . "\n";
}
if($_SERVER['REQUEST_METHOD'] == 'POST')
{
//connectie met socket ed
$msg = $_POST['state'];
socket_write($sock, $msg, strlen($msg));
}
?>
</head>
<body bgcolor="#FFFFFF">
<center>
<form method="post" name="state">
<input type="button" value="LampOn" onclick="lamp(1)">
<input type="button" value="LampOff" onclick="lamp(0)">
</form>
</BODY>
</HTML>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <HTML> <HEAD> <TITLE>Untitled</TITLE> <META NAME="GENERATOR" CONTENT="MAX's HTML Beauty++ 2004"> </HEAD> <script language="javascript"> function lamp(on_off) { if(on_off == 1) {document.state.value = "LAMPUIT"; } else { document.state.value = "LAMPUIT"; } document.state.submit(); } </script> <BODY> <?php /* Allow the script to hang around waiting for connections. */ /* Turn on implicit output flushing so we see what we're getting * as it comes in. */ $address = '156.52.221.45'; $port = 6000; //connectie met socket ed if (($sock = socket_create(AF_INET , SOCK_DGRAM , SOL_UDP )) < 0) { } } if($_SERVER['REQUEST_METHOD'] == 'POST') { //connectie met socket ed $msg = $_POST['state']; } ?> </head> <body bgcolor="#FFFFFF"> <center> <form method="post" name="state"> <input type="button" value="LampOn" onclick="lamp(1)"> <input type="button" value="LampOff" onclick="lamp(0)"> </form> </BODY> </HTML>
|