satant Posted April 26, 2007 Share Posted April 26, 2007 hi i use java scrip with php to make minimize for menu It work good but my prob in if statment it's a mafagame so i need to hide som things for law ranks i think u all understand that <center> <script language="javascript"> function showMenu(id) { if(document.getElementById(id).style.visibility == "hidden") { document.getElementById(id).style.position = "static"; document.getElementById(id).style.visibility = "visible"; } else { document.getElementById(id).style.visibility = "hidden"; document.getElementById(id).style.position = "absolute"; document.getElementById(id).style.left = -100; document.getElementById(id).style.top = -100; } document.getElementById('mainTable').height = '100%'; } </script> <? ob_start(); include("db.php"); ?> <link rel=stylesheet href=in.css> <? $username = $_COOKIE['username']; $sql = MySql_Query("SELECT * FROM users WHERE username = '".$username."'"); $user = MySql_Fetch_Array($sql); ?> <center> <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=90%> <th class=kop><a href=# onclick="showMenu('Earning')">Earning</a></th> <tr id=Earning> <td id=Earning> - <a href=index.php?p=uCrime target=game alt="Do Crimes In The Omen World">Crimes</a><br> - <a href=index.php?p=trade target=game alt="Make Trade & Deceive PPL ">Trading</a><br> - <a href=index.php?p=bank target=game alt="This is the Gangsta World newspaper.">Bank</a><br> </td> </tr> <th class=kop><a href=# onclick="showMenu('traveling')">Traveling</a></th> <tr id=traveling> <td id=traveling> - <a href=index.php?p=travel class=menu target=game>Travel</a><br> - <a href=index.php?p=vehicle class=menu target=game>Vehicles</a><br> </td> </tr> <th class=kop><a href=# onclick="showMenu('Gambling')">Gambling</a></th> <tr id=Gambling> <td id=gambling> - <a href=index.php?p=rps class=menu target=game>Rock, Paper, Scissors</a><br> - <a href=index.php?p=rr class=menu target=game>Russian Roulette</a><br> - <a href=index.php?p=slot class=menu target=game>Slot</a><br> - <a href=index.php?p=Dice class=menu target=game>Dice</a><br> - <a href=index.php?p=gan class=menu target=game>Guess Numbers</a><br> - <a href=index.php?p=lottery class=menu target=game>Lottery</a><br> </td> </tr> <th class=kop><a href=# onclick="showMenu('Forum')">Forum</a></th> <tr id=forum> <td id=forum> <? if($this_user['crew'] != 0) { ?> - <a href=index.php?p=crewforum&fid=$user['crew'] class=menu target=_parent>Crew Forum</a><br> <? } elseif($user['rank'] >= 99) { ?> - <a href=index.php?p=forum&fid=-1 class=menu target=game>Admin</a><br> <? } ?> <? $q = mysql_query("SELECT * FROM forum WHERE crew = 0"); $for = mysql_fetch_object($q) ?> - <a href=index.php?p=forum&fid=$for['id']>$for['name']</a></br> </td> </tr> <? if(!(safety($user['id'] == -1 && $user['safety'] == 1)){ ?> <th class=kop><a href=# onclick="showMenu('war')">War</a></th> <tr id=War> <td id=War> - <a href=index.php?p=REW.list class=menu target=game>List Rewards</a><br> - <a href=index.php?p=REW.place class=menu target=game>Place Reward</a><br> - <a href=index.php?p=kill class=menu target=game>Murder</a><br> - <a href=index.php?p=safety class=menu target=game>Buy Out Safety</a><br> </td> </tr> <? } ?> <th class=kop><a href=# onclick="showMenu('Crews')">Crews</a></th> <tr id=Crews> <td id=Crews> ?> if($this_user['rank'] => 14 && $this_user['crew'] == 0) { ?> - <a href=index.php?p=CREW.start target=game>Start Crew</a><br> <? } elseif($this_user['crewrights[0]'] == '1' && $this_user['crew'] != 0) { ?> - <a href=online.php target=game>Users online</a><br> <? } ?> - <a href=paper.php target=game alt=>Gangsta World Daily</a><br> - <a href=donate.php target=game >Donations</a><br> - <a href=sponsors.php target=game >Sponsors</a><br> - <a href=edit.php target=game >Personal</a><br> - <a href=find.php target=game >Find user</a><br> - <a href=kill.php target=game >Kill</a><br> - <a href=attempts.php target=game>Attempts</a><br> - <a href=airport.php target=game >Airport</a><br> - <a href=cont.php target=game>Countries</a><br> - <a href=crew.php target=game>Crew</a><br> - <a href=shop.php target=game>Shop</a><br> - <a href=bullet.php target=game>Bulletfactory</a><Br> - <a href=jail.php target=game>Jail</a><br> </td> </tr> </table> please tell me wat's wrong in if statment Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/ Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 if($this_user['rank'] => 14 && $this_user['crew'] == 0) { change => to == Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239294 Share on other sites More sharing options...
satant Posted April 26, 2007 Author Share Posted April 26, 2007 but if i do that this mean if the rank > 14 won't see the option Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239295 Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 Then use ">=" Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239300 Share on other sites More sharing options...
satant Posted April 26, 2007 Author Share Posted April 26, 2007 plz try it in ur own php edito it gives error too Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239315 Share on other sites More sharing options...
Barand Posted April 26, 2007 Share Posted April 26, 2007 Where you have ?> if($this_user['rank'] => 14 && $this_user['crew'] == 0) { it should be <? if($this_user['rank'] >= 14 && $this_user['crew'] == 0) { You drop in and out of PHP so often tht such errors aren't surprising. Also, line 90, you have unmatched ( and ) if(!(safety($user['id'] == -1 && $user['safety'] == 1)){ Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239324 Share on other sites More sharing options...
MadTechie Posted April 26, 2007 Share Posted April 26, 2007 Basically what Barand said but also - <a href=index.php?p=forum&fid=$for['id']><? echo $for['name'] ?></a></br> Full code below <center> <script language="javascript"> function showMenu(id) { if(document.getElementById(id).style.visibility == "hidden") { document.getElementById(id).style.position = "static"; document.getElementById(id).style.visibility = "visible"; } else { document.getElementById(id).style.visibility = "hidden"; document.getElementById(id).style.position = "absolute"; document.getElementById(id).style.left = -100; document.getElementById(id).style.top = -100; } document.getElementById('mainTable').height = '100%'; } </script> <?php ob_start(); include("db.php"); ?> <link rel=stylesheet href=in.css> <?php $username = $_COOKIE['username']; $sql = MySql_Query("SELECT * FROM users WHERE username = '".$username."'"); $user = MySql_Fetch_Array($sql); ?> <center> <table border=1 bordercolor=#000000 cellpadding=0 cellspacing=0 width=90%> <th class=kop><a href=# onclick="showMenu('Earning')">Earning</a></th> <tr id=Earning> <td id=Earning> - <a href=index.php?p=uCrime target=game alt="Do Crimes In The Omen World">Crimes</a><br> - <a href=index.php?p=trade target=game alt="Make Trade & Deceive PPL ">Trading</a><br> - <a href=index.php?p=bank target=game alt="This is the Gangsta World newspaper.">Bank</a><br> </td> </tr> <th class=kop><a href=# onclick="showMenu('traveling')">Traveling</a></th> <tr id=traveling> <td id=traveling> - <a href=index.php?p=travel class=menu target=game>Travel</a><br> - <a href=index.php?p=vehicle class=menu target=game>Vehicles</a><br> </td> </tr> <th class=kop><a href=# onclick="showMenu('Gambling')">Gambling</a></th> <tr id=Gambling> <td id=gambling> - <a href=index.php?p=rps class=menu target=game>Rock, Paper, Scissors</a><br> - <a href=index.php?p=rr class=menu target=game>Russian Roulette</a><br> - <a href=index.php?p=slot class=menu target=game>Slot</a><br> - <a href=index.php?p=Dice class=menu target=game>Dice</a><br> - <a href=index.php?p=gan class=menu target=game>Guess Numbers</a><br> - <a href=index.php?p=lottery class=menu target=game>Lottery</a><br> </td> </tr> <th class=kop><a href=# onclick="showMenu('Forum')">Forum</a></th> <tr id=forum> <td id=forum> <?php if($this_user['crew'] != 0) { ?> - <a href=index.php?p=crewforum&fid=$user['crew'] class=menu target=_parent>Crew Forum</a><br> <?php } elseif($user['rank'] >= 99) { ?> - <a href=index.php?p=forum&fid=-1 class=menu target=game>Admin</a><br> <?php } $q = mysql_query("SELECT * FROM forum WHERE crew = 0"); $for = mysql_fetch_object($q) ?> - <a href=index.php?p=forum&fid=$for['id']><?php echo $for['name'] ?></a></br> </td> </tr> <?php if( !(safety($user['id'] == -1) && $user['safety'] == 1) ) { ?> <th class=kop><a href=# onclick="showMenu('war')">War</a></th> <tr id=War> <td id=War> - <a href=index.php?p=REW.list class=menu target=game>List Rewards</a><br> - <a href=index.php?p=REW.place class=menu target=game>Place Reward</a><br> - <a href=index.php?p=kill class=menu target=game>Murder</a><br> - <a href=index.php?p=safety class=menu target=game>Buy Out Safety</a><br> </td> </tr> <?php } ?> <th class=kop><a href=# onclick="showMenu('Crews')">Crews</a></th> <tr id=Crews> <td id=Crews> <?php if($this_user['rank'] >= 14 && $this_user['crew'] == 0) { ?> - <a href=index.php?p=CREW.start target=game>Start Crew</a><br> <?php } elseif($this_user['crewrights[0]'] == '1' && $this_user['crew'] != 0) { ?> - <a href=online.php target=game>Users online</a><br> <?php } ?> - <a href=paper.php target=game alt=>Gangsta World Daily</a><br> - <a href=donate.php target=game >Donations</a><br> - <a href=sponsors.php target=game >Sponsors</a><br> - <a href=edit.php target=game >Personal</a><br> - <a href=find.php target=game >Find user</a><br> - <a href=kill.php target=game >Kill</a><br> - <a href=attempts.php target=game>Attempts</a><br> - <a href=airport.php target=game >Airport</a><br> - <a href=cont.php target=game>Countries</a><br> - <a href=crew.php target=game>Crew</a><br> - <a href=shop.php target=game>Shop</a><br> - <a href=bullet.php target=game>Bulletfactory</a><Br> - <a href=jail.php target=game>Jail</a><br> </td> </tr> </table> EDIT replaced <? with <?php (looks cleaner) Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239332 Share on other sites More sharing options...
satant Posted April 26, 2007 Author Share Posted April 26, 2007 i try is but it still have the same prb i think the prob with (>) is it have another way to write Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239366 Share on other sites More sharing options...
satant Posted April 26, 2007 Author Share Posted April 26, 2007 do there is no one can help me? Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239392 Share on other sites More sharing options...
MadTechie Posted April 26, 2007 Share Posted April 26, 2007 OK going to take a guess are you are this is correct? if($this_user['crew'] != 0) { as it looks like it should be if($user['crew'] != 0) { that would be the same for all "$this_user", just a guess, Did you write the code yourself ? Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239406 Share on other sites More sharing options...
satant Posted April 26, 2007 Author Share Posted April 26, 2007 yeah i write it my self this $this_user=$user Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239413 Share on other sites More sharing options...
MadTechie Posted April 26, 2007 Share Posted April 26, 2007 erm.. ok Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-239422 Share on other sites More sharing options...
satant Posted April 29, 2007 Author Share Posted April 29, 2007 hey where is the top coders plz any one have another wat to make it tell me Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-240910 Share on other sites More sharing options...
Barand Posted April 29, 2007 Share Posted April 29, 2007 What you have posted is a "rats-nest" of code, jumping in and out PHP almost every other line, with some of the PHP code outside PHP tags (such as that if() statement). Also you are apparently interchanging variable names at random. $this_user=$user Given that we can't run the code (we dont have your database) you only say "it gives an error" without even saying what the error is, we don't even know if you implemented all the suggestions offered so far are you really surprised the responses aren't flooding in? Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-240918 Share on other sites More sharing options...
satant Posted April 29, 2007 Author Share Posted April 29, 2007 m8 the all prob whith the if statment and i'm very sure from my veriables Quote Link to comment https://forums.phpfreaks.com/topic/48828-minimize-menu/#findComment-240920 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.