Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $servername = 'mysql.cba.pl';
- $username = 'virtualtools';
- $password = '1234Aa';
- $dbname = 'virtualtools';
- if ($_REQUEST['action']=="change"){
- $conn = new mysqli($servername, $username, $password, $dbname);
- if($conn->connection_error){
- die("Connection failed: " .$conn->connection_error);
- }
- $sql = "UPDATE led SET led_on = NOT led_on";
- $result = $conn->query($sql);
- $conn->close();
- }
- if ($_REQUEST['action']=="show"){
- $conn = new mysqli($servername, $username, $password, $dbname);
- if($conn->connection_error){
- die("Connection failed: " .$conn->connection_error);
- }
- $sql = "SELECT led_on FROM led";
- $result = $conn->query($sql);
- $row = $result->fetch_array(MYSQL_BOTH);
- echo $row[0];
- $conn->close();
- }
- ?>
- <?php
- $page = $_SERVER['PHP_SELF'];
- $sec = "1";
- ?>
- <html>
- <head>
- <meta http-equiv="refresh" content="<?php echo $sec?>;URL='<?php echo $page?>'">
- </head>
- <body>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement