Location: PHPKode > projects > Wifimap > wifimap/db_addclient.php
<?
/*****************************
 * 
 * wifimap v 0.3.1
 *
 * copyright 2003 John O'Sullivan <hide@address.com>
 * Based on some code and ideas from phpwirelessmap
 *
 * This file is part of wifimap.
 * wifimap is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 * 
 * wifimap is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with wifimap; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 * Licensed under the GNU General Public License
 * See the file COPYING for details
 *
 *****************************/

require("./config.inc.php");

$db_link = mysql_connect($sql_server,$sql_user,$sql_passwd) or die('Not connected : ' . mysql_error());
mysql_select_db($sql_dbname,$db_link) or die('Can\'t use $sql_dbname : ' . mysql_error());

$query="SELECT * FROM nodes WHERE id='$nodeid'";
$result=mysql_query($query,$db_link);
$row=mysql_fetch_object($result);

$nodepassword=$row->password;
if($nodepassword==$enteredpassword)
  {
    $query="INSERT INTO clients (nodeid, stationname, accesspointid, email, status, hardware, ip, mac, antenna) VALUES('$nodeid', '$stationname', '$accesspointid', '$email', '$status', '$hardware', '$ip', '$mac', '$antenna')";
    mysql_query($query,$db_link) or die('Could not add to database : ' . mysql_error()); 

print("
<html>
<head>
<meta http-equiv=\"refresh\" content=\"1; URL=editnodeform.php?nodeid=$nodeid&xorig=$xorig&yorig=$yorig&zoom=$zoom&mapid=$mapid\"> 
</head>
<body>
<p>
Thank you.
</body>
</html>");
  }
else
  {
print("
	<html>
	<head>
	<meta http-equiv=\"refresh\" content=\"1; URL=editnodeform.php?nodeid=$nodeid&xorig=$xorig&yorig=$yorig&zoom=$zoom&mapid=$mapid\"> 
	</head>
	<body>
        <p>
	<font color=#FF0000>Incorrect password</font><p>
        You will be returned to the form to try again in 1 second
	</body>
	</html>\n");
  }
?>
Return current item: Wifimap