Script for add coin for vote

Results 1 to 1 of 1
  1. #1
    Enthusiast Peugeot is offline
    MemberRank
    Nov 2013 Join Date
    34Posts

    Script for add coin for vote

    I need your help for add this script in my website

    i need this script is link with my al_server_ls for aion server 4.0. thank you.

    in my account_data table i have : email, id, password, activated, acces_level, membership, old_membership, last_server, last_ip, last_mac, ip_force, expire, ip, reward_points, toll

    PHP Code:
    <html> 
        <head> 
            <title>Vote Now!</title> 
            <style> 
               body { background-color: #202020;  
                      color: yellow; 
                    }     
            </style> 
        </head> 
        <body> 
            <?php 
            
    // Report all PHP errors (see changelog) 
            
    error_reporting(E_ALL); 
                     
            
    //----------------------------------------------------------  
            // Give amount of coins 
            
    $coins 2
             
            
    // Yout website after vote was successfull 
            // Add http:// in your list 
            
    $webpage "http://localhost";//link to vote website 
             
            // Time needed to vote again 
            // You need to remove 1 minut from the time 
            // 720 should be 12hours 
            
    $time_needed "719"// in mintutes 
                         
            // Insert your MYSQL info here  
                
    $mysql = array(  
                
    'host' => "localhost",  
                
    'user' => "root",  
                
    'pass' => "mysqlrootpassword",  
                
    'db'   => "al_server_ls" // Do not change it the DB is vote 
                
    );  
                 
            
    //---DO NOT EDIT ANYTHING BELOW HERE UNLESS YOU KNOW WHAT YOU ARE DOING!! --- 
             
            
    function clean($str){ 
                return 
    is_array($str) ? array_map('clean'$str) : str_replace("\\""\\\\"htmlspecialchars((get_magic_quotes_gpc() ? stripslashes($str) : $str), ENT_QUOTES)); 
            } 
                      
            
    $mylink mysql_Connect($mysql['host'], $mysql['user'], $mysql['pass']); 
            
    mysql_select_db($mysql['db'],$mylink);  
            
    $ip getenv("REMOTE_ADDR"); 
            
    $httpref getenv ("HTTP_REFERER"); 
            
    $httpagent getenv ("HTTP_USER_AGENT"); 
            
    $account clean($_POST['account']); 
            
    $date date("Y-m-d G:i"); 
             
            if (empty(
    $account)){ 
             
                echo 
    '<SCRIPT LANGUAGE="JavaScript">alert("You didnt enter a account name! \n Please try again.")</script>'
                echo 
    "<script type='text/javascript'>window.location='votenow.php';</script>"

                 
            } elseif(!
    preg_match("/[0-9a-zA-Z]?/"$account)) { 
             
                echo 
    '<SCRIPT LANGUAGE="JavaScript">alert("Incorrect account name format. \n Please try again.")</script>'
                echo 
    "<script type='text/javascript'>window.location='votenow.php';</script>"
                    
                    } else { 

             
                        
    $result2 mysql_query("SELECT * FROM users WHERE account = '".$account."' OR ip='".$ip."' "); 
                        
    $row2 mysql_fetch_row($result2); 
                        
    $count2 mysql_num_rows($result2); 
                         
                        if(
    $count2 == 1){ 
                                 
                            
    $voted_ip $row2[2]; 
                            
    $voted_date $row2[3]; 
                            
    $voted_id $row2[0]; 
                            
    $voted_account $row2[1]; 
                            
    $to_time strtotime($voted_date); 
                            
    $from_time strtotime($date); 
                         
                            if (
    round(abs($to_time $from_time) / 60,2) > $time_needed) { 
                                 
                                
    $amount $coins;     
                                
    mysql_query("UPDATE users SET date = '".$date."' WHERE account = '".$account."' ");  
                                
    mysql_query("UPDATE points SET reward_points =reward_points+'".$coins."' WHERE account = '".$account."' ");                             
                                echo 
    '<SCRIPT LANGUAGE="JavaScript">alert("Thank you for you vote!")</script>'
                                echo 
    "<script type='text/javascript'>window.location='$webpage';</script>"
                                             
                            } else { 
                             
                                echo 
    '<SCRIPT LANGUAGE="JavaScript">alert("You cant vote anymore! \n Please try again later.")</script>'
                                echo 
    "<script type='text/javascript'>window.location='votenow.php';</script>"

                            } 
                             
                        } else { 
                            
    $amount $coins;     
                            
    $sql4 mysql_query("INSERT INTO users (account,ip,date) VALUES ('".$account."','".$ip."','".$date."' ) ");                          
                            
    mysql_query("INSERT INTO points (account,reward_points) VALUES ('".$account."','".$coins."')");                         
                            echo 
    '<SCRIPT LANGUAGE="JavaScript">alert("Thank you for you vote!")</script>'
                            echo 
    "<script type='text/javascript'>window.location='$webpage';</script>"
         
                        } 
                    }      
            
    mysql_close($mylink); 
           
    // mssql_close($mslink); 
            
    ?> 
        </body> 
    </html>
    Last edited by Peugeot; 10-01-14 at 02:52 PM.




Advertisement