ugrás a tartalomhoz

Belépés hiba

sziszka95 · 2011. Szep. 21. (Sze), 15.13
Sziasztok van egy kis gond hogy van egy oldal és ha nem töltöm ki a felhasználó+jelszó akkor is be tudok lépni szerintetek mi lehet a gond?!


Itt a feldolgozo.php
<?php

ob_start();
session_start();

$start_microtime = explode(" ", microtime());
define("START", $start_microtime[1] . substr($start_microtime[0], 1));


include "config.php";
include "includes/function.php";
include "includes/function_time.php";
$cmd = $_GET['cmd'];
$cmd = base64_decode(base64_decode($cmd));
$array = explode(".", $cmd);
if($cmd != NULL)
{
    $id = $array['0'];
    $username = $array['1'];
	
    $sql_login2           = "SELECT * FROM who_online WHERE username='$username'";
    $ered_login2          = mysql_query($sql_login2);
    $rows_login2          = mysql_num_rows($ered_login2);
	
	if($rows_login2==0)
	{
		leker_user_adatlap1($username);
		$sql_onlineok = "INSERT INTO who_online(u_id, username, time) VALUE ('$user1_id', '$username', '$time')";
		$ered_onlineok = mysql_query($sql_onlineok);
	
	}
	
    if($_SESSION['cmdtime'] != $array['3'])
    {
        $sql_noonline = "DELETE FROM who_online WHERE username='$username'";
        $ered_noonline = mysql_query($sql_noonline);
        $sql_alvaskuld = "UPDATE users SET alvas='alvas' username='$username'";
        $ered_alvaskuld = mysql_query($sql_alvaskuld);
        header("Location:logout.php");
    }
	
    $sql_login2           = "SELECT * FROM who_online WHERE username='$username'";
    $ered_login2          = mysql_query($sql_login2);
    $rows_login2          = mysql_num_rows($ered_login2);
	
	if($rows_login2==0)
	{
		$sql_alvaskuld = "UPDATE users SET alvas='alvas' username='$username'";
        $ered_alvaskuld = mysql_query($sql_alvaskuld);
        header("Location:logout.php");
	
	}
}
else
{
	if( ($_POST['username']!="") OR ($_POST['password']!="") OR ($_POST['username']!=NULL) OR ($_POST['password']!=NULL) )
	{
		$username            = $_POST['username'];
		$password            = sha1(md5("maffia".$_POST['password']."$username"));
		$sql_login           = "SELECT * FROM users WHERE username='$username' AND password='$password'";
		$ered_login          = mysql_query($sql_login);
		$rows_login          = mysql_num_rows($ered_login);
		
		
		if($rows_login>0)
		{
			$array_login= mysql_fetch_array($ered_login);
			if($array_login['active']!=0)
			{
				leker_user_adatlap1($username);
				$sql_noonlinex = "SELECT * FROM who_online WHERE username='$username'";
				$ered_noonlinex = mysql_query($sql_noonlinex);
				$rows_onlineex = mysql_num_rows($ered_noonlinex);
				if($rows_onlineex==0)
				{
					$sql_onlineok = "INSERT INTO who_online (u_id, username, time) VALUE ('$user1_id', '$username', '$time')";
					$ered_onlineok = mysql_query($sql_onlineok);				
				}
				else
				{
					$sql_noonline = "DELETE FROM who_online WHERE username='$username'";
					$ered_noonline = mysql_query($sql_noonline);
					$sql_alvaskuld = "UPDATE users SET alvas='alvas' username='$username'";
					$ered_alvaskuld = mysql_query($sql_alvaskuld);
					$_SESSION['cmdtime'] = "";
					$username = "";
					$password = "";
					$id = "";
					$cmd = "";
					$loginmsg = base64_encode(base64_encode("Ezzel a névvel már bentvan valaki!"));
					header("Location: index.php?loginmsg=$loginmsg");
				
				}
			}
			else
			{
				$sql_noonline = "DELETE FROM who_online WHERE username='$username'";
				$ered_noonline = mysql_query($sql_noonline);
				$sql_alvaskuld = "UPDATE users SET alvas='alvas' username='$username'";
				$ered_alvaskuld = mysql_query($sql_alvaskuld);
				$_SESSION['cmdtime'] = "";
				$username = "";
				$password = "";
				$id = "";
				$cmd = "";
				$loginmsg = base64_encode(base64_encode("Aktiválnod kell a regisztrációd!"));
				header("Location: index.php?loginmsg=$loginmsg");
			}
			
		}
		else
		{
			$sql_noonline = "DELETE FROM who_online WHERE username='$username'";
			$ered_noonline = mysql_query($sql_noonline);
			$sql_alvaskuld = "UPDATE users SET alvas='alvas' username='$username'";
			$ered_alvaskuld = mysql_query($sql_alvaskuld);
			$_SESSION['cmdtime'] = "";
			$username = "";
			$password = "";
			$id = "";
			$cmd = "";
			$loginmsg = base64_encode(base64_encode("Rossz felhasználónév/jelszó!"));
			header("Location: index.php?loginmsg=$loginmsg");	
		}
	}
	else
	{
		$_SESSION['cmdtime'] = "";
		$username = "";
		$password = "";
		$id = "";
		$cmd = "";
		$loginmsg = base64_encode(base64_encode("Nem írtál be felhasználónevet/jelszót!"));
		header("Location: index.php?loginmsg=$loginmsg");		
	}
}

if($array[2]=="shop")
{
	$onload = "onLoad=\"shop()\" ";
}
elseif($array[2]=="country")
{
	$onload = "onLoad=\"szalon()\" ";
}
elseif($array[2]=="travel")
{
	$onload = "onLoad=\"travel()\" ";
}
elseif($array[2]=="chat")
{
	$onload = "onLoad=\"JavaScript: document.new_message.message.focus(); startTime()\"";
}
elseif( ($array[2]=="buffet") OR ($array[2]=="drogs") )
{
	$onload = "onLoad=\"bar()\"";

}
else
{
	$onload = "onLoad=\"startTime()\" ";

}

?>
<html>
<head>
<link href="clearbox.css" rel="stylesheet" type="text/css" />
<script src="clearbox.js" type="text/javascript"></script>
<script language="JavaScript" src="pajzs.js"></script>
	<script language=javascript>

var rev = "fwd";

function titlebar(val)

{

   var msg  = "Offline Maffia";

   var res = " ";

   var speed = 180;

   var pos = val;



   msg = ""+msg+"";

   var le = msg.length;

   if(rev == "fwd"){

       if(pos < le){

       pos = pos+1;

       scroll = msg.substr(0,pos);

       document.title = scroll;

       timer = window.setTimeout("titlebar("+pos+")",speed);

       }

       else{

       rev = "bwd";

       timer = window.setTimeout("titlebar("+pos+")",speed);

       }

   }

   else{

       if(pos > 0){

       pos = pos-1;

       var ale = le-pos;

       scrol = msg.substr(ale,le);

       document.title = scrol;

       timer = window.setTimeout("titlebar("+pos+")",speed);

       }

       else{

       rev = "fwd";

       timer = window.setTimeout("titlebar("+pos+")",speed);

       }    

   }

}



titlebar(0);

</script>
	<link rel="stylesheet" href="styles/basic.css" type="text/css" media="screen">
	<link rel="stylesheet" href="styles/chat.css" type="text/css" media="screen">
	<link rel="stylesheet" type="text/css" href="styles/parking1.css" />
	<link rel="stylesheet" type="text/css" href="styles/parking2.css" />

	<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />
	<!---
	<meta name="description" content="leiras" />
	<meta name="keywords" content="kulcs, szavak" />
	-->
	<script type="text/javascript" src="scripts/openit.js"></script>
	<script type="text/javascript" src="scripts/shop.js"></script>
	<script type="text/javascript" src="scripts/szalon.js"></script>
	<script type="text/javascript" src="scripts/travel.js"></script>
	<script type="text/javascript" src="scripts/clock.js"></script>
	<script type="text/javascript" src="scripts/checkchs.js"></script>
	<script type="text/javascript" src="scripts/bar.js"></script>
	<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
	<script type="text/javascript" src="scripts/parking.js">

	/***********************************************
	* Smooth Navigational Menu- (c) Dynamic Drive DHTML code library (www.dynamicdrive.com)
	* This notice MUST stay intact for legal use
	* Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code
	***********************************************/

	</script>

	<script type="text/javascript">

	ddsmoothmenu.init({
		mainmenuid: "parking", //Menu DIV id
		orientation: 'v', //Horizontal or vertical menu: Set to "h" or "v"
		classname: 'ddsmoothmenu-v', //class added to menu's outer DIV
		//customtheme: ["#804000", "#482400"],
		contentsource: "markup" //"markup" or ["container_id", "path_to_menu_file"]
	})

	</script>
</head>
<body text="#ffffff" <?php echo $onload; ?>>
<center>
<table width="1000px" cellpadding="0" cellspacing="0" border="0px">
<tr>
	<td width="150px" height="50px" background="images/background_weapons.png" align="center">
	
	<?php include "includes/user_weapons.php"; ?>
	
	</td>
	<td width="850px" height="200px" rowspan="2" align="left" valign="top" background="images/header.png">
		
	<?php include "includes/userdetails.php"; ?>
	
	</td>
</tr>
<tr>
	<td width="150px" height="150px" background="images/maffia.png"></td>
</tr>

</table>

</table>
<table width="1000px" height="600px" cellpadding="0" cellspacing="0" border="0px">
<tr>
	<td width="150px" align="center" valign="top">
	
	<?php include "includes/menu.php"; ?>

	</td>
	<td width="850px" align="center" valign="top">
		<table cellspacing="0" cellpadding="0" >
		<tr>
			<td width="850px" height="20px"> 
			</td>
		</tr>
		</table>

		<table cellspacing="0" cellpadding="0">
		<tr>
			<?php 
			
			include "includes/main_title.php";
			
			echo "
			<td width=\"850px\" height=\"25px\" align=\"center\" valign=\"center\" background=\"images/main_table_01.png\">
			<font style=\"font-family: Verdana; font-size: 14px; font-weight: bold; color: #ffffff;\">
			$main_title_text			
			</font>
			</td>";
			
			?>
		</tr>
		</table>
		<table cellspacing="0" cellpadding="0" background="images/main_table_02.png">
		<tr>
			<td width="850px" height="18px">
			</td>
		</tr>
		<tr>
			<td width="850px" height="710px" align="center" valign="top">
			
			<?php include "includes/switch.php"; ?>
			
			</td>
		</tr>
		</table>

		<table cellspacing="0" cellpadding="0">
		<tr>
			<td width="850px" height="5px" align="center" valign="center" background="images/main_table_03.png">
			</td>
		</tr>
		</table>
	</td>
</tr>
</table>

<?php

$length = 4;
if(!is_integer($length))
{
$length = 4;
}
if($length > 15)
{
$length = 15;
}
$end_microtime = explode(" ", microtime());
$end = $end_microtime[1] . substr($end_microtime[0], 1);
$duration = $end - START;
$duration = round($duration, $length);

?>
<table cellspacing="0" cellpadding="0" background="images/footer.png">
<tr>
	<td width="300px" height="80px" colspan="2" align="left" valign="center"><b><font color=deepskyblue>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&reg;Offline Maffia&reg;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&copy;2010-2011&copy;<br>Ajánlott felbontás: minimum 1024x768<br>Az oldal <?php echo $duration; ?> másodperc alatt készült el.</b></font>
	</td>
</tr>
</table>
</center>
</body>
</html>

<?
if($array[2] == "logout")
{
    $sql_noonline = "DELETE FROM who_online WHERE username='$array[1]'";
    $ered_noonline = mysql_query($sql_noonline);
    $sql_alvaskuld = "UPDATE users SET alvas='alvas' username='$array[1]'";
    $ered_alvaskuld = mysql_query($sql_alvaskuld);
    header("Location:logout.php");
}
?>



 
1

Nagyon rossz

Poetro · 2011. Szep. 21. (Sze), 15.27
A következő sor nagyon rossz:
if( ($_POST['username']!="") OR ($_POST['password']!="") OR ($_POST['username']!=NULL) OR ($_POST['password']!=NULL) ) 
Valamint az összes SQL lekérdezés is, elég ha azt adom meg névnek, hogy: ' OR '1' és egy csomó dolog nagyon furán fog működni az oldal. Vegyük például a következő lekérdezést:
DELETE FROM who_online WHERE username='$username'
És most helyettesítsük be a fenti értéket:
DELETE FROM who_online WHERE username='' OR '1'
2

hát igen

sziszka95 · 2011. Szep. 21. (Sze), 15.33
:S hát sajan igen énis úgy kaptam a motort és azt mondták ha megtudom csinálni használjam egéséggel! -.- tudnál egy kicsit segiteni?
3

Miben?

Poetro · 2011. Szep. 21. (Sze), 16.56
Szerintem egy kicsit már segítettem. Igazából ezt az egészet véleményem szerinte majdnem teljesen újra kellene írni, mert tele van lyukakkal.
4

Hát

sziszka95 · 2011. Szep. 21. (Sze), 17.05
Háát igen tudsz valami videót vagy valamit ajánlani amiből ilyeneket lehet tanulni?