vote.php

02/15/2013 23:24 Sintiax#1
Hallo, bräuchte nun auch mal Hilfe xD
Wenn man die Seite aufruft, komm Seiten ladenfehler.

Code:
<?php 

// Einstellungen



$dbhost = 'meineserverip';    //mySQL IP

$dbuser = 'root';       //mySQL Username

$dbpassword = 'meinpw';   //mySQL Passwort

$database = 'meinehpdb';       //mySQL Datenbank



$coins = '100';               //Menge an Coins pro Vote

$wartezeit = '8';             //Wartezeit in Stunden





$s1 = 'http://www.topliste.****************/in/1285-iceworld2-de.html';      //Vote Seite 1

$s2 = 'http://www.*******************/vote-IceWorlt.htm';      //Vote Seite 2

$s3 = 'www.google.de/3';      //Vote Seite 3

$s4 = 'www.google.de/4';      //Vote Seite 4

$s5 = 'www.google.de/5';      //Vote Seite 5









// Einstellungen Ende





//Ab hier NICHTS mehr verändern!



$conn = mysql_connect($dbhost, $dbuser, $dbpassword) or die ('mySQL Connecting Error'); 

mysql_select_db($database); 

$ip = $_SERVER['REMOTE_ADDR']; 

$site = $_POST['site'];



$website = array(1, $s1, $s2, $s3, $s4, $s5);





if($site) {

$wartezeit = $wartezeit * 3600;

$time = time();

$earnedpoints = false; 

$account = $_POST['name']; 

$account = mysql_real_escape_string($account); 







if ($account == "") { 

    echo 'Enter your AccountID!'; 

    exit(); 

} 





$query = mysql_query("SELECT *, SUM(`times`) as amount FROM vote WHERE account='$account' OR ip='$ip'"); 

$lasttime = mysql_fetch_array($query); 

$amount = $lasttime['amount']; 

$insertnew = false;     

if ($amount == "") { 

    $insertnew = true; 

} 

$timecalc = $time - $lasttime['Site' . $site]; 

if (!$insertnew) { 

    if ($timecalc < $wartezeit) {  

        

        echo '<html>

<head>

<title>Vote for Coins</title>

</head>

<body background="bg.jpg" text="grey" link="#0000CC" vlink="#000066" alink="#000000">

<h1>Vote for Us!</h1>';

        echo ' Hallo '. $account .' Du hast bereits mit diesem Account: ('. $account .') oder deiner IP: ('. $ip .') in den letzten ' . $wartezeit / 3600 . ' Stunden bereits gevotet.!'; 

        echo ' <br><br>Letzter Vote am: '. date('M d\, h:i:s A', $lasttime['Site' . $site]) .''; 

        echo '<html>'; 

        echo '<head>'; 

        echo '</head>'; 

        echo '<body>'; 

        echo '</body>'; 

        echo '</html>'; 

        exit(); 

    } else {                 

        $update = mysql_query("UPDATE vote SET account='$account', Site" . $site . "='$time', times=times+1 WHERE ip='$ip'"); 

            if (!$update) { 

                $message  = 'Invalid query: ' . mysql_error() . "\n"; 

                $message .= 'Whole query: ' . $update; 

                die($message); 

            } else { 

                $earnedpoints = true; 

            } 

        } 

} else { 

    $success = mysql_query("INSERT INTO vote (`account`, `ip`, `Site" . $site . "`, `times`) VALUES ('$account', '$ip', '$time', 1)"); 

    if (!$success) { 

            $message  = 'Invalid query: ' . mysql_error() . "\n"; 

            $message .= 'Whole query: ' . $success; 

            die($message); 

    } else { 

        $earnedpoints = true; 

    } 

} 









if ($earnedpoints) { 

    $points = mysql_query("UPDATE account.account SET coins = coins + " . $coins . " WHERE login='$account'");                

    if (!$points) { 



            $message  = 'Invalid query: ' . mysql_error() . "\n"; 

            $message .= 'Whole query: ' . $query; 

            die($message); 

    } 

    mysql_close($conn);

    header("Location: http://" . $website[$site] . "");

    exit();

 

} else { 

    echo 'There was an error processing your request.'; 

    exit(); 

} 



}

?>







<html>

<head>

<title>Vote for Coins</title>

</head>

<body background="bg.jpg" text="grey" link="#0000CC" vlink="#000066" alink="#000000">

<h1>Vote for Us!</h1>

<center>

<font color="grey"><i>Du bekommst Pro Vote: <?php echo $coins; ?> Coins und du kannst alle <?php echo $wartezeit;?> Stunden voten.<br>

<br>Du kannst auf jeder Seite einmal Voten! </i><br /> </font>

<form action="" method="POST">

<table cellspacing=1 cellpadding=5>

<tr>

<td class=list><input type="radio" name="site" value="1"> Vote 1</td>

<td class=list><input type="radio" name="site" value="2"> Vote 2</td>

<td class=list><input type="radio" name="site" value="3"> Vote 3</td>

<td class=list><input type="radio" name="site" value="4"> Vote 4</td>  

<td class=list><input type="radio" name="site" value="5"> Vote 5</td>    

</tr>

</table>





<table cellspacing=1 cellpadding=5>

<tr><td class=list align=right><font size="5"><b>AccountID:</b></font></td><td class=list><input type=text name=name maxlength="15"></td></tr> 

<tr><td class=listtitle align=center colspan=2><input type="image" src="vote.png" alt="Absenden"></td></tr> 

</form> 

</table> 

</center> 

</body>

</html>
Bei Google chrome kommt das:
Ups! Google Chrome konnte http nicht finden.
02/15/2013 23:30 .KingDarkness#2
Das Problem hatte ich mal, warte ich such dir kurz die Linkwahl aus.


€: [Only registered and activated users can see links. Click Here To Register...]

So müsste das funktionieren

Und benutz lieber ein anderes Votescript, die hat ein Bug und der kann ausgenutzt werden um mehrmals zu voten.

Hier:

PHP Code:
<div id="content_top">
Vote 4 Coins
</div>
<div id="content_main">
<div style="width:480px;">
<font color="white">
<?

if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
    
    
/*
     * Vote Page
     */
    
$VotePage "http://www.topliste.****************/In/8000-darknight2-de.htm";
    
    
/*
     * Check if User can vote
     */
    
$VoteLinkClick             trim(mysql_real_escape_string(@$_REQUEST['f']));
    
$EnableVotePage            true;
    
$ShowMSG                false;
    
$SuccessMSG                "";
    
    
$CheckPlayerVotes_SQL        "SELECT * FROM account.account_votes WHERE account_id = '".$_SESSION['user_id']."'";
    
$CheckPlayerVotes_Query        mysql_query($CheckPlayerVotes_SQL);
    
$CheckPlayerVotes_Result    mysql_fetch_array($CheckPlayerVotes_Query);
    
    
/*
     * Insert Player's Vote-Log in account_votes, if non-existent
     */
    
if( $CheckPlayerVotes_Result['account_id'] != $_SESSION['user_id'] or empty($CheckPlayerVotes_Result['account_id']) ) {
        
$Account_AddVoteEntry        "INSERT INTO account.account_votes 
                                            (account_id, last_vote_at, votes_given, coins_received, new_vote_at) 
                                        VALUES 
                                            ('"
.$_SESSION['user_id']."', '0', '0', '0', '0')";
        
        @
mysql_query($Account_AddVoteEntry);
    }

    
mysql_free_result($CheckPlayerVotes_Query);
    
$CheckPlayerVotes_Query        mysql_query($CheckPlayerVotes_SQL);
    
$CheckPlayerVotes_Result    mysql_fetch_array($CheckPlayerVotes_Query);
    
    
/*
     * Check if User has an entry in our Vote-Log Table
     */
    
if( $CheckPlayerVotes_Result['account_id'] == $_SESSION['user_id'] ) {
        
        
/*
         * Initialize Voting variables
         */    
        
$Player_LastVoteAt            $CheckPlayerVotes_Result['last_vote_at'];
        
$Player_VotesGiven            $CheckPlayerVotes_Result['votes_given'];
        
$Player_CoinsReceived        $CheckPlayerVotes_Result['coins_received'];
        
$Player_NewVoteAt            $CheckPlayerVotes_Result['new_vote_at'];
        
$TimeNow                    time();
        
        
/*
         * Check if IP is already logged and can vote
         */
        
$IPCheck                    false;
        
        
$PlayerIP                    $_SERVER['REMOTE_ADDR'];
        
$PlayerIPCheck_SQL            "SELECT * FROM account.account_vote_ip WHERE ip = '$PlayerIP'";
        
$PlayerIPCheck_Query        mysql_query($PlayerIPCheck_SQL);
        
$PlayerIPCheck_Result         mysql_fetch_array($PlayerIPCheck_Query);
        
$VoteExpire                    $PlayerIPCheck_Result['vote_expire'];
        
        if( 
mysql_num_rows($PlayerIPCheck_Query) <= ) {
            
$InsertIPLogEntry_SQL    "INSERT INTO account.account_vote_ip (ip, vote_expire) VALUES ('$PlayerIP', '0')";
            
$InsertIPLogEntry_Query    mysql_query($InsertIPLogEntry_SQL);
            
$VoteExpire 0;
        } 
        
        if( 
$TimeNow >= $VoteExpire ) {
            
$IPCheck true;
        } else {
            
$IPCheck false;
        }
        
        
/*
         * Check if Player is allowed to vote
         */
        
if( $TimeNow >= $Player_NewVoteAt and $IPCheck == true ) {
            
            
/*
             * Check if User has clicked on the Link
             */
            
if( $VoteLinkClick == true and $IPCheck == true ) {
                
                
/*
                 * Initialize new Vote-Log entry
                 */
                
$VoteBonusCoins        100;
                
$NewVoteAt_Time        $TimeNow 60*60*24;
                
$LastVoteAt_Time    $TimeNow;
                
$Player_VotesGiven    += 1;
                
$NewCoinsAmount        $Player_CoinsReceived $VoteBonusCoins;
                
                
$NewVoteLog_SQL        "UPDATE account.account_votes
                                          SET last_vote_at = '
$LastVoteAt_Time',
                                                votes_given = '
$Player_VotesGiven', 
                                                coins_received = '
$NewCoinsAmount',
                                                new_vote_at = '
$NewVoteAt_Time'
                                        WHERE account_id = '"
.$_SESSION['user_id']."'";
                
                
$IPLog_SQL             "UPDATE account.account_vote_ip 
                                          SET vote_expire = '
$NewVoteAt_Time
                                        WHERE ip = '
$PlayerIP'";
                
                
/*
                 * Initialize Player Coins + Bonus for Voting
                 */
                
$GetPlayerCoins_SQL        "SELECT coins FROM account.account WHERE id = '".$_SESSION['user_id']."'";
                
$GetPlayerCoins_Query    mysql_query($GetPlayerCoins_SQL);
                
$GetPlayerCoins_Result    mysql_fetch_array($GetPlayerCoins_Query);
                
                
$PlayerCoins            $GetPlayerCoins_Result['coins'] + 500;
                
                
$PlayerNewCoins_SQL    "UPDATE account.account 
                                          SET coins = 
$PlayerCoins 
                                        WHERE id = '"
.$_SESSION['user_id']."'";
                
                
/*
                 * Update Database entries
                 */
                
mysql_query($NewVoteLog_SQL);
                
mysql_query($PlayerNewCoins_SQL);
                
mysql_query($IPLog_SQL);
                
                
$EnableVotePage        false;
                
$ShowMSG            true;
                
$SuccessMSG            .= "Du wirst in kürze deine Coins erhalten, sobald du gevoted hast.<br>";
                
                
/*
                 * Redirect User to Vote Page
                 */
?>
<script type="text/javascript" language="javascript">
<!--
window.location.href = '<? echo $VotePage?>';
//-->
</script>
<?
                
exit;
            } else {
                
$EnableVotePage     true;
            }
        } else {
            
$EnableVotePage false;
        }
    }

    if( 
$EnableVotePage == true ) {
?>

<p class="meldung">
    Für jeden Vote bekommst du eine Gutschrift von DEINE COINS Coins. <br>
    Missbrauch dieser Funktion wird ein permanenter Bann zur folge haben! <br>
</p>
<p>Um voten zu können, klicke auf dem folgenden link:</p>
<br>
<a href="<? echo $_SERVER['PHP_SELF']; ?>?s=vote&f=true"><img src="./img/vote.png" alt="Vote 4 Coins"></a>
<?
    
} else {
        if( 
$ShowMSG == true ) {
            echo 
"<p>$SuccessMSG</p>";
        } else {
            echo 
"<p>Du kannst nur alle 24 Stunden voten!</p>";
            echo 
"<br>";
            if( 
$Player_NewVoteAt ) {
                echo 
"<div align=\"center\">Du kannst wieder um "date("d.m.Y H:i:s"$Player_NewVoteAt) ." Server Zeit voten.</div>";
            }
        }
    }
} else {
    echo
'<p class="meldung">Das Voten steht nur angemeldeten Spielers zur verfügung.</p>';
}

?>
 </div>
</div>
<div id="content_footer"><br><br>
</div>
Ich weiß aber nicht ob du was an der Datenbank machen musst.
02/15/2013 23:31 Sintiax#3
Währe sehr nett wenn du mir helfen könntest :)
02/15/2013 23:31 Yiv#4
Lass mal "http://" weg und mach nur den Link "www....".

MfG
02/15/2013 23:34 Sintiax#5
Quote:
Originally Posted by Perση View Post
Lass mal "http://" weg und mach nur den Link "www....".

MfG
:handsdown:
Geht danke, ich depp auch :awesome:
kann closed werden =)
02/15/2013 23:36 .KingDarkness#6
Les den Edit von meinem Beitrag bitte ist wichtig wegen einem Bug^^
02/15/2013 23:38 Sintiax#7
Achso öhm kannst mal skype annehmen? :)
02/16/2013 00:25 [SA]Ice#8
PHP Code:
<font color="white">
<?

if(isset($_SESSION['user_admin']) && checkInt($_SESSION['user_admin']) && $_SESSION['user_admin']>=0) {
    
    
/*
     * Vote Page
     */
    
$VotePage "http://www.*******************/vote-knasti1.htm";
    
    
/*
     * Check if User can vote
     */
    
$VoteLinkClick             trim(mysql_real_escape_string(@$_REQUEST['f']));
    
$EnableVotePage            true;
    
$ShowMSG                false;
    
$SuccessMSG                "";
    
    
$CheckPlayerVotes_SQL        "SELECT * FROM account.account_votes WHERE account_id = '".$_SESSION['user_id']."'";
    
$CheckPlayerVotes_Query        mysql_query($CheckPlayerVotes_SQL);
    
$CheckPlayerVotes_Result    mysql_fetch_array($CheckPlayerVotes_Query);
    
    
/*
     * Insert Player's Vote-Log in account_votes, if non-existent
     */
    
if( $CheckPlayerVotes_Result['account_id'] != $_SESSION['user_id'] or empty($CheckPlayerVotes_Result['account_id']) ) {
        
$Account_AddVoteEntry        "INSERT INTO account.account_votes 
                                            (account_id, last_vote_at, votes_given, coins_received, new_vote_at) 
                                        VALUES 
                                            ('"
.$_SESSION['user_id']."', '0', '0', '0', '0')";
        
        @
mysql_query($Account_AddVoteEntry);
    }

    
mysql_free_result($CheckPlayerVotes_Query);
    
$CheckPlayerVotes_Query        mysql_query($CheckPlayerVotes_SQL);
    
$CheckPlayerVotes_Result    mysql_fetch_array($CheckPlayerVotes_Query);
    
    
/*
     * Check if User has an entry in our Vote-Log Table
     */
    
if( $CheckPlayerVotes_Result['account_id'] == $_SESSION['user_id'] ) {
        
        
/*
         * Initialize Voting variables
         */    
        
$Player_LastVoteAt            $CheckPlayerVotes_Result['last_vote_at'];
        
$Player_VotesGiven            $CheckPlayerVotes_Result['votes_given'];
        
$Player_CoinsReceived        $CheckPlayerVotes_Result['coins_received'];
        
$Player_NewVoteAt            $CheckPlayerVotes_Result['new_vote_at'];
        
$TimeNow                    time();
        
        
/*
         * Check if IP is already logged and can vote
         */
        
$IPCheck                    false;
        
        
$PlayerIP                    $_SERVER['REMOTE_ADDR'];
        
$PlayerIPCheck_SQL            "SELECT * FROM account.account_vote_ip WHERE ip = '$PlayerIP'";
        
$PlayerIPCheck_Query        mysql_query($PlayerIPCheck_SQL);
        
$PlayerIPCheck_Result         mysql_fetch_array($PlayerIPCheck_Query);
        
$VoteExpire                    $PlayerIPCheck_Result['vote_expire'];
        
        if( 
mysql_num_rows($PlayerIPCheck_Query) <= ) {
            
$InsertIPLogEntry_SQL    "INSERT INTO account.account_vote_ip (ip, vote_expire) VALUES ('$PlayerIP', '0')";
            
$InsertIPLogEntry_Query    mysql_query($InsertIPLogEntry_SQL);
            
$VoteExpire 0;
        } 
        
        if( 
$TimeNow >= $VoteExpire ) {
            
$IPCheck true;
        } else {
            
$IPCheck false;
        }
        
        
/*
         * Check if Player is allowed to vote
         */
        
if( $TimeNow >= $Player_NewVoteAt and $IPCheck == true ) {
            
            
/*
             * Check if User has clicked on the Link
             */
            
if( $VoteLinkClick == true and $IPCheck == true ) {
                 
                
/*
                 * Initialize new Vote-Log entry
                 */
                
$VoteBonusCoins        250;
                
$NewVoteAt_Time        $TimeNow 60*60*6;
                
$LastVoteAt_Time    $TimeNow;
                
$Player_VotesGiven    += 6;
                
$NewCoinsAmount        $Player_CoinsReceived $VoteBonusCoins;
                
                
$NewVoteLog_SQL        "UPDATE account.account_votes
                                          SET last_vote_at = '
$LastVoteAt_Time',
                                                votes_given = '
$Player_VotesGiven', 
                                                coins_received = '
$NewCoinsAmount',
                                                new_vote_at = '
$NewVoteAt_Time'
                                        WHERE account_id = '"
.$_SESSION['user_id']."'";
                
                
$IPLog_SQL             "UPDATE account.account_vote_ip 
                                          SET vote_expire = '
$NewVoteAt_Time
                                        WHERE ip = '
$PlayerIP'";
                
                
/*
                 * Initialize Player Coins + Bonus for Voting
                 */
                
$GetPlayerCoins_SQL        "SELECT coins FROM account.account WHERE id = '".$_SESSION['user_id']."'";
                
$GetPlayerCoins_Query    mysql_query($GetPlayerCoins_SQL);
                
$GetPlayerCoins_Result    mysql_fetch_array($GetPlayerCoins_Query);
                
                
$PlayerCoins            $GetPlayerCoins_Result['coins'] + 250;
                
                
$PlayerNewCoins_SQL    "UPDATE account.account 
                                          SET coins = 
$PlayerCoins 
                                        WHERE id = '"
.$_SESSION['user_id']."'";
                
                
/*
                 * Update Database entries
                 */
                
mysql_query($NewVoteLog_SQL);
                
mysql_query($PlayerNewCoins_SQL);
                
mysql_query($IPLog_SQL);
                
                
$EnableVotePage        false;
                
$ShowMSG            true;
                
$SuccessMSG            .= "Du wirst in kürze deine Coins erhalten, sobald du gevoted hast.<br>";
                
                
/*
                 * Redirect User to Vote Page
                 */
?>
<script type="text/javascript" language="javascript">
<!--
window.location.href = '<? echo $VotePage?>';
//-->
</script>
<? 
                
exit;
            } else {
                
$EnableVotePage     true;
            } 
        } else { 
            
$EnableVotePage false;
        } 
    } 

    if( 
$EnableVotePage == true ) {
?>

<p class="meldung">
    Für jeden Vote bekommst du eine Gutschrift von 250 Coins. <br>
    Missbrauch dieser Funktion wird ein permanenter Bann zur folge haben! <br>
</p>
<p>Um voten zu können, klicke auf dem folgenden link: 
<a href="<? echo $_SERVER['PHP_SELF']; ?>?s=vote&f=true">Vote!</a></p>
<?
    
} else {
        if( 
$ShowMSG == true ) {
            echo 
"<p>$SuccessMSG</p>";
        } else {
            echo 
"<p>Du kannst nur alle 24 Stunden voten!</p>";
            echo 
"<br>";
            if( 
$Player_NewVoteAt ) {
                echo 
"<div align=\"center\">Du kannst wieder um "date("d.m.Y H:i:s"$Player_NewVoteAt) ." Server Zeit voten.</div>";
            }
        }
    }
} else {
    echo
'<p class="meldung">Das Voten steht nur angemeldeten Spielers zur verfügung.</p>';
}

?>
das ist das script was ich nehme in anhang für daten bank die tabellen musste in ftp ein fügen
02/16/2013 02:47 Sintiax#9
Danke habe aber schon :)
Kann clsd werden :)
03/21/2015 14:28 Ammigo35#10
Ice Nice !