[ Index ] |
|
Code source de Cr@wltr@ck 2.2.1 |
1 <?php 2 //---------------------------------------------------------------------- 3 // CrawlTrack 2.2.1 4 //---------------------------------------------------------------------- 5 // Crawler Tracker for website 6 //---------------------------------------------------------------------- 7 // Author: Jean-Denis Brun 8 //---------------------------------------------------------------------- 9 // Website: www.crawltrack.fr 10 //---------------------------------------------------------------------- 11 // That script is distributed under GNU GPL license 12 //---------------------------------------------------------------------- 13 // file: admindatasuppress2.php 14 //---------------------------------------------------------------------- 15 16 if (!defined('IN_CRAWLT_ADMIN')) 17 { 18 echo"<h1>Hacking attempt !!!!</h1>"; 19 exit(); 20 } 21 22 if(isset($_POST['suppressdata'])) 23 { 24 $suppressdata = (int)$_POST['suppressdata']; 25 } 26 else 27 { 28 $suppressdata = 0; 29 } 30 31 if(isset($_POST['suppressdataok'])) 32 { 33 $suppressdataok = (int)$_POST['suppressdataok']; 34 } 35 else 36 { 37 $suppressdataok = 0; 38 } 39 40 if($suppressdata==1) 41 42 { 43 44 if(isset($_POST['datatosuppress'])) 45 { 46 $datatosuppress = (int)$_POST['datatosuppress']; 47 } 48 else 49 { 50 header("Location:../index.php"); 51 exit(); 52 } 53 54 55 56 if($suppressdataok==1) 57 { 58 //data suppression 59 60 //database connection 61 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 62 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 63 64 //period calculation 65 66 $today = date("Y-m-d"); 67 $today2 = explode('-', $today); 68 $yeartoday = $today2[0]; 69 $monthtoday = $today2[1]; 70 $daytoday = $today2[2]; 71 72 73 74 if ($datatosuppress==1) 75 { 76 $ts = mktime(0,0,0,$monthtoday, $daytoday, $yeartoday) - 31536000; 77 } 78 elseif ($datatosuppress==2) 79 { 80 $ts = mktime(0,0,0,$monthtoday, $daytoday, $yeartoday) - 15768000; 81 } 82 elseif ($datatosuppress==3) 83 { 84 $ts = mktime(0,0,0,$monthtoday, $daytoday, $yeartoday) - 2628000; 85 } 86 else 87 { 88 echo"<h1>Hacking attempt !!!!</h1>"; 89 exit(); 90 } 91 92 $datetosuppress = date("Y-m-d",$ts); 93 //treatment of $datetosuppress to have complete month 94 $suppress = explode('-', $datetosuppress); 95 $yearsuppress = $suppress[0]; 96 $monthsuppress = $suppress[1]; 97 98 $datetosuppress=$yearsuppress."-".$monthsuppress."-01"; 99 //requete to get the archive data for crawler visits 100 $sqlstats = "SELECT crawlt_keyword_id_keyword, crawlt_id_crawler, date, crawlt_site_id_site FROM crawlt_visits_human 101 WHERE date < '".sql_quote($datetosuppress)."' 102 ORDER BY date ASC"; 103 104 $requetestats = mysql_query($sqlstats, $connexion) or die("MySQL query error"); 105 106 $nbrresult=mysql_num_rows($requetestats); 107 if($nbrresult>=1) 108 { 109 110 //database query to suppress the data 111 $sqldelete="DELETE FROM crawlt_visits_human WHERE date < '".sql_quote($datetosuppress)."'"; 112 $requetedelete = mysql_query($sqldelete, $connexion) or die("MySQL query error"); 113 114 //database query to optimize the table 115 $sqloptimize = "OPTIMIZE TABLE crawlt_visits_human"; 116 $requeteoptimize = mysql_query($sqloptimize, $connexion) or die("MySQL query error"); 117 118 //emptied the cache table 119 $sqlcache = "TRUNCATE TABLE crawlt_cache"; 120 $requetecache = mysql_query($sqlcache, $connexion) or die("MySQL query error"); 121 122 if($requetedelete) 123 { 124 echo"<br><br><h1>".$language['data_human_suppress_ok']."</h1>\n"; 125 126 echo"<div class=\"form\">\n"; 127 echo"<form action=\"index.php\" method=\"POST\" >\n"; 128 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 129 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 130 echo"</form>\n"; 131 echo"</div>\n"; 132 } 133 else 134 { 135 echo"<br><br><h1>".$language['data_human_suppress_no_ok']."</h1>\n"; 136 137 echo"<div class=\"form\">\n"; 138 echo"<form action=\"index.php\" method=\"POST\" >\n"; 139 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 140 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 141 echo"</form>\n"; 142 echo"</div>\n"; 143 } 144 } 145 else 146 { 147 echo"<h1>".$language['no_data_human_to_suppress']."</h1>"; 148 } 149 150 151 } 152 else 153 { 154 //validation of suppression 155 156 //display 157 158 if ($datatosuppress==1) 159 { 160 $datatosuppressdisplay=$language['one_year_human_data']; 161 } 162 elseif ($datatosuppress==2) 163 { 164 $datatosuppressdisplay=$language['six_months_human_data']; 165 } 166 elseif ($datatosuppress==3) 167 { 168 $datatosuppressdisplay=$language['one_month_human_data']; 169 } 170 else 171 { 172 echo"<h1>Hacking attempt !!!!</h1>"; 173 exit(); 174 } 175 176 echo"<br><br><h1>".$language['data_human_suppress_validation']."$datatosuppressdisplay ?</h1>\n"; 177 178 echo"<div class=\"form\">\n"; 179 echo"<form action=\"index.php\" method=\"POST\" >\n"; 180 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 181 echo "<input type=\"hidden\" name ='validform' value=\"24\">"; 182 echo "<input type=\"hidden\" name ='suppressdata' value=\"1\">\n"; 183 echo "<input type=\"hidden\" name ='suppressdataok' value=\"1\">\n"; 184 echo "<input type=\"hidden\" name ='datatosuppress' value=\"$datatosuppress\">\n"; 185 echo"<table class=\"centrer\">\n"; 186 echo"<tr>\n"; 187 echo"<td colspan=\"2\">\n"; 188 echo"<input name='ok' type='submit' value=' ".$language['yes']." ' size='20'>\n"; 189 echo"</td>\n"; 190 echo"</tr>\n"; 191 echo"</table>\n"; 192 echo"</form>\n"; 193 echo"</div>"; 194 195 echo"<div class=\"form\">\n"; 196 echo"<form action=\"index.php\" method=\"POST\" >\n"; 197 echo "<input type=\"hidden\" name ='navig' value='6'>\n"; 198 echo "<input type=\"hidden\" name ='suppressdata' value=\"0\">\n"; 199 echo "<input type=\"hidden\" name ='suppressdataok' value=\"0\">\n"; 200 echo"<table class=\"centrer\">\n"; 201 echo"<tr>\n"; 202 echo"<td colspan=\"2\">\n"; 203 echo"<input name='ok' type='submit' value=' ".$language['no']." ' size='20'>\n"; 204 echo"</td>\n"; 205 echo"</tr>\n"; 206 echo"</table>\n"; 207 echo"</form>\n"; 208 echo"</div>"; 209 210 } 211 212 } 213 else 214 { 215 216 echo"<br><br><h1>".$language['data_human_suppress']."</h1>\n"; 217 218 219 $connexion = mysql_connect($crawlthost,$crawltuser,$crawltpassword) or die("MySQL connection to database problem"); 220 $selection = mysql_select_db($crawltdb) or die("MySQL database selection problem"); 221 222 223 $sql = "SELECT * FROM crawlt_visits_human ORDER BY date ASC"; 224 225 $requete = mysql_query($sql, $connexion) or die("MySQL query error"); 226 227 $nbrresult=mysql_num_rows($requete); 228 if($nbrresult>=1) 229 { 230 $ligne = mysql_fetch_object($requete); 231 232 $date=$ligne->date; 233 $date2 = explode('-', $date); 234 $yeardate = $date2[0]; 235 $monthdate = $date2[1]; 236 $daydate = $date2[2]; 237 $daydate2 = explode(' ',$daydate); 238 239 240 if ($crawltlang=='english') 241 { 242 echo"<h2>".$language['oldest_data']."$monthdate /".$daydate2[0]."/ $yeardate</h2>"; 243 } 244 else 245 { 246 echo"<h2>".$language['oldest_data']."".$daydate2[0]." / $monthdate / $yeardate</h2>"; 247 } 248 echo"<br><br><table>\n"; 249 echo"<tr><td valign='top'>\n"; 250 echo"".$language['data_human_suppress2']."\n"; 251 echo"</td><td>\n"; 252 echo"<div class=\"form3\">\n"; 253 echo"<form action=\"index.php\" method=\"POST\" >\n"; 254 echo"<input type=\"radio\" name=\"datatosuppress\" value=\"1\" checked>".$language['one_year_data']."<br><br>\n"; 255 echo"<input type=\"radio\" name=\"datatosuppress\" value=\"2\">".$language['six_months_data']."<br><br>\n"; 256 echo"<input type=\"radio\" name=\"datatosuppress\" value=\"3\">".$language['one_month_data']."<br><br>\n"; 257 echo "<input type=\"hidden\" name =\"suppressdata\" value=\"1\">\n"; 258 echo "<input type=\"hidden\" name =\"navig\" value=\"6\">\n"; 259 echo "<input type=\"hidden\" name =\"validform\" value=\"24\">\n"; 260 echo"<input name='ok' type='submit' value='OK' size='20'>\n"; 261 echo"</form>\n"; 262 echo"</div>"; 263 echo"</td></tr></table>\n"; 264 echo"<p>".$language['data_human_suppress3']."</p>\n"; 265 } 266 else 267 { 268 echo"<h1>".$language['no_data']."</h1>"; 269 } 270 271 } 272 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Thu Sep 6 14:14:11 2007 | par Balluche grâce à PHPXref 0.7 |