Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more

Go Back   Webmaster Forums - Webmaster forum for HTML, PHP, ASP, CSS and more > Web Programming > PHP Development
User Name
Password

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-27-2006, 09:56 PM   #1 (permalink)
borisbesner
Junior Member
 
borisbesner's Avatar
 
Join Date: Aug 2006
Posts: 32
Default Vote system with images

Hi, I need help to do a vote system with images!
This site haves one, a stars ranking system, I'm that its simple but i need a code or a file to do it please.
__________________
VideNoche.com
borisbesner is offline   Reply With Quote
Sponsored Links
Old 12-24-2006, 02:04 PM   #2 (permalink)
weber
Junior Member
 
weber's Avatar
 
Join Date: Dec 2006
Posts: 40
Default Re: Vote system with images

****THIS POST HAS BEEN EDITED BY O~SNAPPLE PLEASE USE THE CORRECT TAGS WHEN POSTING CODE****
Paste this code to your file it generates columns in different colors
PHP Code:
<?php
header
("Content-type: image/jpeg");
include 
"config.php";
$query "SELECT * FROM votes;";
$res mysql_query($query);
$n mysql_num_rows($res);
 
//$n=10;
$width 10*25+220;
$height 200+30;
$h $height+$n*20+30;
$x0 0;
$y0 0;

$qanak = array($n);
 for (
$i=0$i<$n$i++) {
 
$rows mysql_fetch_array($res);
  
$qanak[$i] = $rows['qanak'];

}
// drawing graphic

$im = @imagecreate($width$h)
   or die(
"Cannot Initialize new GD image stream");
$background_color imagecolorallocate($im255255255);
$textcolor imagecolorallocate($im00255);

$cols = array($n);
 for (
$i=0$i<$n$i++) {
 
$cols[$i] = imagecolorallocate($imrand(0,255), rand(0,255), rand(0,255));
}
//  Frame  st
imagerectangle($im,$x0,$y0,$width-1,$height-1,250);
// Frame  end
// arancq st
imageline($im,$x0+15,$y0+15,$x0+15,$height-31,250);
imageline($im,$x0+15,$height-31,$width-1,$height-31,250);
// arancq end
for ($t=20;$t<($height-31);$t+=10)
{
imageline($im,$x0+15,$t,$width-1,$t,250);
}
$y2 $height-32;
 for (
$i=0$i<$n$i++)
{
  
$x1 = ($i+1)*25;
  
$y1 200-$qanak[$i];
  
$x2 $x1+20;
  
imagerectangle($im,$x1,$y1,$x2,$y2,125);
  
imagefilledrectangle($im,$x1+1,$y1+1,$x2-1,$y2-1,$cols[$i]);
  
imagestring($im,3,($i+1)*25,$height-20,$qanak[$i], $textcolor);
}
// drawing initials
drawInit($im,$height,$width,$cols,$n);
function 
drawInit($im,$height,$w,$cols,$n)
{
$h $height+$n*30;
$hp 20;
$wp 60;

$query "SELECT * FROM votes;";
$res mysql_query($query);
$sum 0;
$opt = array($n);
$opt_qan = array($n);
 for (
$i=0$i<$n$i++) {
 
$rows mysql_fetch_array($res);
 
$opt[$i] = $rows['name'];
 
$opt_sum[$i] = $rows['qanak'];
 
$sum += $rows['qanak'];
}
imagerectangle($im,0,$height,$w-1,$h-1,125);
$x 15;
$y $height+10;
 for (
$i=0$i<$n$i++)
  {
  
imagefilledrectangle($im,$x,$y,$x+60,$y+20,$cols[$i]);
  
imagestring($im,3,$x+60+20,$y,$opt[$i]." ".round($opt_sum[$i]/($sum/100),1)." %"$cols[$i]);
  
$y+=20;
  }
}
imagejpeg($im);

imagedestroy($im);

?>
weber is offline   Reply With Quote
Old 12-27-2006, 12:21 PM   #3 (permalink)
pr0gr4mm3r
Junior Member
 
Join Date: Sep 2006
Location: Behind You
Posts: 12
Default Re: Vote system with images

This might be what you are looking for...

Masuga Design » Unobtrusive AJAX Star Rating Bar
__________________
Life would be easier if I had the source code.
pr0gr4mm3r is offline   Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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

Points Per Thread View: 1.00
Points Per Thread: 11.00
Points Per Reply: 5.00



» Sponsors

» Links

» Affiliates
Web Hosting
Online Backup Reviews
Marketing Find
Merchant Select
SiteMap Builder
Host Compare
Dedicated Servers

» Links

» Sports Network
Paintball Forum
Football Forum
Hockey Forum
Golf Forum
Boxing Forum
Lacrosse Forum
Baseball Forum
SnowBoarding Forum
Soccer Forum
MMA Forum


All times are GMT -4. The time now is 04:34 PM.



LinkBacks Enabled by vBSEO 3.0.0 RC8
Webmaster Forums