WCDDL Forums
(#1)
Benzoman Offline
 
Posts: 4
Join Date: May 2010
Report Module by Genius Jomasaco - 05-22-2010, 03:41 AM

wcddl_reports.php Run the SQL install in code on db.
Code:
    <?php
    /*BEGIN_INFO
    Show  the reported sites.
    END_INFO*/
    if(!defined("WCDDL_GUTS"))
       exit;
    // SQL Install
    /*
    CREATE TABLE IF NOT EXISTS `wcddl_reports` (
      `id` int(11) NOT NULL auto_increment,
      `download` int(11) NOT NULL,
      `reason` varchar(255) NOT NULL,
      PRIMARY KEY  (`id`)
    ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 ;
    */
    // Config
    $modEnabled = true; //Change to false if don't use
    if($modEnabled) {
    $add = array('reportMod' => "Reported Downloads",);
    $core->admin_links = array_merge($core->admin_links, $add);
    function reportDownload($id,$reason) {
       $id = intval($id);
       if($id < 1)
          return false;
       if(empty($reason))
          return false;
       mysql_query("INSERT INTO wcddl_reports (download,reason) VALUES ('".$id."','".mysql_real_escape_string($reason)."')");
       return true;
    }
    function reportAdmin() {
       switch($_GET['go']) {
          case "reportMod":
             $get = mysql_query("SELECT id,download,reason FROM wcddl_reports");
             echo '<table width="100%" border="0">';
             while($row = mysql_fetch_assoc($get)) {
                echo '<tr>
                   //<td>Download #'.$row['download'].'</td>
                   <td>'.htmlspecialchars($row['reason']).'</td>
                   <td>Clean</td>                   
                   <td>Delete</td>
                   </tr>';
             }
             echo '<td>Clean Remove only the Report, Delete Remove the Report & Download.</td></table>';
          break;
          case "reportModDelete":
             if(!isset($_GET['id']))
                $msg = 'No ID set!';
             else {
                $id = intval($_GET['id']);
                if($id < 1)
                   $msg = 'Invalid report ID given!';
                else {
                   $exists = mysql_query("SELECT id, download, reason FROM wcddl_reports WHERE id = ".$id);
                   $row = mysql_fetch_assoc($exists);
                   if($row['id'] != $id)
                      $msg = 'Report does not exist!';
                   else {
                      mysql_query("DELETE FROM wcddl_reports WHERE download = ".$row['download']);
                      mysql_query("DELETE FROM wcddl_downloads WHERE id = ".$row['download']);
                      $msg = 'Report and Download deleted.';
                   }
                }
             }
             echo ''.$msg.'';
          break;
          case "reportModClean":
             if(!isset($_GET['id']))
                $msg = 'No ID set!';
             else {
                $id = intval($_GET['id']);
                if($id < 1)
                   $msg = 'Invalid report ID given!';
                else {
                   $exists = mysql_query("SELECT COUNT(0) FROM wcddl_reports WHERE id = ".$id);
                   $exists = mysql_result($exists,0);
                   if($exists < 1)
                      $msg = 'Report does not exist!';
                   else {
                      mysql_query("DELETE FROM wcddl_reports WHERE id = ".$id);
                      $msg = 'Report deleted.';
                   }
                }
             }
             echo ''.$msg.'';
          break;        
          default:
             return true;
          break;
       }
    }
       $core->attachHook("adminFunctions","reportAdmin");
    }
?>
reportdownload.php
Code:
<?php
include "funcs.php";
if(!isset($_GET['id']))
	exit;
$id = intval($_GET['id']);
if($id < 1)
	exit;
if(isset($_POST['reason'])) {
	$reason = $_POST['reason'];
	// Make use of the processURL func to strip crappy chars
	$reason = $core->processURL($reason,' ');
	if(empty($reason))
		$str = 'Empty reason given.';
	else {
		$exists = mysql_query("SELECT COUNT(0) FROM wcddl_downloads WHERE id = ".$id);
		$exists = mysql_result($exists,0);
		if($exists < 1)
			$str = 'Download does not exist.';
		else {
			if(reportDownload($id,$reason)) {
				$str = 'Reported.';
			} else {
				$str = 'Report failed for an unknown reason.';
			}
		}
	}
} else
	$str = '
	Report this Download:
	Reason: <input type="text" name="reason" />
	<input type="submit" value="Report" />';
?>
<html>
	<head>
		<title>Report a Download</title>
	</head>
	<body style='background:#FFF'>
		<div style='width:400px; margin:auto; background:#EFEFEF; text-align:center; border:1px solid #777;'>
			<form action="reportdownload.php?id=<?=$id?>" method="post">
			<?=$str?>
			Go Back
			</form>
		</div>
	</body>
</html>
<?php
$core->modules(ob_get_contents());
?>
This has the delete option to remove the report and the link.
Also the clean option which removes only the report.
I believe this is the latest code jomasaco originally posted elsewhere.
Feel free to reply with further details or corrections and even questions.
(#2)
Benzoman Offline
 
Posts: 4
Join Date: May 2010
Re: Report Module by Genius Jomasaco - 05-22-2010, 03:43 AM

Also add to leftbar.php or wherever you want the report link to be.
Code:
<center>Report This Download</center>
(#3)
jomasaco Offline
Probationary Member
 
Posts: 21
Join Date: May 2010
Re: Report Module by Genius Jomasaco - 05-22-2010, 10:48 AM

the base code are from JMZ
(#4)
c0rrupt Offline
Administrator
 
Posts: 201
Join Date: Mar 2010
Location: Canada
Re: Report Module by Genius Jomasaco - 05-22-2010, 11:41 AM

wish i could get this fker to work on wcddl_fully-loaded


Before doing any edits to your DDL Site always make a BACKUP first.
(#5)
nirav5300 Offline
 
Posts: 7
Join Date: Apr 2010
Re: Report Module by Genius Jomasaco - 05-28-2010, 01:14 PM

Its working like a charm
(#6)
WJManiaC Offline
Probationary Member
 
Posts: 12
Join Date: Dec 2011
12-25-2011, 07:48 AM

why cant i click the link i put it in left bar but i think you have to put something else, cause i cant even select it any help plz.

Bookmarks

Tags
genius, jomasaco, module, report

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Powered by vBulletin


Content Relevant URLs by vBSEO