Просмотр файла catalog/2.php

Размер файла: 2.05Kb
<?php
include "../header.php";
//include "../unicode.php";
function unicode ($s) 
{ 
	if ((ord($s)>=192) & (ord($s)<=255))
	{
		if ( (ord($s)>=192) & (ord($s)<=255) ) $hexvalue=dechex(ord($s)+848); 
		if ($s=="?") $hexvalue="401"; 
		if ($s=="?") $hexvalue="451"; 
		return("&#x0".$hexvalue.";");
	} 
	else return("$s");
};
//////////////////////////////////////////////////////
function convert ($s)
{
	$ResConAr=array ();
	for ($i=0; $i<=count($s)-1; $i++)
	{
		$Rseww="";
		for ($j=0; $j<=strlen($s[$i])-1; $j++)
		{
			$Rseww;
			$Rseww=$Rseww.unicode($s[$i][$j]);
		}
		$ResConAr;
		$ResConAr[]=$Rseww;

	};
	return($ResConAr);
};
//////////////////////////////////////////////////////
function convertStr ($s)
{
	$Rseww="";
	for ($i=0; $i<=strlen($s)-1; $i++)
	{
		$Rseww;
		$Rseww=$Rseww.unicode($s[$i]);
	}
	return($Rseww);

}
//////////////////////////////////////////////////////
function checkGetVar($var)
{
	if (array_key_exists($var,$_GET))
	return $_GET[$var];
	else
	return -1;
}
//////////////////////////////////////////////////////
print '<p align="center">wap.usahost.ru</p>';
//print '<p>';
$cat=checkGetVar("Cat");
$db_host = 'localhost';
$db_user = 'wap_root';
$db_pass = 'ghBdtn2';
$db_name = 'wap_db1';
$dbc =mysql_connect($db_host, $db_user, $db_pass); 
$dbs = mysql_select_db($db_name);
	

	$lines=file("cats.txt");

	for ($i=0; $i<count($lines); $i++)
	{
		$lines[$i]=convertStr($lines[$i]);
		$data=explode("|", $lines[$i]);
//		print $data[2]."<br/>";
		//$query ="INSERT INTO `cat_catalog` (`id` , `cat` , `name` , `address`) VALUES ('".$i."', '".$data[0]."', '".$data[1]."', '".$data[2]."')";
		$query ="INSERT INTO `cat_catalog` (`id`, `cat` , `name` , `address`) VALUES ('".$data[0]."', '".$data[1]."', '".$data[2]."', '".$data[3]."')";
		if (mysql_query($query)==false) {print 'fffff';} else  {print 'tttt';};
	};

//print $link;
print "<p><b>***</b></p>";
print "<p><a href=\"add.php\">".convertStr("Добавить сайт в каталог")."</a></p>";
//print '</p>';
include "../footer.php";
?>