Vote & Reward System

Results 1 to 3 of 3
  1. #1
    Apprentice 3dEo is offline
    MemberRank
    Dec 2012 Join Date
    6Posts

    information Vote & Reward System

    Hello people. I need secure vote and reward system. Can anyone share? I would be thankful.

    Thanks. -


  2. #2
    Am i? ScriptKid is offline
    MemberRank
    Oct 2006 Join Date
    $Location="??";Location
    1,810Posts

    Re: Vote & Reward System

    search it in release section mate

  3. #3
    if(!caffeine) continue; leorond is offline
    MemberRank
    Jul 2012 Join Date
    Czech RepublicLocation
    491Posts

    Re: Vote & Reward System

    Hello Try this and write how it went.

    <?
    if (isset($_POST['id_l']))
    {
    $id_l = $_POST['id_l'];
    if (!preg_match('/^[0-9]/i', $id_l))
    {
    exit();
    }
    $result = mssql_query("select id_l from ew_votelinks where id_l=$id_l");
    if (mssql_num_rows($result) > 0)
    {
    $ip_vote = $_SERVER['REMOTE_ADDR'];
    $result2 = mssql_query("select * from ew_votereward where username_id='$username_id' and link_id='$id_l'");
    if (mssql_num_rows($result2) > 0)
    {
    $myrow2 = mssql_fetch_array($result2);
    if ($real_time - $myrow2['vote_time'] <= $vote['vote_time'])
    {
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$vote['vote_time']+$myrow2['vote_time']);
    }
    else
    {
    $result3 = mssql_query("select * from ew_votereward where ip_address='$ip_vote' and link_id='$id_l'");
    if (mssql_num_rows($result3) > 0)
    {
    $myrow3 = mssql_fetch_array($result3);
    if ($real_time - $myrow3['vote_time'] <= $vote['vote_time'])
    {
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$vote['vote_time']+$myrow3['vote_time']);
    }
    else
    {
    mssql_query("update ew_votereward set vote_time='$real_time',ip_address='$ip_vote' where id_v='$myrow2[id_v]';
    update ew_credits set credits=credits+$vote[vote_credits] where memb___id='$username'");
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$real_time+$vote['vote_time']);
    $log_all = "Has vote for us on votelink $id_l";
    $insert_log = mssql_query("insert into EW_LOG (account,[index],credits,datetime) values ('$username','$log_all','$vote[vote_credits]','$date')");
    }
    }
    else
    {
    mssql_query("update ew_votereward set vote_time='".$real_time."',ip_address='$ip_vote' where id_v='$myrow2[id_v]';
    update ew_credits set credits=credits+$vote[vote_credits] where memb___id='$username'");
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$real_time+$vote['vote_time']);
    $log_all = "Has vote for us on votelink $id_l";
    $insert_log = mssql_query("insert into EW_LOG (account,[index],credits,datetime) values ('$username','$log_all','$vote[vote_credits]','$date')");
    }
    }
    }
    else
    {
    $result3 = mssql_query("select * from ew_votereward where ip_address='$ip_vote' and link_id='$id_l'");
    if (mssql_num_rows($result3) > 0)
    {
    $myrow3 = mssql_fetch_array($result3);
    if ($real_time - $myrow3['vote_time'] <= $vote['vote_time'])
    {
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$vote['vote_time']+$myrow3['vote_time']);
    }
    else
    {
    mssql_query("insert into ew_votereward (username_id,link_id,vote_time,ip_address) values ('$username_id','$id_l','$real_time','$ip_vote');
    update ew_credits set credits=credits+$vote[vote_credits] where memb___id='$username'");
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$real_time+$vote['vote_time']);
    $log_all = "Has vote for us on votelink $id_l";
    $insert_log = mssql_query("insert into EW_LOG (account,[index],credits,datetime) values ('$username','$log_all','$vote[vote_credits]','$date')");
    }
    }
    else
    {
    mssql_query("insert into ew_votereward (username_id,link_id,vote_time,ip_address) values ('$username_id','$id_l','$real_time','$ip_vote');
    update ew_credits set credits=credits+$vote[vote_credits] where memb___id='$username'");
    echo "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$real_time+$vote['vote_time']);
    $log_all = "Has vote for us on votelink $id_l";
    $insert_log = mssql_query("insert into EW_LOG (account,[index],credits,datetime) values ('$username','$log_all','$vote[vote_credits]','$date')");
    }
    }
    }
    else
    {
    echo "Vote Link Not Found";
    }
    exit();
    }
    ?>
    <script>
    var xmlhttp_vote = null;
    function vote_reward(url,id) {
    if(window.XMLHttpRequest){
    xmlhttp_vote=new XMLHttpRequest();
    if(xmlhttp_vote.overrideMimeType){
    xmlhttp_vote.overrideMimeType('text/xml');
    }
    } else if(window.ActiveXObject){
    try{
    xmlhttp_vote=new ActiveXObject("Msxml2.XMLHTTP");
    } catch(e) {
    try{
    xmlhttp_vote=new ActiveXObject("Microsoft.XMLHTTP");
    } catch(e){
    }
    }
    }

    if(!xmlhttp_vote) {
    alert('Your Browser don\'t support Ajax!');
    return false;
    }

    xmlhttp_vote.onreadystatechange = function() {
    if (xmlhttp_vote.readyState==4) {
    document.getElementById("vote_status"+id).innerHTML = xmlhttp_vote.responseText;
    }
    }

    xmlhttp_vote.open('POST',rootfolder+'getpage.php?cat=Vote-Reward');
    xmlhttp_vote.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');
    xmlhttp_vote.send(url);
    }
    </script>
    <?php
    include ("usernameaccess.php");
    echo "<script type=\"text/javascript\">document.getElementById(\"h4\").innerHTML = \"".vote_for_us."\"</script>
    <input type='hidden' id='module_contet' value='".vote_for_us."'>";
    echo "<table align=center border='0' cellpadding='0' cellspacing='2'>
    <tr class='top_table'>
    <td><b>".link_value."</b></td>
    <td colspan='2'><b>Status</b></td>
    </tr>";
    $result = mssql_query("select * from EW_VOTELINKS order by id_l desc");
    if (mssql_num_rows($result) > 0)
    {
    $ip_vote = $_SERVER['REMOTE_ADDR'];
    $myrow = mssql_fetch_array($result);
    do
    {
    $result2 = mssql_query("select * from ew_votereward where username_id='$username_id' and link_id='$myrow[id_l]'");
    if (mssql_num_rows($result2) > 0)
    {
    $myrow2 = mssql_fetch_array($result2);
    if ($real_time - $myrow2['vote_time'] <= $vote['vote_time'])
    {
    $status_vote = "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$vote['vote_time']+$myrow2['vote_time']);
    }
    else
    {
    $result3 = mssql_query("select * from ew_votereward where ip_address='$ip_vote' and link_id='$myrow[id_l]'");
    if (mssql_num_rows($result3) > 0)
    {
    $myrow3 = mssql_fetch_array($result3);
    if ($real_time - $myrow3['vote_time'] <= $vote['vote_time'])
    {
    $status_vote = "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$vote['vote_time']+$myrow3['vote_time']);
    }
    else
    {
    $status_vote = "<font colo=\"green\">You Can Vote Now</font>";
    }
    }
    else
    {
    $status_vote = "<font colo=\"green\">You Can Vote Now</font>";
    }
    }
    }
    else
    {
    $result3 = mssql_query("select * from ew_votereward where ip_address='$ip_vote' and link_id='$myrow[id_l]'");
    if (mssql_num_rows($result3) > 0)
    {
    $myrow3 = mssql_fetch_array($result3);
    if ($real_time - $myrow3['vote_time'] <= $vote['vote_time'])
    {
    $status_vote = "From your IP Address already vote.<br>You will be able to vote after ".date("d.m.Y G:i",$vote['vote_time']+$myrow3['vote_time']);
    }
    else
    {
    $status_vote = "<font colo=\"green\">You Can Vote Now</font>";
    }
    }
    else
    {
    $status_vote = "<font colo=\"green\">You Can Vote Now</font>";
    }
    }
    printf ("<tr class='contet_table' align='center'>
    <td><span onclick=\"vote_reward('id_l=%s',%s);\">%s</span></td>
    <td id='vote_status$myrow[id_l]'>%s</td>
    ", $myrow['id_l'], $myrow['id_l'], $myrow['link_string'], $status_vote);
    }
    while ($myrow = mssql_fetch_array($result));
    }
    echo "</table>";
    ?>
    And here is the SQL database. Tested MSSQL 2005.

    CREATE TABLE [dbo].[EW_VOTELINKS] (
    [id_l] [int] IDENTITY (1, 1) NOT NULL ,
    [link_string] [varchar] (1000) NOT NULL
    ) ON [PRIMARY]
    CREATE TABLE [dbo].[EW_VOTEREWARD] (
    [id_v] [int] IDENTITY (1, 1) NOT NULL ,
    [username_id] [int] NOT NULL ,
    [link_id] [int] NOT NULL ,
    [vote_time] [varchar] (15) NOT NULL ,
    [ip_address] [varchar] (15) NOT NULL
    ) ON [PRIMARY]
    Good luck



Advertisement