/View/ViewReport.php
PHP | 299 lines | 249 code | 32 blank | 18 comment | 43 complexity | d5dae1d43bba5e2c9ee967cd8d6df84a MD5 | raw file
Possible License(s): LGPL-2.1
- <?php
- require '../Model/Connect.php';
- require '../Control/RegisterLogic.php';
- require '../Control/LoginLogic.php';
- require '../Control/SendNotification.php';
- require '../Control/CreateClubLogic.php';
- require '../Control/DBCreate.php';
- ob_start();
- $UserNm=$_SESSION['username'];
- $Role = $_SESSION['role'];
- ?>
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
- <html xmlns="http://www.w3.org/1999/xhtml">
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
- <title>Online Chess Portal </title>
- <!-- CSS Files -->
- <link href="css/reset.css" rel="stylesheet" type="text/css" />
- <link href="css/Form.css" rel="stylesheet" type="text/css" />
- <link href="css/style.css" rel="stylesheet" type="text/css" />
- <link href="css/screen.css" rel="stylesheet" type="text/css" />
- <link href="css/ToolTip.css" rel="stylesheet" type="text/css" />
- <link rel="stylesheet" type="text/css" href="css/superfish.css" media="screen" />
- <link rel="stylesheet" type="text/css" href="css/jquery.gritter.css" />
- <!-- End of CSS Files -->
- <!-- Javascript Files -->
- <script type="text/javascript" src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
- <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" type="text/javascript"></script>
- <script type="text/javascript" src="javascript/jquery.cycle.all.js"></script>
- <script type="text/javascript" src="javascript/superfish.js"></script>
- <script type="text/javascript" src="javascript/dd.min.js"></script>
- <script type="text/javascript" src="javascript/popup-window.js"></script>
- <script type="text/javascript" src="javascript/wufoo.js"></script>
- <script type="text/javascript" src="http://www.google.com/jsapi"></script>
- <script type="text/javascript">google.load('jquery', '1.5');</script>
- <script type="text/javascript" src="js/jquery.gritter.js"></script>
-
- <script type="text/javascript">
-
- var time_interval = setInterval(
- function ()
- {
- $('#popup').load('../Control/Notification.php').fadeIn("slow");
- }, 5000); // refresh every 5000 milliseconds
-
- </script>
- <script type="text/javascript">
- function BlacklistPerm(about) {
- alert('about : '+about);
- if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp=new XMLHttpRequest();
- } else {// code for IE6, IE5
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function() {
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- if (xmlhttp.responseText == 'Success') {
- alert("The reported person is banned from the Site permenantly.");
- location.href = "ViewReport.php";
- } else {
- //some error in the database
- alert("Error in the process");
- }
- }
- }
- xmlhttp.open("GET","../Control/BlacklistPerm.php?About="+about,true);
- xmlhttp.send();
- }
- </script>
- <script type="text/javascript">
- function BlacklistTemp(about) {
- //alert('about : '+about);
- if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari
- xmlhttp=new XMLHttpRequest();
- } else {// code for IE6, IE5
- xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
- }
- xmlhttp.onreadystatechange=function() {
- //alert('donesend');
- if (xmlhttp.readyState==4 && xmlhttp.status==200) {
- //alert(xmlhttp.responseText);
- if (xmlhttp.responseText == 'Success') {
- alert("The reported person is banned from the Site for two months.");
- location.href = "ViewReport.php";
- } else {
- //some error in the database
- alert("Error in the process");
- }
- }
- }
- //alert('donesend');
- xmlhttp.open("GET","../Control/BlacklistTemp.php?About="+about,true);
- xmlhttp.send();
- }
- </script>
- <!-- End of Javascript Files -->
- </head>
- <body>
- <!-- Wrapper -->
- <div id="wrapper">
- <div id="topbar">
- <img src="images/icon1.png" alt="logo" width="42" height="41" class="logo" id='test' /><img src="images/logo.gif" alt="logo" width="322" height="41" class="logo1" id='test' />
-
- <div id="secnav">
- <ul>
- <li> <a href="../Control/LogoutLogic.php?Reason=Normal">Logout</a> </li>
- <li class="noimg"></li>
- </ul>
- </div>
-
- <div class="menu">
- <ul class="sf-menu">
-
- <li> <a class="on" href="Home_Login.php">HOME</a></li>
-
- <li> <?php if($_SESSION['role'] == 'SiteAdmin') {
- ?> <a href="SiteAdminProfile.php">
- <?php } else { ?>
- <a href="MemberProfile.php">
- <?php }
- $result = mysql_query("SELECT mp_fullname FROM memberprofile WHERE mp_username='".$_SESSION['username']."' ");
- $row = mysql_fetch_array($result);
- $Rows = mysql_num_rows($result);
- if($_SESSION['role'] == 'SiteAdmin' || $Rows == 0) {
- echo 'Profile';
- } else {
- echo $row['mp_fullname'];
- }?></a>
- </li>
-
- </ul>
-
- </div> </div><!-- menu end-->
-
-
- <div id="content_guest" >
- <div class="froms">
- <?php
- $Result = true;
- $About="";
- $From="";
- $Reason="";
- $sql = "SELECT * FROM report GROUP BY re_about ";
- if ($result = mysql_query($sql)) {
- $rows = mysql_num_rows($result);
- if ($rows > 0) {
- while($info = mysql_fetch_assoc( $result )) {
- $About = $info['re_about'];
- $From = $info['re_from'];
- $Reason = $info['re_reason'];
-
- //get the name of the reported person
- $GetName = mysql_query("SELECT mp_fullname FROM memberprofile WHERE mp_username = '".$About."' ");
- $MemberName = mysql_result($GetName, 0);
-
- //get the details of the reported member
- $GetDetails = mysql_query("SELECT mp_currentCity, mp_imagename FROM memberprofile WHERE mp_fullname = '".$MemberName."' ");
- $HomeTown = mysql_result($GetDetails, 0, 0);
- $ImgName = mysql_result($GetDetails, 0, 1);
-
- //check for related clubs and forward it to club admin
- $id = GetClub($About);
- if($id) {
- //forward report
- $sqlGetClub = "SELECT cl_administrator FROM club WHERE cl_id=".$id."";
- $resultClub = mysql_query($sqlGetClub);
- $infoClub = mysql_fetch_assoc( $resultClub );
- $Admin = $infoClub['cl_administrator'];
- if ($resultClub) {
- $InsertSql = "INSERT INTO forwardreport VALUES ('".$From."','".$About."','".$Reason."','".$Admin."')";
- $resultInsert = mysql_query($InsertSql);
- if($resultInsert) {
- $DeleteSql = "DELETE FROM report WHERE re_about = '".$About."' AND re_from = '".$From."' AND re_reason = '".$Reason."'";
- $ResultDelete = mysql_query($DeleteSql);
- if($ResultDelete) {
- echo '<script language="javascript">alert("Forward and Deletion success")</script>';
- echo '<script type="text/javascript"> window.location = "../View/ViewReport.php"</script>';
- } else {
- echo '<script language="javascript">alert("Forward success. Deletion not success")</script>';
- echo '<script type="text/javascript"> window.location = "../View/ViewReport.php"</script>';
- }
- } else {
- echo '<script language="javascript">alert("Forward Failed")</script>';
- echo '<script type="text/javascript"> window.location = "../View/ViewReport.php"</script>';
- }
- } else {
- echo '<script language="javascript">alert("This member does not belong to any club")</script>';
- echo '<script type="text/javascript"> window.location = "../View/ViewReport.php"</script>';
- }
- //end of forwarding
- } else {
- //the member does not belong to any club
- $sqlNoReports = "SELECT COUNT(re_about) as x FROM report WHERE re_from = '".$From."' AND re_about = '".$About."'";
-
- $resultNoReports = mysql_query($sqlNoReports);
- if ($resultNoReports) {
- $rowsNoReports = mysql_num_rows($resultNoReports);
- while($info = mysql_fetch_assoc( $resultNoReports )) {
- $NumofReports = $info['x'];
- }
- echo "<p class=\"content\"><a href=\"MemberProfile.php?id=".$MemberName."\" class=\"tooltip\">".$MemberName."<span class=\"help\"><br/> <img src=\"UserImages/".$ImgName."\" height=\"48\" width=\"48\" /><em> ". $MemberName."</em>".$HomeTown."</span></a> has been reported ". $NumofReports. " time/s by other users </";
-
- echo "<br/><br/>";
-
- if($NumofReports >= 10) {
- //blacklist member permanently
- Print " <a href=\"#\" onclick=\"BlacklistPerm('$About')\">Blacklist_perm</a> " ;
- //Print "<a href = ../Control/BacklistTemp.php?from=".$From."&about=".$About."&reason=".$Reason.">Blacklist</a> " ;
- } else if ($NumofReports == 3 || $NumofReports > 3) {
- //blacklist member temperary
- Print " <a href=\"#\" onclick=\"BlacklistTemp('".$About."')\">Blacklist_Temp</a> " ;
-
- } /*else if($NumofReports > 1) {
- //send warning
- Print "<a href = ../../Control/SendWarning.php?from=".$From."&about=".$About."&reason=".$Reason.">Send Warning</a> " ;
- }*/ else {
- //take no action
- }
- }
- }
- Print "<a href = ../Control/DeleteReport.php?from=".$From."&about=".$About."&reason=".$Reason.">Delete </a> " ;
- }//end of while
- } else {
- echo '<script language="javascript">alert("No reports to display")</script>';
- echo '<script type="text/javascript"> window.location = "SiteAdminProfile.php"</script>';
- }
- }
-
- function GetClub($About){
- $sql = "SELECT DISTINCT cm_clubid FROM clubmember WHERE cm_member=".$About." ";
- $Result = mysql_query($sql);
- if ($Result) {
- $rows = mysql_num_rows($Result);
- while($info = mysql_fetch_assoc( $Result )) {
- $ID = $info['cm_clubid'];
- }
- return $ID;
- } else {
- return false;
- }
- }
-
- ?>
- <span id="popup"></span>
-
- </div></div>
-
- <!-- topbar-->
- <!-- new code-->
-
- <layer>
- <ul id="navigation">
- <li class="home"><a href="Home_Login.php" title="Home"></a></li>
- <li class="play"><a href="Play.php" title="Play Chess"></a></li>
- <li class="photos"><a href="Inbox.php" title="Inbox"></a></li>
- <li class="club"><a href="SearchClub.php" title="Clubs"></a></li>
- <li class="settings"><a href="Settings.php" title="Settings"></a></li>
-
- </ul>
-
- </layer>
-
- <script type="text/javascript">
- $(function() {
- $('#navigation a').stop().animate({'marginLeft':'-85px'},1000);
-
- $('#navigation > li').hover(
- function () {
- $('a',$(this)).stop().animate({'marginLeft':'-2px'},200);
- },
- function () {
- $('a',$(this)).stop().animate({'marginLeft':'-85px'},200);
- }
- );
- });
- </script><!--new code end -->
-
- <div class="clear"></div>
- <div id="footers">
-
-
- <div style="float:right"><div class="fotterlast">
- <a href="#" title="About Us">About Us</a>
- |
- <a href="#" title="Terms of Service">Terms of Service</a>
- |
- <a href="#" title="Privacy Statement">Privacy</a>
- |
- <a href="#" title="Contact Us">Contact Us</a>
- </div></div>
-
- <div style="float:Left"><div class="fotterlastdesing">Design by SEP_WE_05 Team.</div></div>
-
- </div>
- </div>
- </div>
- </div>
- </body>
- </html>