Jump to content

Recommended Posts

Well im making a text based mafia and my admin control panel isnt working.. it has to fetch the userlevel from the database for you to see dont know if thats the problem but i just shows a blank page..

 

 

Menu.php

<?php



session_start();



include "includes/db_connect.php";



include "includes/functions.php";



logincheck();



$username=$_SESSION['username'];



$viewuser=$_GET['viewuser'];







$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));



?><head>



<script language="javascript">















function Ismell (){



var del = confirm("Are you sure you want to log out?");



if (del == true){



	var loc = "index.php?logout=yes";



	parent.top.location.href=loc;



}



}



function Toggle(item) {



   obj=document.getElementById(item);



   visible=(obj.style.display!="none")



   key=document.getElementById("x" + item);



   if (visible) {



     obj.style.display="none";



   } else {



      obj.style.display="block";



   }



}



</script>















<link rel=stylesheet href=includes/in.css type=text/css>















<title>Underground Gangsters</title>

<table width="100%" height="1081" border="0" align=top cellpadding="0" cellspacing="2">

  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"> 



            <div align="center"><strong>Control Panels</strong> </div></div></td>



        </tr>



    



    



        <?php if ($fetch->userlevel = "2"){

echo "

  <tr> 

    <td><a href=\"admin/AdminCP.php\" target=\"middle\">»Admin CP</a></td>

  <tr>";

}

?> 



       </tr>



        <table width="100%" height="1081" border="0" align=top cellpadding="0" cellspacing="2">

  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"> 



            <div align="center"><strong>Main</strong> </div></div></td>



        </tr>



        <tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="updates.php" target="middle"><span class="style3">»</span>Site 



            Updates</a></td>

<tr>

        </tr>



<tr> 



        <tr> 



          <td  onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="online.php" target="middle"><span class="style3">»</span>Gangsters 



            Online</a></td>



        <tr> 



          <td  onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="paper.php" target="middle"><span>»</span>The International</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="poll/index.php" target="middle"><span class="style3">»</span>Poll</a></td>



        </tr>



        <tr> 



          <td  onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="crew.php" target="middle"><span class="style3">»</span>Your 



            Crew</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="search.php" target="middle"><span class="style3">»</span>Find 



            Gangster</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="fly.php" target="middle"><span class="style3">»</span>Airport</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="kill.php" target="middle"><span class="style3">»</span>Kill</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="buy.php" target="middle"><span class="style3">»</span>The 



            Underground</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="sell.php" target="middle"><span class="style3">»</span>Sell</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="auctions.php" target="middle"><span class="style3">»</span>Internet 



            Auctions</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="hitlist.php" target="middle"><span class="style3">»</span>Most 



            Wanted</a></td>







        <tr> 





          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="staff.php" target="middle"><span class="style3"></span>»Staff</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="countrys.php" target="middle"><span class="style3">»</span>Countries</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="attempt.php" target="middle"><span class="style3">»</span>Attempts</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="jail.php" target="middle"><span class="style3">»</span>Jail</a> 



          </td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="rest.php" target="middle"><span class="style3">»</span>Restaurant</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="bar.php" target="middle"><span class="style3">»</span>The 



            bar</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="hospital.php" target="middle"><span class="style3">»</span>The 



            Hospital</a></td>



        </tr>

        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="safe.php" target="middle"><span class="style3">»</span>Safe 



            House</a></td>



        </tr>



      </table></td>



  </tr>



  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td align="center" background="includes/grad.jpg"><div align="center">Messages 



            </div></td>



        </tr>



        <tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="inbox.php" target="middle"><span class="style3">»</span>Inbox</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="saved.php" target="middle"><span class="style3">»</span>Saved</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="send.php" target="middle"><span class="style3">»</span>Send 



            message</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="forum_frame.php?forum=main" target="middle"><span class="style3">»</span>Main 



            Forum</a></td>



        </tr>



<?php //        <tr> 



        //  <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



          //  <a href="includes/javchat/" target="_PARENT"><span class="style3">»</span>Irc 



            //Chat</a></td>



        //</tr> ?>



        <?php if ($fetch->crew != "0"){ echo "  <tr> <td> <a href=forum_frame.php?forum=crew target=middle>»Crew Forum</a><br></td>



  </tr>"; } ?>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="ticket.php" target="middle"><span class="style3">»</span>Helpdesk</a></td>



        </tr>



      </table></td>



  </tr>



  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"><div align="center">Crime 



              scene</div></td>



        </tr>



        <tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="bf.php" target="middle"><span class="style3">»</span>Ammo 



            Hut</a> </td>





        </tr>



        <tr> 







<tr>		

	          

          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="partner.php" target="middle"><span class="style3">»</span>Parntners</a></td>



</tr>



<tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="jack.php" target="middle"><span class="style3">»</span>Car 



            Jack</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="drugs.php" target="middle"><span class="style3">»</span>Drugs</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="crime.php" target="middle"><span class="style3">»</span>Crimes</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="bank.php" target="middle"><span class="style3">»</span>Bank</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="swiss.php" target="middle"><span class="style3">»</span>Swiss 



            Bank</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="mission.php" target="middle"><span class="style3">»</span>Missions</a></td>



        </tr>



      <?php ///  <tr> 



          ///<td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            //<a href="orgcrime.php" target="middle"><span class="style3">»</span>Oc</a></td>



        //</tr>?>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="Oc_2.php" target="middle"><span class="style3">»</span>Getaway</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="ext.php" target="middle"><span class="style3">»</span>Extortion</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="arm.php" target="middle"><span class="style3">»</span>Boxing Club</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="bribe.php" target="middle"><span class="style3">»</span>Bribery</a></td>



        </tr>



       <?php // <tr> 



          //<td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            //<a  target="middle"><span class="style3">»</span>Turf</a></td>



        //</tr> ?>



	<tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="crews.php" target="middle"><span class="style3">»</span>Crews</a></td>



        </tr>



      </table></td>



  </tr>



  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"><div align="center">Cars 



            </div></td>



        </tr>



        <tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="garage.php" target="middle"><span class="style3">»</span>Garage</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="car_race.php" target="middle"><span class="style3">»</span>Street 



            race</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="depot.php" target="middle"><span class="style3">»</span>The 



            Depot</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="dealership.php" target="middle"><span class="style3">»</span>Dealership</a></td>



        </tr>



      </table></td>



  </tr>



  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"><div align="center">Casino 



            </div></td>



        </tr>



        <tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="rps.php" target="middle"><span class="style3">»</span>R 



            P S</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="slots.php" target="middle"><span class="style3">»</span>Slots</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="race.php" target="middle"><span class="style3">»</span>Race 



            Track</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="lotto.php" target="middle"><span class="style3">»</span>Lottery</a></td>



        </tr>

      </table></td>



  </tr>

<tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"><div align="center">Calling Center	 



            </div></td>



        </tr>



        <tr>



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"><a href="betaal2.php" target="middle"><span class="style3">»</span> 



            Bullets</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="betaal.php" target="middle"><span class="style3">»</span>Money</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="betaal3.php" target="middle"><span class="style3">»</span>Buildings</a></td>



        </tr>

        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="otherc.php" target="middle"><span class="style3">»</span>Paying from other countrys</a></td>



        </tr>

        

      </table></td>



  </tr>

  

  

  <tr> 



    <td><table width="100%" border="1" cellpadding="2" cellspacing="0" bordercolor="#000000">



        <tr> 



          <td background="includes/grad.jpg"> <div align="center">Your 



              Profile </div></td>



        </tr>



<tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="user.php" target="middle"><span class="style3">»</span>Edit profile 



           </a></td>



        </tr>

        

        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="baf.php" target="middle"><span class="style3">»</span>Edit friends</a></td>



        </tr>





        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="you_stats.php" target="middle"><span class="style3">»</span>Your 



            Stats</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="items.php" target="middle"><span class="style3">»</span>Your 



            items</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="notes.php" target="middle"><span class="style3">»</span>Note Pad</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="main.php" target="middle"><span class="style3">»</span>Main</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="faq.php" target="middle"><span class="style3">»</span>Faq</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="stats.php" target="middle"><span class="style3">»</span>Statistics</a> 



          </td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="referral.php" target="middle"><span class="style3">»</span>Referral 



            Prog</a></td>



        </tr>



        <tr> 



          <td onmouseover="this.style.background='#b90606';this.style.cursor='hand';" onmouseout="this.style.background='';"> 



            <a href="logout.php"><span class="style3">»</span>Logout</a></td>



        </tr>



      </table></td>



  </tr>



</table>



<div id="menu1"></div>







AdminCP.php

<?php
session_start();
include "includes/db_connect.php";
include "includes/functions.php";
logincheck();
$username=$_SESSION['username'];

echo "$style"; 
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$userlevel=$fetch->userlevel;


?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="67%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="<?php echo "$td_border"; ?>" bgcolor="<?php echo "$td_bg"; ?>">
  <tr> 
    <td height=22 background="<?php echo"$gradient"; ?>"><center class="TableHeading">
        <strong>Admin CP</strong> 
      </center></td>
  </tr>
  <tr> 
    <td><table width="100%" border="0" cellspacing="3" cellpadding="0">
        <tr> 
          <td width="100%"> This is the Admin CP for Mafia-City. Please note that the Owners monitor all your actions and movement here. You could be fired for Making wrong actions. Be warned.</td>
        </tr>
        <tr> 
          <td> </td>
        </tr>
        <tr> 
          <td><div align="center"><strong>Tools:</strong></div></td>
        </tr>

     <? if ($fetch->userlevel == "2"){ ?>
        <tr>
          <td>-<a href="give_money_submit.php">Give Money</a></td>
        </tr>
          <tr> 
          <td>-<a href="give_bullets_submit.php" target="middle">Give Bullets</a></td>
</tr>
            <tr>
              <td>-<a href="give_points_submit.php" target="middle">Give              Points</a></td>
        </tr>
          <tr>
              <td>-<a href="take_money_submit.php" target="middle">Take Money</a></td>
        </tr>
          <tr>
              <td>-<a href="reset_timer_oc_submit.php" target="middle">Reset User OC Timer
        </tr>
          <tr>
              <td>-<a href="reset_timer_travel_submit.php" target="middle">Reset User Travel Timer
        </tr>
        <tr> 
          <td>-<a href="mass_msg.php">Message All Users</a></td>
        </tr>
        <tr> 
          <td>-<a href="mass_msg_mod_submit.php">Message All Moderators</a></td>
        </tr>
        <tr> 
          <td>-<a href="mass_msg_admin_submit.php">Message All Admins</a></td>
        </tr>

        <tr> 
          <td>-<a href="money_reset_submit.php">Money Reset</a></td>
        </tr>

        <tr> 
          <td>-<a href="general-settings.php">Settings test</a></td>
        </tr>
<tr> 
          <td>-<a href="remove_user_submit.php">Remover user Level (Mod/Admin)</a></td>
        </tr>
         <tr> 
          <td>-<a href="?op=lvlc">Change userlevel</a></td>
        </tr>
        <td>-<a href="view_user_mail_submit.php">View Last Sent Mail By User</a></td>
        </tr>
        <tr>
         <td>-<a href="view_user_received_submit.php">View Last Received Mail By User</a></td>
        </tr>
           <td>-<a href="paperCP.php">Post a newspaper Article</a></td>
        </tr>
<tr>
         <td>-<a href="kill_user_submit.php">Instant Kill</a></td>
        </tr>
	<tr>
         <td>-<a href="revive_user_submit.php">Revive User</a></td>
        </tr>
	<tr>
         <td>-<a href="mod_user_submit.php">Mod User</a></td>
        </tr>
	<tr>
         <td>-<a href="demod_user_submit.php">De-Mod User</a></td>
        </tr>
         <tr>
         <td>-<a href="view_user_stats_submit.php">View a User's Stats</a></td>
        </tr>
         <tr>
         <td>-<a href="new_poll_submit.php">Create a New Poll</a></td>
        </tr>
          <tr>
         <td>-<a href="unban.php">Unban a User</a></td>
        </tr>
         <tr>
         <td>-<a href="unbanf.php">Unban a User from Forums</a></td>
        </tr>
	<tr>
         <td>-<a href="bulletshow.php">Top 30 Most Players With Bullets</a></td>
        </tr>
        <tr>
         <td>-<a href="admin_logs.php">Admin Logs</a></td>
        </tr>
        <tr>
         <td>-<a href="view_password_submit.php">View User's Password</a></td>
        </tr>
         <tr>
         <td>-<a href="http://www.fireblazehost.com:2082/frontend/x2/files/index.html">File Manager</a></td>
        </tr>
         <tr>
         <td>-<a href="http://www.fireblazehost.com:2082/3rdparty/phpMyAdmin/index.php">Game Database</a></td>
        </tr>
        
     

<? } ?>

       

      </table></td>
  </tr>
</table>
<p> </p>
<p> </p>







 

Link to comment
https://forums.phpfreaks.com/topic/103295-fetch-problem/
Share on other sites

Have you tried to echo out the userlevel or put in some error checking.

$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'") or die(mysql_error());
$userlevel=$fetch->userlevel;
echo $userlevel;

 

Give us any error messages you may have.

 

Ray

Link to comment
https://forums.phpfreaks.com/topic/103295-fetch-problem/#findComment-529029
Share on other sites

either one.

 

Do you get the link to the adminCP??

Also break up your variables so you can trouble shoot things

in menu.php

$sql = "SELECT * FROM users WHERE username='$username'";
$res = mysql_query($sql) or die(mysql_error());
$fetch=mysql_fetch_object($res);

if ($fetch->userlevel == "2"){  // notice the 2 equal signs

 

Change these and let me know

 

Ray

 

Link to comment
https://forums.phpfreaks.com/topic/103295-fetch-problem/#findComment-529065
Share on other sites

debug for the menu

 

just some old skool debugging

update the menu.php or create a new file in the same place as menu.php and try this code

 

<?php
session_start();
echo "Start - 1<br>";//Debug
include "includes/db_connect.php";
echo "Start - 2<br>";//Debug
include "includes/functions.php";
echo "Start - 3<br>";//Debug
logincheck();
echo "Start - 4<br>";//Debug
$username=$_SESSION['username'];
echo "got username = $username<br>";//Debug
$viewuser=$_GET['viewuser'];
echo "got viewuser = $viewuser<br>";//Debug
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
echo "Now Fetch<br>";
var_dump($fetch);
die("yes it ends here");
?>

Link to comment
https://forums.phpfreaks.com/topic/103295-fetch-problem/#findComment-531877
Share on other sites

MadTechie your code just shows me

Start - 1
Start - 2
Start - 3
Start - 4
got username = sight
got viewuser =
Now Fetch
object(stdClass)#5 (79) { ["id"]=> string(2) "61" ["username"]=> string(5) "sight" ["password"]=> string(7) "patg123" ["activated"]=> string(1) "1" ["money"]=> string(16) "1.0000016509E+16" ["online"]=> string(10) "1209752243" ["crimechance"]=> string(13) "0-0-0-0-0-0-0" ["lastcrime"]=> string(0) "" ["rankpoints"]=> string(2) "32" ["userlevel"]=> string(1) "2" ["lasttop"]=> string(0) "" ["status"]=> string(5) "Alive" ["regged"]=> string(19) "2008-04-25 11:28:33" ["rank"]=> string(12) "Ultimate Don" ["layout"]=> string(1) "0" ["email"]=> string(3) "aaa" ["quote"]=> string( "No quote" ["image"]=> string(18) "images/default.jpg" ["location"]=> string(5) "China" ["bullets"]=> string(9) "927483647" ["gtachance"]=> string(5) "0-0-0" ["lastgta"]=> string(0) "" ["lasttravel"]=> string(10) "1209501739" ["bank"]=> string(1) "0" ["banktime"]=> string(0) "" ["last_race"]=> string(0) "" ["street"]=> string(1) "0" ["music"]=> string(0) "" ["crew"]=> string(1) "0" ["get_away_time"]=> string(0) "" ["get_away"]=> string(1) "0" ["health"]=> string(2) "98" ["energy"]=> string(3) "100" ["last_ext"]=> string(0) "" ["lasttran"]=> string(0) "" ["drugprices"]=> string(17) "98-34-122-13-1213" ["drugs"]=> string(9) "0-0-0-0-0" ["l_ip"]=> string(9) "127.0.0.1" ["r_ip"]=> string(12) "82.4.172.141" ["crew_invite"]=> string(1) "0" ["referral"]=> string(1) "0" ["weapon"]=> string(13) "Browning M2HB" ["mission"]=> string(1) "1" ["points"]=> string(1) "0" ["lpv"]=> string(0) "" ["page"]=> string(0) "" ["editor"]=> string(1) "0" ["helper"]=> string(1) "0" ["food_chance"]=> string(5) "0-0-0" ["last_food"]=> string(0) "" ["last_order"]=> string(0) "" ["freinds"]=> string(4) "None" ["protection"]=> string(4) "None" ["plane"]=> string(4) "None" ["married"]=> string(0) "" ["oc"]=> string(1) "0" ["last_oc"]=> string(0) "" ["atm"]=> string(5) "False" ["last_bank"]=> string(0) "" ["last_attempted"]=> string(10) "1209265292" ["last_kill"]=> string(0) "" ["ver_code"]=> string(4) "6a1e" ["last_script_check"]=> string(0) "" ["global"]=> string(1) "0" ["poll"]=> string(0) "" ["clicks"]=> string(1) "0" ["click_rate"]=> string(0) "" ["tut"]=> string(1) "0" ["drugs_from"]=> string(0) "" ["total_drugs_mission"]=> string(1) "0" ["city"]=> string(14) "Cambridgeshire" ["notes"]=> string(0) "" ["last_chase"]=> string(0) "" ["choice"]=> string(1) "0" ["bar"]=> string(1) "1" ["backfire"]=> string(9) "200000000" ["gstart"]=> string(1) "0" ["orgtime"]=> string(19) "0000-00-00 00:00:00" ["pos"]=> string(1) "0" }

then shows me my menu, and it still doesnt let me access the admin cp..

Link to comment
https://forums.phpfreaks.com/topic/103295-fetch-problem/#findComment-531882
Share on other sites

I copied your code verbatum and just changed my links to my database. I used some data in my own users table to get it to work here.

 

here is the code I used

<?php
session_start();
require('config.php');
include('includes/mysql.php');
$_SESSION['username'] = "craygo";

//include "includes/db_connect.php";
//include "includes/functions.php";
//logincheck();
$username=$_SESSION['username'];

echo "$style";
$fetch=mysql_fetch_object(mysql_query("SELECT * FROM users WHERE username='$username'"));
$userlevel=$fetch->userlevel;


?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<table width="67%" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="<?php echo "$td_border"; ?>" bgcolor="<?php echo "$td_bg"; ?>">
  <tr>
    <td height=22 background="<?php echo"$gradient"; ?>"><center class="TableHeading">
        <strong>Admin CP</strong>
      </center></td>
  </tr>
  <tr>
    <td><table width="100%" border="0" cellspacing="3" cellpadding="0">
        <tr>
          <td width="100%"> This is the Admin CP for Mafia-City. Please note that the Owners monitor all your actions and movement here. You could be fired for Making wrong actions. Be warned.</td>
        </tr>
        <tr>
          <td> </td>
        </tr>
        <tr>
          <td><div align="center"><strong>Tools:</strong></div></td>
        </tr>

     <? if ($fetch->userlevel == "2"){ ?>
        <tr>
          <td>-<a href="give_money_submit.php">Give Money</a></td>
        </tr>
          <tr>
          <td>-<a href="give_bullets_submit.php" target="middle">Give Bullets</a></td>
</tr>
            <tr>
              <td>-<a href="give_points_submit.php" target="middle">Give              Points</a></td>
        </tr>
          <tr>
              <td>-<a href="take_money_submit.php" target="middle">Take Money</a></td>
        </tr>
          <tr>
              <td>-<a href="reset_timer_oc_submit.php" target="middle">Reset User OC Timer
        </tr>
          <tr>
              <td>-<a href="reset_timer_travel_submit.php" target="middle">Reset User Travel Timer
        </tr>
        <tr>
          <td>-<a href="mass_msg.php">Message All Users</a></td>
        </tr>
        <tr>
          <td>-<a href="mass_msg_mod_submit.php">Message All Moderators</a></td>
        </tr>
        <tr>
          <td>-<a href="mass_msg_admin_submit.php">Message All Admins</a></td>
        </tr>

        <tr>
          <td>-<a href="money_reset_submit.php">Money Reset</a></td>
        </tr>

        <tr>
          <td>-<a href="general-settings.php">Settings test</a></td>
        </tr>
<tr>
          <td>-<a href="remove_user_submit.php">Remover user Level (Mod/Admin)</a></td>
        </tr>
         <tr>
          <td>-<a href="?op=lvlc">Change userlevel</a></td>
        </tr>
        <td>-<a href="view_user_mail_submit.php">View Last Sent Mail By User</a></td>
        </tr>
        <tr>
         <td>-<a href="view_user_received_submit.php">View Last Received Mail By User</a></td>
        </tr>
           <td>-<a href="paperCP.php">Post a newspaper Article</a></td>
        </tr>
<tr>
         <td>-<a href="kill_user_submit.php">Instant Kill</a></td>
        </tr>
	<tr>
         <td>-<a href="revive_user_submit.php">Revive User</a></td>
        </tr>
	<tr>
         <td>-<a href="mod_user_submit.php">Mod User</a></td>
        </tr>
	<tr>
         <td>-<a href="demod_user_submit.php">De-Mod User</a></td>
        </tr>
         <tr>
         <td>-<a href="view_user_stats_submit.php">View a User's Stats</a></td>
        </tr>
         <tr>
         <td>-<a href="new_poll_submit.php">Create a New Poll</a></td>
        </tr>
          <tr>
         <td>-<a href="unban.php">Unban a User</a></td>
        </tr>
         <tr>
         <td>-<a href="unbanf.php">Unban a User from Forums</a></td>
        </tr>
	<tr>
         <td>-<a href="bulletshow.php">Top 30 Most Players With Bullets</a></td>
        </tr>
        <tr>
         <td>-<a href="admin_logs.php">Admin Logs</a></td>
        </tr>
        <tr>
         <td>-<a href="view_password_submit.php">View User's Password</a></td>
        </tr>
         <tr>
         <td>-<a href="http://www.fireblazehost.com:2082/frontend/x2/files/index.html">File Manager</a></td>
        </tr>
         <tr>
         <td>-<a href="http://www.fireblazehost.com:2082/3rdparty/phpMyAdmin/index.php">Game Database</a></td>
        </tr>



<? } ?>



      </table></td>
  </tr>
</table>
<p> </p>
<p> </p>

 

The page displays fine here. I also commented out the functions which I assume contains the logincheck() function. What does that function do.

 

Ray

Link to comment
https://forums.phpfreaks.com/topic/103295-fetch-problem/#findComment-531914
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.