-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added the validation code from plasticfantastic.com
- Loading branch information
Showing
4 changed files
with
80 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?php | ||
$con=mysql_connect("localhost","USERNAME","PASSWORD") or die ('I cannot connect to the database because: ' . mysql_error()); | ||
mysql_select_db("plast19_nodejs"); | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
include "db.php"; | ||
|
||
$externalIP=$_SERVER['REMOTE_ADDR']; | ||
$internalIP=$_GET['ip']; | ||
$port=$_GET['port']; | ||
|
||
$sql=mysql_query(" | ||
DELETE FROM servers | ||
WHERE externalIP='$externalIP' | ||
"); | ||
|
||
$sql=mysql_query(" | ||
INSERT INTO servers | ||
(externalIP,internalIP,port) | ||
VALUES | ||
('$externalIP','$internalIP','$port') | ||
"); | ||
|
||
if(!$sql){echo "0"; exit();} | ||
|
||
echo "1"; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
include "db.php"; | ||
|
||
$externalIP=$_SERVER['REMOTE_ADDR']; | ||
|
||
$sql=mysql_query("SELECT internalIP,port FROM servers WHERE externalIP='$externalIP'"); | ||
|
||
if(mysql_num_rows($sql)==0){echo "0"; exit();} | ||
|
||
$row=mysql_fetch_array($sql); | ||
|
||
echo $row[internalIP] . "," . $row[port]; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
-- phpMyAdmin SQL Dump | ||
-- version 3.4.4 | ||
-- http://www.phpmyadmin.net | ||
-- | ||
-- Host: localhost | ||
-- Generation Time: Sep 21, 2011 at 09:12 AM | ||
-- Server version: 5.1.54 | ||
-- PHP Version: 5.2.6 | ||
|
||
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; | ||
SET time_zone = "+00:00"; | ||
|
||
|
||
/*!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 */; | ||
|
||
-- | ||
-- Database: `plast19_nodejs` | ||
-- | ||
|
||
-- -------------------------------------------------------- | ||
|
||
-- | ||
-- Table structure for table `servers` | ||
-- | ||
|
||
CREATE TABLE IF NOT EXISTS `servers` ( | ||
`externalIP` varchar(15) NOT NULL, | ||
`internalIP` varchar(15) NOT NULL, | ||
`port` int(5) NOT NULL | ||
) ENGINE=MyISAM DEFAULT CHARSET=latin1; | ||
|
||
/*!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 */; |