How To Create A Random Counter?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    How To Create A Random Counter?

    Who help me?? Who can help me will receive 117 counters

    #2
    got a bunch load here should be something there for your needs

    Code:
    http://downloads.lavalair.net/Counters.zip

    Comment


      #3
      got a bunch load here should be something there for your needs

      Code:
      http://downloads.lavalair.net/Counters.zip
      [/b]
      Big thanx ! If you want counters like PM me

      Comment


        #4
        Look i have a script for counter with bars:
        counter.php file
        Code:
        <?php
        include("openDB.php");
        
        $date=date("Y/m/d");
        $a=mysql_query("select visits from counte where date=&#39;$date&#39;");
        $yra=mysql_fetch_array ($a, MYSQL_NUM);
        if(!$yra){
            mysql_query("insert into counte (id,visits,date) values (&#39;&#39;,&#39;1&#39;,&#39;$date&#39;)") or die("Klaida!");
            $today=1;}
            else{
                $today=$yra[0]+1;
                mysql_query("update counte set visits=&#39;$today&#39; where date=&#39;$date&#39;") or die("Klaida!");}
                $aha=mysql_query("select visits from counte");
                while($duom=mysql_fetch_array($aha, MYSQL_NUM)){
                    $total=$total+$duom[0];}
                    mysql_free_result($aha);
                    
        include("bar_graph1.php");
        $max=0;
        $a=mysql_query("select id,visits from counte ORDER BY date DESC limit 15");
        while($je=mysql_fetch_array($a)){
        $max1=$je[&#39;visits&#39;];
            if($max1>$max){
                $max=$max1;}
        }
                $height=29;
                $width=32;
                $x_interval=2;
                $y_interval=3;
                $font_size=2;
                $label_size=2;
                $scale=$max;
                $bar_width=1;
                $graph_title="";
                $font="arial.ttf";
        
                $graph_items=array();
                $graph_labels=array();
        $sk=0;
        $a=mysql_query("select visits from counte ORDER BY date DESC limit 15");
        while($je=mysql_fetch_array($a)){
                $sk++;
                $graph_items[$sk]=$je[&#39;visits&#39;];}
                
            $im = bar_graph($height, $width, $x_interval, $y_interval, $font_size,
                                $label_size, $scale, $bar_width, $graph_title, $font,
                                $graph_labels, $graph_items);
        
            mysql_close();
            $im = @imagecreatefromgif("counter.gif") or die ("Invalid Image!");
            $textc = imagecolorallocate($im, 250, 250, 250); 
            $line = imagecolorallocate($im, 10, 10, 10);
            
                    ImageLine($im,0,0,2,0,$line);
                    ImageLine($im,5,0,7,0,$line);
                    ImageLine($im,10,0,12,0,$line);
                    ImageLine($im,15,0,17,0,$line);
                    ImageLine($im,20,0,22,0,$line);
                    ImageLine($im,25,0,27,0,$line);
                    ImageLine($im,30,0,32,0,$line);
                    ImageLine($im,35,0,37,0,$line);
                    ImageLine($im,40,0,42,0,$line);
                    ImageLine($im,45,0,47,0,$line);
                    ImageLine($im,50,0,52,0,$line);
                    ImageLine($im,55,0,57,0,$line);
                    ImageLine($im,60,0,62,0,$line);
                    ImageLine($im,65,0,67,0,$line);
                    ImageLine($im,70,0,72,0,$line);
                    ImageLine($im,75,0,77,0,$line);
                    ImageLine($im,80,0,82,0,$line);
                    ImageLine($im,85,0,87,0,$line);
        
                    ImageLine($im,0,31,2,31,$line);
                    ImageLine($im,5,31,7,31,$line);
                    ImageLine($im,10,31,12,31,$line);
                    ImageLine($im,15,31,17,31,$line);
                    ImageLine($im,20,31,22,31,$line);
                    ImageLine($im,25,31,27,31,$line);
                    ImageLine($im,30,31,32,31,$line);
                    ImageLine($im,35,31,37,31,$line);
                    ImageLine($im,40,31,42,31,$line);
                    ImageLine($im,45,31,47,31,$line);
                    ImageLine($im,50,31,52,31,$line);
                    ImageLine($im,55,31,57,31,$line);
                    ImageLine($im,60,31,62,31,$line);
                    ImageLine($im,65,31,67,31,$line);
                    ImageLine($im,70,31,72,31,$line);
                    ImageLine($im,75,31,77,31,$line);
                    ImageLine($im,80,31,82,31,$line);
                    ImageLine($im,85,31,87,31,$line);
        
                    ImageLine($im,0,0,0,2,$line);
                    ImageLine($im,0,5,0,7,$line);
                    ImageLine($im,0,10,0,12,$line);
                    ImageLine($im,0,15,0,17,$line);
                    ImageLine($im,0,20,0,22,$line);
                    ImageLine($im,0,25,0,27,$line);
                    ImageLine($im,0,30,0,32,$line);
        
                    ImageLine($im,87,0,87,2,$line);
                    ImageLine($im,87,5,87,7,$line);
                    ImageLine($im,87,10,87,12,$line);
                    ImageLine($im,87,15,87,17,$line);
                    ImageLine($im,87,20,87,22,$line);
                    ImageLine($im,87,25,87,27,$line);
                    ImageLine($im,87,30,87,32,$line);
                    
                    
                
                if($total>=1 and $total<10){$kk1=80;}
                if($total>=10 and $total<100){$kk1=74;}
                if($total>=100 and $total<1000){$kk1=68;}
                if($total>=1000 and $total<10000){$kk1=62;}
                if($total>=10000 and $total<100000){$kk1=56;}
                if($total>=100000 and $total<1000000){$kk1=50;}
                if($total>=1000000 and $total<10000000){$kk1=44;}
                if($total>=10000000 and $total<100000000){$kk1=38;}
                if($total>=100000000 and $total<1000000000){$kk1=32;}
                if($total>=1000000000 and $total<10000000000){$kk1=26;}
        
                if($today>=1 and $today<10){$kk2=80;}
                if($today>=10 and $today<100){$kk2=74;}
                if($today>=100 and $today<1000){$kk2=68;}
                if($today>=1000 and $today<10000){$kk2=62;}
                if($today>=10000 and $today<100000){$kk2=56;}
                if($today>=100000 and $today<1000000){$kk2=50;}
                if($today>=1000000 and $today<10000000){$kk2=44;}
                if($today>=10000000 and $today<100000000){$kk2=38;}
                if($today>=100000000 and $today<1000000000){$kk2=32;}
                if($today>=1000000000 and $today<10000000000){$kk2=26;}
                
                
                ImageString($im, 2, $kk1, 3,  "$total", $textc);
                ImageString($im, 2, $kk2, 15, "$today", $textc);
                ImageString($im, 2, $kk2-6, 16, "+", $textc);
                ImageGif($im, "counter.gif");
        
                ImageDestroy($im);
           print "<img src=\"counter.gif\" alt=\"CipssY666 Counter\"/>
        ";
        
        ?>
        openDB.php
        Code:
        <?php
        $server="localhost"; ///cia standartas net neliesk
        $user="user"; ///duomenu bazes useris
        $pass="pass"; ///userio passwordas
        $dbname="counter"; ///duombzes wardas
        $sesDB = mysql_connect($server,$user,$pass);
        mysql_select_db($dbname);
        ?>
        bar_graph1.php
        Code:
        <?php
        include("openDB.php");
            function bar_graph($height, $width, $x_interval, $y_interval, $font_size,
                                $label_size, $scale, $bar_width, $graph_title, $font,
                                $graph_labels, $graph_items, $bg_color = "F0F0F0", 
                                $bar_color = "83B4D0",
                                $text_color = "000000")
            {
                $graph_height = 27;
                $graph_width = 32;    
                $scale_unit = $graph_height / $scale;
                
                    $im = @ImageCreate (88,32)
                    or die ("Cannot Initialize new GD image stream");
                    $bgc=ImageColorAllocate($im, 30,130,180);
                    $bgc1=ImageColorAllocate($im, 190,220,230);
            
                if(strlen($bg_color) == 6)
                {
                    $red = hexdec(substr($bg_color, 0, 2));
                    $green = hexdec(substr($bg_color, 2, 2));
                    $blue = hexdec(substr($bg_color, 4, 2));
                    $bg_color = ImageColorAllocate($im, $red, $green, $blue);                    
                }
                else
                {
                    $bg_color = ImageColorAllocate($im, 240, 240, 240);                            
                }
                if(strlen($text_color) == 6)
                {
                    $red = hexdec(substr($text_color, 0, 2));
                    $green = hexdec(substr($text_color, 2, 2));
                    $blue = hexdec(substr($text_color, 4, 2));
                    $text_color = ImageColorAllocate($im, $red, $green, $blue);                    
                }
                else
                {
                    $text_color = ImageColorAllocate($im, 0, 0, 0);                            
                }
        
                if(strlen($bar_color) == 6)
                {
                    $red = hexdec(substr($bar_color, 0, 2));
                    $green = hexdec(substr($bar_color, 2, 2));
                    $blue = hexdec(substr($bar_color, 4, 2));
                    $bar_color = ImageColorAllocate($im, $red, $green, $blue);                    
                }
                else
                {
                    $bar_color = ImageColorAllocate($im, 0, 0, 0);                            
                }
        
                
                // Stulpeliai
                for($i = 15; $i > 0; $i=$i-1)
                {
                    $start_x = (($x_interval + $bar_width) * $i);
                    $end_y = ($scale_unit * $graph_items[$i]);
                    
                    $end_y = $height - $end_y;
                    
                    $bar_points = array();
                    $bar_points[0] = $start_x;
                    $bar_points[1] = $height;
                    
                    $bar_points[2] = $start_x;
                    $bar_points[3] = $end_y;
                    
                    $bar_points[4] = $start_x + $bar_width;
                    $bar_points[5] = $end_y;    
                    
                    $bar_points[6] = $start_x + $bar_width;
                    $bar_points[7] = $height;
                    
                    ImageFilledPolygon ($im, $bar_points, 4, $bar_color);
        
                }
        
                ImageGIF($im,"117.gif");
                ImageDestroy($im);
            }
        ?>
        and the db tables
        Code:
        CREATE TABLE `counte` (
          `id` int(15) NOT NULL auto_increment,
          `visits` int(10) NOT NULL default &#39;0&#39;,
          `date` varchar(20) NOT NULL default &#39;&#39;,
          PRIMARY KEY  (`id`)
        ) TYPE=MyISAM AUTO_INCREMENT=1;

        I want to randomize the counter using a script i have installed the random script in http://ciprian.hyperphp.com/counter/image.jpg but when i try to put the image.jpg to randomize its don&#39;t work (I&#39;ve changed
        Code:
        $im = @imagecreatefromjpg("counter.jpg") or die ("Invalid Image!");
        and
        Code:
        ImageGif($im, "image.jpg.gif");
        
                ImageDestroy($im);
           print "<img src=\"image.jpg\" alt=\"CipssY666 Counter\"/>
        ";
        but don&#39;t work)

        Comment


          #5
          Who help me?? Who can help me will receive 117 counters[/b]
          please explain exactly what it is that you want because im confused ... ?

          do you want 117 different designs for a hit counter .. ?
          and then you will display the different designs randomly .. ?

          or do yo want to have a &#39;gallery&#39; of 117 counters for you to choose from .. ?

          Comment


            #6
            please explain exactly what it is that you want because im confused ... ?

            do you want 117 different designs for a hit counter .. ?
            and then you will display the different designs randomly .. ?

            or do yo want to have a &#39;gallery&#39; of 117 counters for you to choose from .. ?[/b]
            Yep i wanna to a randomly design on reloading

            Comment


              #7
              lol ... 117 is a bit of a random number but okay

              you best option is to create a database with the info in, then edit the huge list of counters that amylee posted before so that they match your database ..
              thats the only way i see this working lol

              good luck!! (youll need it )

              Comment

              Working...
              X