Register for your free account! | Forgot your password?

You last visited: Today at 23:41

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Scriptfehler

Discussion on Scriptfehler within the Metin2 Private Server forum part of the Metin2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 93
Received Thanks: 2
Question Scriptfehler

shop
PHP Code:
<?php
session_start 
();

    if(
$_SESSION['id'] == "") {
        include(
'inc/login.php'); }
        else {
        
        
$coins $_SESSION['coins'];
        
echo 
"
<center>
Hey, " 
$_SESSION['id'] . " <br><br> Deine Coins: " $_SESSION['coins'] . "  <a href=\"coins.php\">Aufladen!</a><br><br>
<table border=\"0\">
<tr><th width=\"200\">Bild</th><th width=\"200\">Name</th><th width=\"200\">Preis</th><th width=\"200\">Kaufen</th></tr>
</table>"
;
    include(
'inc/config.php');
        
mysql_select_db('account');
        
    
$section "SELECT * from itemshop";
        
$query mysql_query($section);
        
            echo 
"<table border=\"0\">";
                while(
$fetch mysql_fetch_object($query)) {
echo 
"<tr><th width=\"200\"><img src=\"http://www.elitepvpers.com/forum/images/items/$fetch->id.gif\"></th><th width=\"200\"><font color=\"black\">$fetch->name</font></th><th width=\"200\"><font color=\"black\">$fetch->price</font></th><th width=\"200\"><font color=\"black\"><a href=\"shop/shopbuy.php?id=$fetch->id\">Kaufen!</a></font></th></tr>";
}
echo 
"</table></center><br>";
}
?>
shop buy
PHP Code:
<?php
session_start 
();

    if(
$_SESSION['id'] == "") {
        die(
'Logge dich bitte ein!');
    }
    else {
    
    include(
'../inc/config.php');
        
mysql_select_db('account');
        
        
$getuser "SELECT * from account where login = '" $_SESSION['id'] . "'";
            
$checkuser mysql_query($getuser);
                
$num mysql_num_rows($checkuser);
            
        if(
$num 0) {
        
            
$array mysql_fetch_array($checkuser);
    
            
$itemid $_GET['id'];
            
$user $_SESSION['id'];
            
$coins $_SESSION['coins'];
                        
                    
                    
            
$check "SELECT * from itemshop where id = '" $itemid "'";
                
$query mysql_query($check);
                    
$num mysql_num_rows($query);
            if(
$num 0) {
                
$array2 mysql_fetch_array($query);
            
$rescash $array['coins'] - $array2['price'];
                        
        if(
$num && $rescash 0) {
                
mysql_select_db('player');
            
$i 0;    
        
$giveitem "INSERT INTO item SET owner_id = '" $array['id'] . "', window = 'MALL', pos = '" $_SESSION['pos'] . "', count = '1', vnum = '" $itemid "', socket0 = '0', socket1 = '0', socket2 = '0'";
            
$result mysql_query($giveitem);
            
                if(
$result) {
                
                
                if(
$_SESSION['pos'] == '42') {
                 
                 
$_SESSION['pos'] = '0'; }
                 else { 
$_SESSION['pos'] = $_SESSION['pos'] + 1; }
                 
                    
mysql_select_db('account');
                    
                        
$cashresult $array['coins'] - $array2['price'];
                    
                    
$coins "UPDATE account set coins = '" $cashresult "' where login = '" $_SESSION['id'] . "'";
                        
$coinsresult mysql_query($coins);
                        
                    if(
$coinsresult) {
                    
$_SESSION['coins'] = $cashresult;
                    
                    echo 
"<center>Du hast erfolgreich ein/e " $array2['name'] . " gekauft! <br>
                    Du wirst in 3 Sekunden weitergeleitet.
                    <meta http-equiv=\"refresh\" content=\"3;url=../shop.php\">"
;
                    } else {
                    echo 
"Kaufen fehlgeschlagen.";
                    }
                
                }
                else { echo 
"Kaufen fehlgeschlagen."; }
                
            } else { echo 
"Du hast zu wenig Coins."; }
            
        } else { echo 
"Kaufen fehlgeschlagen."; }
        
    } else { echo 
"Bitte logge dich ein."; }

    }

?>
Bei mir auf der HP Ist nur das Bild dann 2 spalten frei (unter name und preis) und dann Kaufen ich habe in der db alles einegegeben
thegladiator1996 is offline  
Reply




All times are GMT +2. The time now is 23:41.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.