Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1

Thread: Voting Help

  1. #1
    Member
    Join Date
    Nov 2002
    Location
    Elmira, NY
    Posts
    41
    Member #
    261
    I have this flat file voting script that I have used for sometime now. I like it and it does what I need. But the time has come to make it a db based script. I found it on evil walrus like 3 years ago and have used it ever since.

    http://www.neonsonline.com/rateit/index.php?rateit=11

    is an example. and this example above is a cobbled up way of doing it php and hate it its all the variables called from a config file not a db and its a pain to update.

    i am redoing parts of my site

    http://www.neonsonline.com/nom/main.php?page=1

    http://www.neonsonline.com/nom/nom.php?id=23

    if you notice on the second link there is a spot for feedback. well i used to have a poll linked from IBF but didnt like it so today i started putting this whole section of my site into a db to make it easier to maintain. and i need to make a vote script an wanna use this one if possible but would like to have it in a db. I was wondering if anyone would be willing to convert this to php and mysql for me????

    each NOM has an id # like 1-23 so far. so it would be nice if say NOM id# 20 had id # 20 in the voting db.

    if anyone would help me out i would be willing to give them a small hosting package for a year for free. all the features at http://echoterra.com with say 100mb of space and 2gb of bandwidth with no ads or anything. and the ability to host a domain or use a subdomain of ours. if you are interested the code is below. just get it done and email it to me at mbennett@echoterra.com and your hosting package will be set up asap.


    PHP Code:
    <?  

    $ficdest
    =explode(".",$rate_it_id); 
    $ficdest=$ficdest[0].".dat"

    if(
    file_exists($ficdest)) { 
         
    $compteur=fopen($ficdest"r"); 
         
    $old_stats=file($ficdest); 
         
    $stats=explode("|"$old_stats[0]); 
         
    fclose($compteur); 
         
    $new_count=$stats[0]; 
         if (
    $stats[3] != $REMOTE_ADDR) { 
             
    $new_count +=1
         } 
         
    $ip_hit=$REMOTE_ADDR
         
    $compteur=fopen($ficdest"w"); 
         
    fputs($compteur"$new_count|$stats[1]|$stats[2]|$ip_hit|$stats[4]"); 
         
    fclose($compteur); 

    else { 
         
    $nouveau_compteur=fopen($ficdest"w"); 
         
    fputs($nouveau_compteur"1|||$REMOTE_ADDR|"); 
         
    fclose($nouveau_compteur); 


    if (!empty(
    $envoi)) { 
         
    $vote=fopen($ficdest"r"); 
         
    $old_stats=file($ficdest); 
         
    $stats=explode("|"$old_stats[0]); 
         
    fclose($vote); 
         
    $nbr_votes=$stats[1]; 
         
    $moy_votes=$stats[2]; 
         if (
    $stats[4] != $REMOTE_ADDR) { 
             
    $nbr_votes +=1
             
    $moy_votes=((($stats[1]*$stats[2])+$note)/$nbr_votes); 
         } 
    else { echo 
    "<br><font face=Verdana size=2 color=#FF0000>You have already voted</font>"; } 
         
    $ip_vote=$REMOTE_ADDR
         
    $vote=fopen($ficdest"w"); 
         
    $new_stats=fputs($vote"$new_count|$nbr_votes|$moy_votes|$stats[3]|$ip_vote"); 
         
    fclose($vote); 


    print (
    "<form method=post>"); 
    $old_stats=file($ficdest); 
    $stats=explode("|"$old_stats[0]); 
    print (
    "<font size=1 face=Verdana color=$text_color>Hits: $new_count | Votes: $stats[1] | Average vote: "); 
    if (!empty(
    $stats[2])) { printf("%.1f"$stats[2]); } 
    print (
    "&nbsp;&nbsp; <input type=hidden name=envoi value=1><input type=submit value=Vote>"); 
    print (
    "&nbsp;<select name=note>"); 
    for (
    $i=1$i<=10$i++) { 
        print (
    "<option value=$i>$i"); 

    print (
    "</select></form></font>"); 

    ?>

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 12:34 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com