/View/ViewReport1.php
PHP | 256 lines | 218 code | 22 blank | 16 comment | 21 complexity | cdec4b3e65f1408c1de99eddf1e1d954 MD5 | raw file
Possible License(s): LGPL-2.1
- <?php
- require '../Control/RegisterLogic.php';
-
- ob_start();
- if(LoggedIn()) {
- $User = $_SESSION['username'] ;
- mysql_connect("localhost", "root", "") or die(mysql_error());
- mysql_select_db("OnlineChessGamePortal") or die(mysql_error());
- } else {
- echo '<script language="javascript">alert("You are not logged in")</script>';
- echo '<script type="text/javascript"> window.location = "../View/Home.php"</script>';
- }
- ?>
-
-
- <!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>Collapsible Message Panels</title>
- <script type="text/javascript" src="jquery.js"></script>
- <script type="text/javascript">
- $(document).ready(function(){
-
- //hide message_body after the first one
- $(".message_list .message_body:gt(0)").hide();
-
- //hide message li after the 5th
- $(".message_list li:gt(4)").hide();
-
-
- //toggle message_body
- $(".message_head").click(function(){
- $(this).next(".message_body").slideToggle(500)
- return false;
- });
-
- //collapse all messages
- $(".collpase_all_message").click(function(){
- $(".message_body").slideUp(500)
- return false;
- });
-
- //show all messages
- $(".show_all_message").click(function(){
- $(this).hide()
- $(".show_recent_only").show()
- $(".message_list li:gt(4)").slideDown()
- return false;
- });
-
- //show recent messages only
- $(".show_recent_only").click(function(){
- $(this).hide()
- $(".show_all_message").show()
- $(".message_list li:gt(4)").slideUp()
- return false;
- });
-
- });
- </script>
- <style type="text/css">
- * {
- margin: 0;
- padding: 0;
- }
- body {
- margin: 10px auto;
- width: 570px;
- font: 75%/120% Arial, Helvetica, sans-serif;
- }
- p {
- padding: 0 0 1em;
- }
- /* message display page */
- .message_list {
- list-style: none;
- margin: 0;
- padding: 0;
- width: 383px;
- }
- .message_list li {
- padding: 0;
- margin: 0;
- background: url(images/message-bar.gif) no-repeat;
- }
- .message_head {
- padding: 5px 10px;
- cursor: pointer;
- position: relative;
- }
- .message_head .timestamp {
- color: #666666;
- font-size: 95%;
- position: absolute;
- right: 10px;
- top: 5px;
- }
- .message_head cite {
- font-size: 100%;
- font-weight: bold;
- font-style: normal;
- }
- .message_body {
- padding: 5px 10px 15px;
- }
- .collapse_buttons {
- text-align: right;
- border-top: solid 1px #e4e4e4;
- padding: 5px 0;
- width: 383px;
- }
- .collapse_buttons a {
- margin-left: 15px;
- float: right;
- }
- .show_all_message {
- background: url(images/tall-down-arrow.gif) no-repeat right center;
- padding-right: 12px;
- }
- .show_recent_only {
- display: none;
- background: url(images/tall-up-arrow.gif) no-repeat right center;
- padding-right: 12px;
- }
- .collpase_all_message {
- background: url(images/collapse-all.gif) no-repeat right center;
- padding-right: 12px;
- color: #666666;
- }
- </style>
- <script type="text/javascript">
- function show_confirm(from,about,reason)
- {
- var answer = confirm("Delete entry ?")
- if (answer){
- alert("Entry Deleted")
- <!--window.location = "links.php?act=trackdelete&id="+ID;
- window.location = "../../Control/DeleteReport.php?from="+from+"&about="+about+"&reason="+reason;
- }
- else
- {
- alert("You pressed Cancel!");
- }
- }
- </script>
- </head>
- <body>
- <?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'];
-
- //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 "UOOO";
- 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 " <li>\n";
- echo " <div class=\"message_body\">\n";
- echo " <p><br />\n";
-
- echo $About." has been reported ". $NumofReports. " time/s by other users </";
- echo "<br/><br/>";
-
-
- if($NumofReports > 10) {
- //blacklist member permanently
- Print "<a href = ../Control/Backlist2.php?from=".$From."&about=".$About."&reason=".$Reason.">Blacklist</a> " ;
- } else if ($NumofReports > 1) {
- //blacklist member temperary
- Print "<a href = ../Control/BacklistTemp.php?from=".$From."&about=".$About."&reason=".$Reason.">Blacklist</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> " ;
- echo "<a href = \"#\" onclick=\"show_confirm(".$From.".".$About.",".$Reason.")\">delete</a>\n";
- }//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;
- }
- }
-
- ?>
-
-
-
- <p class="collapse_buttons"><a href="#" class="show_all_message">Show all message <?php (".$rows.") ?></a> <a href="#" class="show_recent_only">Show 5 only</a> <a href="#" class="collpase_all_message">Collapse all</a></p>
- </body>
- </html>