Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function vote() {
- if($_GET['vote'] == "link1")
- {
- $Module = addslashes($_POST['module']);
- $Account = addslashes($_POST['account']);
- $To = addslashes($_POST['to']);
- $Ip = $_SERVER['REMOTE_ADDR'];
- //$Con = mysql_connect(sql_host,sql_user,sql_pass);
- //mysql_select_db(Cmsdb);
- $mysql = new mysqli($this->game_host,$this->game_user,$this->game_pw);
- $mysql->set_charset("utf8");
- $id = $mysql->real_escape_string($_SESSION['ID']);
- //redirect
- echo "<meta http-equiv=refresh content=0;URL='{$To}'>";
- //check that the module exists
- if($mysql->result($mysql->query("SELECT COUNT(*) FROM au_server_ls.vote_links WHERE id='{$Module}'"),0) != 1)
- return;
- //check if the user or account has been accredited for a vote within the last 12 hrs.
- if($mysql->result($mysql->query("SELECT COUNT(*) FROM au_server_ls.votes WHERE module='{$Module}' AND account = '{$_SESSION['name']}'"),0) != 0)
- return;
- //set cookie
- $time = time()+12*60*60;
- //add vote to timeout
- $mysql->query("INSERT INTO au_server_ls.votes VALUES ('','{$Ip}','{$_SESSION['name']}','{$Module}','{$time}')");
- if(isset($mysql)) {
- $mysql->close();
- }
- //$Con = mysql_connect(sql_host,sql_user,sql_pass);
- //mysql_select_db(Logindb);
- $mysql = new mysqli($this->game_host,$this->game_user,$this->game_pw);
- // +1 vote point
- if($_SESSION['account'] == $Account)
- {
- (int)$_SESSION['points']+= 1; //RPPV1
- }
- $mysql->query("UPDATE au_server_ls.account_data SET credits = credits + ".RPPV1." WHERE name='{$_SESSION['name']}'");
- if(isset($mysql)) {
- $mysql->close();
- }
- }
- else {
- $mysql = new mysqli($this->game_host,$this->game_user,$this->game_pw);
- $mysql->set_charset("utf8");
- $id = $mysql->real_escape_string($_SESSION['ID']);
- $mysql->query("DELETE FROM au_server_ls.votes WHERE time < ".(time()-12*60*60));
- $result = $mysql->query("SELECT * FROM au_server_ls.vote_links WHERE id=1");
- while($Row = $result->fetch_array()) {
- $r = $mysql->query("SELECT v.time FROM au_server_ls.votes AS v INNER JOIN au_server_ls.account_data AS a ON v.account = a.`name` WHERE v.module = 1 AND v.account = '$id'");
- if(!$R = $r->fetch_array()) {
- $time = "Du kannst jetzt Voten!";
- }
- else {
- $Expiretime = (int)$R['time'] + (12*60*60);
- $Until = $Expiretime - time();
- $time = ceil($Until/60/60);
- }
- if($time == 1) {
- $time = "".$time." Stunde warten!";
- }
- elseif($time > 1) {
- $time = "".$time." Stunden warten!";
- }
- $this->content .= '<form action="index.php?s=account&v=vote" target="'.$Row['name'].'" method="post">
- <input name="module" type="hidden" value="'.$Row['id'].'" />
- <input name="to" type="hidden" value="'.$Row['url'].'" />
- <FORM METHOD="LINK" ACTION="index.php?s=account&v=vote">
- <INPUT ALT="Click to Vote" title="Click to Vote!" TYPE="image" src="'.$Row['image'].'" name="account" VALUE="'.$id.'">
- </FORM>
- <br>
- <b>AGCoins: <b>'.$Row['reward_points'].'<br><b>'.$time.'</b>
- <br>
- </form>';
- if(isset($mysql)) {
- $mysql->close();
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment