Thread Rating:
  • 45 Vote(s) - 3.73 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Not Solved Script to Update Plugins for 1.6.5
#91
Not Solved
Would you make it compatible with be 1.6.5

thax
<?php
/**
 * MyBBSayac 1.0 For MyBB 1.6*
 * Copyright ® 2009 DeLLy
 *
 * Website: http://www.tufyta.com
 *
 */
// Disallow direct access to this file for security reasons
if(!defined("IN_MYBB"))
{
	die("Direct initialization of this file is not allowed.<br /><br />Please make sure IN_MYBB is defined.");
}

$plugins->add_hook("global_start", "istatistik_tut");
$plugins->add_hook('admin_tools_action_handler', 'mybbsayac_dosyasi'); 
$plugins->add_hook('admin_tools_menu', 'mybbsayac_tools'); 

function mybbsayac_info()
{
    global $lang;
    $lang->load("tools_mybbsayac");
	return array(
		"name"			=> "<img border=\"0\" src=\"../inc/plugins/mybbsayac/mybbsayac.gif\"> MyBB Sayaç Eklentisi",
		"description"	=> $lang->mybbsayac_desc,
		"website"		=> "http://www.mybb.com.tr",
        "author"        => "DeLLy",
		"authorsite"	=> "http://www.tufyta.com",
		"version"		=> "1.0",
		"guid" 			=> "",
		"compatibility" => "16*"
	);
}

function mybbsayac_install() 
    {
        global $db;
        //Ziyaretçi Tablosunu Oluşturuyoruz
        $db->query("CREATE TABLE `".TABLE_PREFIX."sayac_ziyaretciler` (
        `id` int(255) NOT NULL auto_increment,
        `ip` varchar(50) NOT NULL,
        `useragent` varchar(250) NOT NULL,
        `date` date NOT NULL,
        `time` datetime NOT NULL,
        `timestamp` int(50) NOT NULL,
        `referer` varchar(255) NOT NULL,
        `lastpage` varchar(255) NOT NULL,
         PRIMARY KEY  (`id`)
         ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0");
         // Anahtar Kelime Tablosunu Oluşturuyoruz.
        $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_kelimeler` (
        `id` int(11) NOT NULL auto_increment,
        `tarih` date NOT NULL,
        `kelime` varchar(250) NOT NULL,
        `aranma` int(11) NOT NULL default '1',
        `toparanma` int(11) NOT NULL default '1',
        PRIMARY KEY  (`id`)
        )ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=0;");
        //Referans Site Tablosunu Oluşturuyoruz.
       $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_siteler` (
       `id` int(11) NOT NULL auto_increment,
       `tarih` date NOT NULL,
       `site` varchar(250) NOT NULL,
       `aranma` int(11) NOT NULL default '1',
       `toparanma` int(11) NOT NULL default '1',
       PRIMARY KEY  (`id`)
       ) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=125 ;");
       //Tarih Hit Tablosunu Oluşturuyoruz.
      $db->query ("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_tarih_hit` (
      `id` int(11) NOT NULL auto_increment,
      `tarih` date NOT NULL,
      `tekil` int(11) NOT NULL,
      `hit` int(11) NOT NULL,
      PRIMARY KEY  (`id`)
      ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=0;");
     $db->query("CREATE TABLE IF NOT EXISTS `".TABLE_PREFIX."sayac_ip2con` (
     `fromip` bigint(12) NOT NULL default '0',
     `toip` bigint(12) NOT NULL default '0',
     `ccode` char(2) NOT NULL default '',
     `cname` varchar(50) NOT NULL default ''
     ) ENGINE=MyISAM DEFAULT CHARSET=utf8;"); 
    $ip2con=file("../inc/plugins/mybbsayac/ip2con.sql");
    //Ülke IP aralıklarının Kayıtlı Olduğu Sql DOsyasını İçeri Aktarıyoruz.
    foreach($ip2con AS $line) {
        $line=str_replace("ip2con","".TABLE_PREFIX."sayac_ip2con",$line);
    $db->query($line);
    }
    }

function mybbsayac_is_installed() 
    {
        global $db;
        if ($db->table_exists("sayac_ziyaretciler")) 
        {
        return true;
        }
        return false;
}

function mybbsayac_uninstall() 
    {
        global $db;
    $db->query("DROP TABLE IF EXISTS `".TABLE_PREFIX."sayac_ziyaretciler`, `".TABLE_PREFIX."sayac_tarih_hit`, `".TABLE_PREFIX."sayac_siteler`, `".TABLE_PREFIX."sayac_ip2con`, `".TABLE_PREFIX."sayac_kelimeler`");
    }
    
    function mybbsayac_tools($ref) {
        global $lang;
        $lang->load("tools_mybbsayac");
        $ref[] = array("id" => "mybbsayac", "title" => $lang->mybbsayac, "link" => "index.php?module=tools_mybbsayac");
   }
   
   function mybbsayac_dosyasi($ref) {
       // Plugini Tek Klasorde Vermek istediğim için boyle bişey yapmak zorundaydım :)
       //I want give plugin in a one folder for easyly installing (:
   $ref['mybbsayac'] = array('active' => 'mybbsayac', 'file' =>'../../../inc/plugins/mybbsayac/mybbsayac.php');
   }
    
    function istatistik_tut () {
        global $db;
    function tekniktemizlik($gelen) 
        {
            $gelen=stripslashes($gelen);
            $gelen=mysql_real_escape_string($gelen);
            return $gelen;
        }

function kelimebuls($agent) {
    $ref=$agent;
    $ref = str_replace("aq","",$ref);
    $ref = str_replace("oq","",$ref);
    $query_string = false;   
    $querystruct = array();
    $querystruct[] = array("google.", "q", "Google");
    $querystruct[] = array("ask.com", "q", "Ask.com");
    $querystruct[] = array("ask.co.uk", "ask", "Ask.co.uk");
    $querystruct[] = array("comcast.net", "q", "Comcast");
    $querystruct[] = array("yahoo", "p", "Yahoo");
    $querystruct[] = array("aol.com", "query", "AOL");
    $querystruct[] = array("msn.com", "q", "MSN");
    $querystruct[] = array("live.com", "q", "Live.com");
    $querystruct[] = array("netscape.com", "query", "Netscape");
    $querystruct[] = array("netzero.net", "query", "NetZero");
    $querystruct[] = array("altavista.com", "q", "Altavista");
    $querystruct[] = array("mywebsearch.com", "searchfor", "Mywebsearch");
    $querystruct[] = array("alltheweb.com", "q", "Alltheweb");
    $querystruct[] = array("cnn.com", "query", "CNN");
    $querystruct[] = array("myspace.com", "q", "MySpace");
    
    for($i=0,$size=sizeof($querystruct);$i<$size;$i++){
        if (stristr($ref,$querystruct[$i][0]) ) {
            $symbol = $querystruct[$i][1];
            $temp1 = explode("$symbol=",$ref,2);
            $temp2 = explode("&",$temp1[1]);
            $string = $temp2[0];
            $query_string =urldecode($string);
        }
    }
    return $query_string;
}

$ip         =tekniktemizlik($_SERVER['REMOTE_ADDR']);
$referer    =tekniktemizlik($_SERVER['HTTP_REFERER']);
$loca       =tekniktemizlik($_SERVER['REQUEST_URI']);
$useragent  =tekniktemizlik($_SERVER['HTTP_USER_AGENT']);
$bugun=date('d-m-Y');
$time=time()+300;

$gunsor=$db->query("SELECT *FROM ".TABLE_PREFIX."sayac_tarih_hit WHERE tarih='$bugun'");
$gunsay=$db->num_rows($gunsor);

if($gunsay=="0") 
    {
        $db->query("INSERT INTO ".TABLE_PREFIX."sayac_tarih_hit (tarih) VALUES (now())");
    }

    $ipsor=$db->query("SELECT ip FROM ".TABLE_PREFIX."sayac_ziyaretciler WHERE ip='$ip' AND date='$bugun'");
    $ipsay=$db->num_rows($ipsor);
if ($ipsay=="0") 
    {
        $db->query("INSERT INTO ".TABLE_PREFIX."sayac_ziyaretciler (ip,useragent,date,time,timestamp,referer,lastpage) VALUES ('$ip','$useragent',now(),now(),'$time','$referer','$loca')");
        $db->query("UPDATE ".TABLE_PREFIX."sayac_tarih_hit SET tekil=tekil+1,hit=hit+1 WHERE tarih='$bugun'");
    
        $bugun=date("Y-m-d");
        $kelime=kelimebuls($referer);
if ($kelime) 
    {
        $kelimesay=$db->query("SELECT *FROM ".TABLE_PREFIX."sayac_kelimeler WHERE kelime='$kelime' AND tarih='$bugun'");
        $varmi=$db->num_rows($kelimesay);
    if ($varmi<1) 
        {
            $db->query("INSERT INTO ".TABLE_PREFIX."sayac_kelimeler (tarih,kelime) VALUES (now(),'$kelime')");
            }
            else 
            {
                $db->query("UPDATE ".TABLE_PREFIX."sayac_kelimeler SET aranma=aranma+1 WHERE kelime='$kelime' AND tarih='$bugun'");
                $db->query("UPDATE ".TABLE_PREFIX."sayac_kelimeler SET toparanma=toparanma+1 WHERE kelime='$kelime'"); 
            }
    }

    $refparse=parse_url($referer);
    $site=$refparse[host];
    if ($site)  
        {
            $sitesay=$db->query("SELECT *FROM ".TABLE_PREFIX."sayac_siteler WHERE site='$site' AND tarih='$bugun'");
            $sitevarmi=$db->num_rows($sitesay);
    if ($sitevarmi<1) 
        {
            $db->query("INSERT INTO ".TABLE_PREFIX."sayac_siteler (tarih,site) VALUES (now(),'$site')");
            }else 
            {
                $db->query("UPDATE ".TABLE_PREFIX."sayac_siteler SET aranma=aranma+1 WHERE site='$site' AND tarih='$bugun'");
                $db->query("UPDATE ".TABLE_PREFIX."sayac_siteler SET toparanma=toparanma+1 WHERE site='$site'"); 
                }
                }
                }
                else {
                    $db->query("UPDATE ".TABLE_PREFIX."sayac_ziyaretciler SET timestamp='$time',useragent='$useragent',lastpage='$loca' WHERE ip='$ip' AND date='$bugun'");
                    $db->query("UPDATE ".TABLE_PREFIX."sayac_tarih_hit SET hit=hit+1 WHERE tarih='$bugun'");
                    } 
                    }
?>


Messages In This Thread
Script to Update Plugins for 1.6.5 - by pavemen - 2011-11-28, 05:47 AM
RE: Script to Update Plugins for 1.6.5 - by alv4 - 2011-12-03, 03:00 PM
RE: Script to Update Plugins for 1.6.5 - by lexy - 2011-12-07, 07:39 PM
RE: Script to Update Plugins for 1.6.5 - by lexy - 2011-12-07, 08:08 PM
RE: Script to Update Plugins for 1.6.5 - by lexy - 2011-12-15, 03:31 PM
RE: Script to Update Plugins for 1.6.5 - by lexy - 2011-12-15, 04:44 PM
RE: Script to Update Plugins for 1.6.5 - by lexy - 2011-12-25, 10:30 AM
RE: Script to Update Plugins for 1.6.5 - by lexy - 2011-12-25, 05:42 PM
RE: Script to Update Plugins for 1.6.5 - by 007combatant - 2012-06-04, 06:55 AM

Forum Jump:


Users browsing this thread: 1 Guest(s)