It works and does what is supposed what to do btw.
<?php
ob_start();
session_start();
include("php/connect.php");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<title>Welcome to albsocial</title>
<link rel="stylesheet" href="css/main.css"/>
<link rel="stylesheet" href="css/menubar.css"/>
<script type="text/javascript" src="../js/analytic.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
</head>
<script type="text/javascript">
setTimeout(function() {
$('#error_check').fadeOut('slow');
}, 5000);
</script>
<body>
<div id="header">
<div id="user_logged">
</div>
<?php
if(isset($_SESSION['username']) && $_SESSION['username'] != ''){
if(!isset($_GET['user'])){
echo "
<div id='ligat'>
<ul>
<li class='first'><a href='seria.php'>Seria A</a></li>
<li><a href='laliga.php'>La liga</a></li>
<li><a href='#'>Premier Liga</a></li>
<li><a href='#'>Bundesliga</a></li>
<li><a href='#'>Ligue 1</a></li>
</ul>
</div>
";
}
}else{
echo "";
}
?>
</div>
</div>
<div id="wrapper">
<div id="logo">
<a href="/">Albsocial</a>
</div>
<div id="login">
<?php
if (isset($_SESSION['username']) && $_SESSION['username'] != ''){
$username = $_SESSION['username'];
echo "<h4><a href='member.php?user=".$username."'>".$username."</a></h4><a href='logout.php'>LogOut</a>";
}else{
echo "<a href='login.php'>Login</a> <a href='#'>Register</a>";
}
?>
</div>
<div id="menubar">
<?php include("php/bar.php");?>
</div>
<div id="content_wrap">
<div id="content_member">
<?php
//MARRIM USERNAME QE E VEJM NE ADRESS BARS
if (isset($_GET['user'])){
$username = mysql_real_escape_string($_GET['user']);
if(ctype_alnum($username)){
$check = "SELECT `username` FROM user WHERE username='$username'";
$get = mysql_query($check)or die(mysql_error());
if(mysql_num_rows($get)===1){
$row = mysql_fetch_assoc($get);
$username = $row['username'];
}else{
echo "Ky profil nuk ekziston.";
}
}
}
?>
<?php
if (isset($_SESSION['username']) && $_SESSION['username'] != ''){
if (!isset($_GET['user'])){
//Ndeshjet e fituara ose jo
echo "<h3>Ndeshjet e vendosura nga <b>$username</b> dhe Rezultatet:</h3><br/>";
$matches = "SELECT * FROM match_select WHERE user_id='$username'";
$query_match = mysql_query($matches)or die(mysql_error());
while ($row = mysql_fetch_assoc($query_match)){
$id = $row['match_id'];
$liga = $row['liga'];
if ($row['result'] == $row['final']){
$hey = "style='color: green;' ";
$match = "SELECT * FROM `winner` WHERE `user_id` = '$username' AND `match_id` = '$id' AND `liga`='$liga'";
$matchResult = mysql_query($match)or die(mysql_error());
if($_POST['submit']){
if(mysql_num_rows($matchResult)) {
$error1 = "<div id='error_check'>I keni marre piket ose Nuk jeni fitues.</div>";
}else{
mysql_query("INSERT INTO winner (user_id, match_id, final, liga) VALUE ('$username','$id', '1', '$liga')");
$error1 = "<div id='error_check'>Piket u shtuan ne database</div>";
}
}
}else if($row['final'] == ""){
$hey = " style='color: #333;'";
$n = "?";
}else{
$hey = " style='color: red;'";
}
echo "
<div id='my_selection'><h4>
".$home = $row['home']."
-
".$away = $row['away']." -
".$input = $row['result'] ."
</h4>
</div>
<div id='results'>
<h4 $hey>".$home = $row['home']."
-
".$away = $row['away']."
-
".$result = $row['final']." $n
</h4>
</div>
";
}
echo $error1;
echo "
<form action='member.php' method='post'>
<input type='submit' name='submit[$id]' id='match_check' value='Terhiq Piket'>
</form>
";
}
}else{
header("Location: index.php");
}
?>
</div>
<?php if(!isset($_GET['user'])){
$result = mysql_query("SELECT SUM(final) AS value_sum FROM winner WHERE user_id='$username'");
$row = mysql_fetch_assoc($result);
$sum = $row['value_sum'];
$resul1 = mysql_query("SELECT SUM(dummy) AS value FROM match_select WHERE user_id='$username'");
$row1 = mysql_fetch_assoc($resul1);
$dummy = $row1['value'];
if($dummy['value'] == ""){
echo "";
}else{
echo "
<div id='adds'>
<h3>Statistikat e $username</h3>
<br/>
<h4 style='margin-left: 10px;'>Gjithsej keni vene: ".$dummy." ndeshje.
<br/>
<br/>
Te sakta jane: ".$sum1 = $sum1 + $sum['test_value']." ndeshje.
<br/>
<br/>
Te pa sakta ose akoma skane mbaruar jane: ".$no = $dummy - $sum['test_value']." ndeshje.
</h4>
</div>
";
}
}
?>
</div>
</div>
<div id="footer">
<div id="footerWrapp">
<div id="copyrights"><center>©Te gjitha te drejtat jane te rezervuara nga <a href="#">ALALA</a> , 2013</center></div>
</div>
</div>
</body>
</html>