Xtreeme Top100 Vote System with Postback
credits: RougAsFuck
Config
Vote Module
Post Back Module
SQL
credits: RougAsFuck
Config
PHP:
<?php
//Vote Config for Xtreme Top 100 by r00tme
//The PostBack is still beta but in working order (will be improved in future with more detailed PostBack)
//To have postback option activated you have to pay 15$ monthly
//Once you activate it must setup your postback link to get it works (XtreemBack.php)
if (end(explode("/", $_SERVER['PHP_SELF'])) == basename(__FILE__)) {
exit;
}
$username = $_SESSION['username']; // Setup your session
$xtreem_id = 1132349885; // MuPlayring ID - You must change it!
$vote_credits = 1; // Колко кредита да дава нормално
$vote_timing = 86400; // Гласуване на 24 часа (секунди)
//===================================================================================
$credits_table = '[Memb_Credits]'; // Име на таблицата за кредити
$credits_column = '[credits]'; // Име на колонката за кредити
$credits_user = '[memb___id]'; // Име на потребител за кредити
$cr_vote_count = '[vote_credits]'; // Тук Събира кредитите получени от Вотване
//==================================================================================
// Connection Setup /////////////////////////////////////////////////////////////////
$db_serv = 'localhost'; // Server IP (Hostname/Pc-name)
$db_user = 'user'; // SQL Username
$db_pass = 'pass'; // SQL Password
$db_name = 'MuOnline'; // DataBase Name
$connect = mssql_connect($db_serv, $db_user, $db_pass);
mssql_select_db('Muonline');
/////////////////////////////////////////////////////////////////////////////////////
Vote Module
PHP:
<?php
include ('XtreemeConfig.php');
echo "<div class='bahtidobriq1' style='margin-top:20px;padding:10px 10px;text-align:center;'>";
$query1 = mssql_fetch_array(mssql_query("Select date from voting where username ='".$username."'"));
$timeind = $starts."<div style='display:inline; color:white;font-size:9pt;font-weight:600;text-shadow:1px 1px #000;'id ='countdown'>
<script>
var target_date = new Date( ".$query1['date']." * 1000).getTime() ;
var days, hours, minutes, seconds;
var countdown = document.getElementById('countdown');
setInterval(function () {
var color = '#B9FF73';
var current_date = new Date().getTime();
var seconds_left = (target_date - current_date) / 1000;
days = parseInt(seconds_left / 86400);
seconds_left = seconds_left % 86400;
hours = parseInt(seconds_left / 3600);
seconds_left = seconds_left % 3600;
minutes = parseInt(seconds_left / 60);
seconds = parseInt(seconds_left % 60);
if (days > 0) {
countdown.innerHTML = days + ' d ' + hours + ' h '
+ minutes + ' m ' + seconds + ' s ';
}
if (days < 1) {
countdown.innerHTML = hours + ' h '
+ minutes + ' m ' + seconds + ' s';
}
if (hours < 1) {
countdown.innerHTML = minutes + ' m ' + seconds + ' s';
}
if (minutes < 1 ) {
countdown.innerHTML = seconds + ' s';
}
if (seconds_left < 30) {
countdown.innerHTML = '<font color='+ color +'>' + seconds + ' s ';
}
if (seconds_left <= 0) {
countdown.innerHTML = '<font color='+ color +'> You Can Vote again!!';
}
}, 1000);</script></div>".$stops;
$is_voted = mssql_fetch_array(mssql_query ("Select * from voting where username='".$username."' "));
$current_time = time();
$user_time = $is_voted['date'];
if (isset($_POST['submit'])){
if ($current_time > $user_time){
mssql_query("Delete from [voting] where [username] = '".$username."'");
header ("Location:http://www.xtremetop100.com/in.php?site=".$xtreem_id."&postback=".$username."&custom=".$username."");
}
else {
echo "You can vote after ".$timeind."";
}
}
if ($current_time > $user_time){
echo "<font size='2' color='BDBDAE'>You can vote to get free credits *(Only for Xtreme100)</font>";
}
else{
echo "<font size='2' color='#BDBDAE'>You can vote again after</font> ".$timeind."";}
echo "</div>";
?>
<form method='post' action=''>
<input type='image' style='cursor:pointer' src="http://www.xtremeTop100.com/votenew.jpg" border="0" alt="private server"/>
<input type='hidden' name='submit'/>
</form>
Post Back Module
PHP:
<?php
include ('XtreemeConfig.php');
//You have to secure your GET
$usernames = $_GET['postback'];
$usernames = $_GET['custom'];
$date = time();
$timing = $date + $option['vote_timing'];
$ip = $_GET['votingip'];
mssql_query ("Insert into vote_logs ([id],[account],[ip],[credits], [date]) values ('Xtreem100','".$usernames."','".$ip."','".$vote_credits."', '".$date ."')");
mssql_query ("Insert into Voting ([username],[ip], [date]) values ('".$usernames."','".$ip."', '".$timing ."')");
$curent_credits = mssql_fetch_row(mssql_query("SELECT * FROM ".$credits_table ." WHERE ".$credits_user."='{$usernames}'"));
$creditsa = $curent_credits[1];
if ($creditsa > 0) {
mssql_query("UPDATE ".$credits_table ." SET ".$credits_column." = ".$credits_column."+{$vote_credits}, ".$cr_vote_count." = ".$cr_vote_count."+1 WHERE "$credits_user"='{$usernames}'");
} else {
mssql_query("INSERT INTO ".$credits_table ." (".$credits_user.", ".$credits_column.",".$cr_vote_count.") VALUES('{$usernames}', '{$vote_credits}','1')");
}
?>
SQL
PHP:
CREATE TABLE [dbo].[vote_logs](
[id] [varchar](max) NULL,
[credits] [int] NOT NULL CONSTRAINT [DF_vote_logs_credits] DEFAULT ((0)),
[votes] [int] NOT NULL CONSTRAINT [DF_vote_logs_votes] DEFAULT ((0)),
[account] [varchar](max) NULL,
[ip] [varchar](50) NULL,
[date] [int] NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
CREATE TABLE [dbo].[voting](
[username] [varchar](50) NULL,
[ip] [varchar](50) NULL,
[date] [int] NULL
) ON [PRIMARY]
GO
Last edited: