2014-03-12 103 views
-2
<?php 
session_start(); 
include_once "incfiles/connectdb.php"; 
include_once "incfiles/func.php"; 
$page="gamepoints.php"; 
logincheck(); 
$username=$_SESSION['username']; 
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM accounts WHERE username='$username'")); 

if ($_GET['item']){ 

$item=strip_tags($_GET['item']); 

if ($item == "LHP"){ $cost="50"; $amount="10000"; } 
elseif ($item == "FMJ"){ $cost="70"; $amount="15000"; } 
elseif ($item == "rankpoints"){ $cost="150"; $amount="10000"; } 
elseif ($item == "awp"){ $cost="300"; $amount="1"; } 
elseif ($item == "credits"){ $cost="50"; $amount="10"; } 
elseif ($item == "money"){ $cost="300"; $amount="5000000"; } 

從if if($ item ==「LHP」)到最後是什麼顯示在我的網頁上,隨着頁面,我似乎無法找出爲什麼一行代碼顯示以及網頁

+1

這真的是你的代碼的複製/粘貼? –

+1

你確定這只是代碼?你有沒有做'查看源代碼'來查看其餘的php是否?請記住,如果php代碼泄漏到客戶端,那麼'<?'將被瀏覽器解釋爲無效的HTML標記。 –

+0

@SakhalTurkaystan如果文檔只是PHP代碼,不推薦使用'?>'。它會導致很多問題。 –

回答

0

不知道這是否是你的所有代碼 - 如果是,看起來你可能會錯過最後的}

<?php 
    session_start(); 
    include_once "incfiles/connectdb.php"; 
    include_once "incfiles/func.php"; 

    $page="gamepoints.php"; 

    logincheck(); 

    $username=$_SESSION['username']; 
    $fetch=mysql_fetch_object(mysql_query("SELECT * FROM accounts WHERE username='$username'")); 

    if ($_GET['item']){ 
     $item=strip_tags($_GET['item']); 

     if ($item == "LHP"){ $cost="50"; $amount="10000"; } 
     elseif ($item == "FMJ"){ $cost="70"; $amount="15000"; } 
     elseif ($item == "rankpoints"){ $cost="150"; $amount="10000"; } 
     elseif ($item == "awp"){ $cost="300"; $amount="1"; } 
     elseif ($item == "credits"){ $cost="50"; $amount="10"; } 
     elseif ($item == "money"){ $cost="300"; $amount="5000000"; } 
    } 
相關問題