the purpose was to maintain a log of who has connected to the client.
i wanted to take it two steps forward and to integrate it with a db.
for that couple of purposes:
1. have full detailed log stored on db.
2. to have for the supporter the option to get the ID of the client by his ip.
(the ip already known to the supporter)
then using a php form it will be searchable and the supporter can get the id without bothering the client to get the id.
the php script forces ssl connection
the improved repeater with ID + IP log and also + ID + IP sql log is here:
https://www1.ngtech.co.il/uvnc_rpt.tar.bz2
(this is not the perfect log and wasnt ment to log in mysql the supporter ip yet)
the code is here:
(to allow only ssl access and with username and password
.htaccess
Code: Select all
AuthName "Lrpt Server - Server Access"
AuthType Basic
AuthUserFile /etc/uvnc/htpasswd
Require valid-user
IndexIgnore *
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Code: Select all
<html>
<title>Search Test</title>
<head>
</head>
<body>
<form action="showlrpt.php" method="POST" onsubmit="classChange('buttonSubmitHide',submit); return true;">
<input name="send" type="submit" value="Show Last IPs and IDs!">
</form>
</body>
</html>
Code: Select all
<html>
<body>
<?php
if(isset($_POST['send']))
{
$con = mysql_connect("localhost","rpt","password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("rpt", $con);
#$search_string = addslashes($_POST['search']);
$result = mysql_query("SELECT * FROM rptlog where time < TIMESTAMPADD(MINUTE, -5 , NOW())");
#echo $search_string;
echo "<table border='1'>
<tr>
<th>ID</th>
<th>IP</th>
<th>TimeStamp</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['ip'] . "</td>";
echo "<td>" . $row['time'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
}
?>
</body>
</html>
Code: Select all
-- MySQL dump 10.13 Distrib 5.1.61, for pc-linux-gnu (x86_64)
--
-- Host: localhost Database: rpt
-- ------------------------------------------------------
-- Server version 5.1.61-log
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;
--
-- Table structure for table `temp`
--
DROP TABLE IF EXISTS `temp`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `temp` (
`id` varchar(128) NOT NULL,
`ip` varchar(128) NOT NULL,
`time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
/*!40101 SET character_set_client = @saved_cs_client */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;
/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;
-- Dump completed on 2012-06-19 22:11:28