Просмотр файла fastwap/links.wml

Размер файла: 2.9Kb
<?php  
// =============================================================================
//Fastwap v.1.3 - a Linkmamager for WAP-Phones
//Copyright (C) 2001  webDessert.ch <[email protected]>
//	
//	This program 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.
//	
//	This program 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 this program; if not, write to the Free Software
//	Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
// ==============================================================================


// send wml headers 
header("Content-type: text/vnd.wap.wml");  
echo "<?xml version=\"1.0\"?>";  
echo "<!DOCTYPE wml PUBLIC \"-//WAPFORUM//DTD WML 1.1//EN\""  
   . " \"http://www.wapforum.org/DTD/wml_1.1.xml\">"; 
?> 

<?php
include "../../fastwap.inc.php";
?>

<wml>
<card title="fastwap"> 
<p align="left">

<?php
if(!$us)
{
echo("No username. Please check your URL
</card>
</wml>");
exit();
}

if($pw)
{
$ok = "1";
}
if($pass)
{
$ok = "1";
$pw = md5($pass);
}
if($ok != "1"){
echo("No Password. Please check your URL");
	echo"</card>
	</wml>";
exit();
}

$dbcnx = mysql_connect("$db_host", "$db_user", "$db_pass");
if (!$dbcnx) {
  echo( "Unable to connect to the " .
        "database server at this time.
  </card>
</wml>" );
exit();
}
mysql_select_db("$db_dbname", $dbcnx) or die(mysql_error());
// Request password from usertable
	$result = mysql_query(
              "SELECT ID, password FROM fastwap_person WHERE username = '$us'");
	if (!$result)
	{
      	echo("Error performing query: " .
	mysql_error() . "");
	echo"</card>
	</wml>";
	exit();    
	}

// fetch password and compare password from cookie
	while ( $row = mysql_fetch_array($result) ) 
	{
		$ID = $row["ID"];
		$password_verify = $row["password"];
	}
if ($pw != $password_verify)
{
echo("Wrong password");
	echo"</card>
	</wml>";
exit();
}
// Request entries from linktable
$result = mysql_query(
        "SELECT * FROM fastwap_link WHERE IDname = '$ID' ORDER BY IDlink ASC");
if (!$result)
{
echo("Error performing query: " .
mysql_error() . "");
echo"</card>
</wml>";
exit();    
}
// fetch link entries and display
$i = 1;	
while ( $row = mysql_fetch_array($result) ) 
{
echo("<a href=\"" . $row["linkurl"] . "\" title=\"" . $row["linkname"] . "\">");
echo("$i.) " . $row["linkname"] . "");
echo("</a>");
echo("<br/>");
	$i++;
	}
mysql_close();
?>

</p>
</card>
</wml>