Jump to content
php.lv forumi

htmlspecialchars neaktivizējas kāpēc?


waplet

Recommended Posts

$uname = htmlspecialchars($uname);
echo "
<CENTER>Персонаж <B><?=$uname?></B> не найден в базе</CENTER>";

Redzat itkā ir $uname definēts ar chariem , bet tik un tā alertu met ārā!

Kā to izlabot?

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

nu man ir tā :

ir links kur izskatās šadi

inf.php?uname=... , un kā ierakstot šādi inf.php?uname=<script>alert(1)</script> , izmet 1.

sourcē izsatās tā

<CENTER>Персонаж <B><script>alert(1)</script></B> не найден в базе</CENTER>

, bet php kodā tā

	echo "
<CENTER>Персонаж <B><?=$uname?></B> не найден в базе</CENTER>";

 

p.s. cerams saprotat

, bet augstāk minēts $uname ir ar htmlspecial chariem , bet viņš izpildas bez!

Edited by waplet
Link to comment
Share on other sites

<?session_start();
$unhide_id="unhide";
$hide_id="hide";


include ("db_config.php");
include_once('func.php');
$moder_status = 0;

if ((session_is_registered('login')) && ($login != '')) {
$result1 = mysql_query("SELECT * FROM players WHERE Username = '$login'");
$result = mysql_fetch_array($result1);
$ClanID = $result[ClanID];
$LevelV = $result[Level];
if ( (($ClanID != 9) && (($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) || ($ClanID == 9) ||($ClanID == 9) || ($ClanID == 9))) && (($uname != 'Банкомат1') && ($uname != 'Bingo1') && ($uname != '1Кассир') && ($uname != '12') && ($uname != '1') && ($uname != '1') && ($uname != '2') && ($uname != '3')) )
 {
$moder_status = $ClanID;
 }

if (($login == 'Slaya4a') || ($login == 'w4p13337') || ($login == 'Slay4aa') || ($login == 'Slaya4a') || ($login == 'Bin1gо'))
 {
	 $moder_status = '1';
}

 if ((($uname == 'Slay4aa') || ($uname == 'w4p13337') || ($uname == 'Slay4aa')) && ($uname == $login))
{
	 $moder_status = '1';
}
}

$NetwarsVIP = mysql_query("SELECT * FROM vip WHERE Username = '$uname'",$db);
$NetwarsVIP = mysql_fetch_array($NetwarsVIP);
if ($NetwarsVIP){
 if (($NetwarsVIP['Link'] != '')&&($moder_status != 1)&&($uname != $login)){
header("Location: ".$NetwarsVIP['Link']."");
 }
}

$Player_name = $uname;
include ("func_get_info.php");

//echo "city=$City";
if ((!$City) && ($reply == 1)) {
$uname = htmlspecialchars($uname);
echo "
<HTML><HEAD>
<TITLE>Last Century Wars - Player not exists</TITLE>
<link rel=\"SHORTCUT ICON\" href=\"favicon.ico\">
<link rel=stylesheet type=\"text/css\" href=\"main.css\">
<meta content=\"text/html; charset=windows-1251\" http-equiv=Content-type>
<META Http-Equiv=Cache-Control Content=\"no-cache, max-age=0, must-revalidate, no-store\">
<meta http-equiv=PRAGMA content=NO-CACHE>
<meta http-equiv=\"Content-Type\" content=\"text/html; charset=windows-1251\">
<META Http-Equiv=Expires Content=0>
<script src='main.js'></SCRIPT>
<script>
function thing_info(thing) {
	window.open('thing.php?thing='+thing);
}
</SCRIPT>
</HEAD>
<body bgcolor=#DDDDCC>
<CENTER>Персонаж <B><?=$uname?></B> не найден в базе</CENTER>";

Re kur ir pilnais kods :)

Edited by waplet
Link to comment
Share on other sites

Btw, no kurienes tev nāk tas $uname ? Tu izmanto register_globals ?

 

Lai nu kā - it kā jau vajadzēja visam strādāt. Paskaties renderētajā sourcē (Pārlūkā View source) kā tur izskatās tas <CENTER>Персонаж <B><?=$uname?></B> не найден в базе</CENTER>.

Link to comment
Share on other sites


×
×
  • Create New...