Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 02-13-2011, 11:12 PM figuring the issue
Novice Talker

Posts: 6
Trades: 0
i am currently working on redesigning my website. i am currently suck at a part in which dealing with using a secondary name to enter further into the site. the site is an mmorpg. my email is HipBII@gmail.com i am open to any an all help

Last edited by HipB; 02-13-2011 at 11:42 PM..
HipB is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 02-13-2011, 11:17 PM Re: figuring the issue
Novice Talker

Posts: 6
Trades: 0
to try an better explain this is that how it is set as of now you can sign in with a username and password, once signed in there is a page where all available rounds can be found, it is there that i have the game set for the user to type a round name and select a city in which to play. the issue is that after entering and submitting the info which all of it saves it DB an server is that instead of pulling up the round info that was already entered it ask for it to be input again.

Last edited by HipB; 02-13-2011 at 11:44 PM..
HipB is offline
Reply With Quote
View Public Profile
 
Old 02-14-2011, 04:01 AM Re: figuring the issue
Novice Talker

Posts: 6
Trades: 0
here is the code for any to look any an possibly find whats wrong


<?
include("html.php");

if($action == login){

$getcode = mysql_fetch_array(mysql_query("SELECT code FROM $tab[user] WHERE id='$id';"));
$chkban = @mysql_fetch_array(mysql_query("SELECT status,code FROM "."r".$goto."_".$tab[pimp]." WHERE code='$getcode[0]';"));

if($chkban[0] == banned){
mysql_query("UPDATE "."r".$goto."_".$tab[pimp]." SET status='banned' WHERE code='$chkban[1]'");
}
if($chkban[0] != banned){
mysql_query("UPDATE "."r".$goto."_".$tab[pimp]." SET status='$chkban[0]' WHERE code='$chkban[1]';");
}
header("location: tru/dologin.php?code=$trupimp&tru=$goto");

}


if(($pimp) && ($city)){

$user = mysql_fetch_array(mysql_query("SELECT status,code,username,password FROM $tab[user] WHERE id='$id';"));
$game = mysql_fetch_array(mysql_query("SELECT type,reserves FROM $tab[game] WHERE round='$round';"));

if($user[0] == admin){ $check=admin; }else{ $check=supporter; }

if (($game[0] == supporters) && ($user[0] != $check))
{ $msg="You must become a supporter to join this game"; }
elseif ((!preg_match ('/^[a-z0-9][a-z0-9\.\-_]*$/i', $pimp)) || (strstr($pimp,".")))
{ $msg="Pimp name can only have a-Z, 0-9, -_ characters."; }
elseif (fetch("SELECT pimp FROM "."r".$round."_".$tab[pimp]." WHERE pimp='$pimp';"))
{ $msg="Sorry, that pimpname is taken."; }
elseif (!fetch("SELECT id FROM "."r".$round."_".$tab[city]." WHERE id='$city';"))
{ $msg="Please select a city to start in.";}
elseif (fetch("SELECT user FROM $tab[stat] WHERE user='$user[2]' AND round='$round';"))
{ $msg="You have already joined that round.";}
else {

mysql_query("INSERT INTO "."r".$round."_".$tab[pimp]." (pimp,user,pass,email,trn,res,city,online,code,sta tus) VALUES ('$pimp','$user[2]','$user[3]','$user[4]','500','$game[1]','$city','$time','$user[1]','$user[0]');");
mysql_query("INSERT INTO $tab[stat] (user,round) VALUES ('$user[2]','$round');");

}

}

function printround($round,$type){
global $tab, $time, $id, $trupimp;

$fix[0]=$round;

$game = mysql_fetch_array(mysql_query("SELECT speed,reserves,credits,crewmax,starts,ends FROM $tab[game] WHERE round='$round';"));

$user = mysql_fetch_array(mysql_query("SELECT status,username FROM $tab[user] WHERE id='$id';"));
?>
<b> Round <?=$round?> <font color="#8B4513">:: <a href="credits.php">Credit Addon <?=commas($game[2])?></a></font></b>
<table width="95%" height="100" bgcolor="#524343">
<tr>
<td align="center" background="http://img337.imageshack.us/img337/9566/big211cw.jpg">
<?
if(fetch("SELECT user FROM $tab[stat] WHERE user='$user[1]' AND round='$round';")){
//added next two lines
$round_pimp = 'r' . $round . '_' . $tab[pimp];
$round_city = 'r' . $round . '_' . $tab[city];
$player = mysql_fetch_array(mysql_query("SELECT pimp,rank,city,whore,thug,lowrider,msg,atk,trn FROM "."r".$round."_".$tab[pimp]." WHERE code='$trupimp';"));
$playercity = mysql_fetch_array(mysql_query("SELECT name FROM "."r".$round."_".$tab[city]." WHERE id='$player[2]';"));
?>
<a href="play.php?action=login&goto=<?=$round?>">
<font size="+1" color="#FFFFFF"><?=$player[0]?></font>
<font color="#FFFFFF"> is ranked <font color="#FFFFFF"><?=commas($player[1])?></font> in <font color="#FFFFFF"><?=$playercity[0]?> </font>

<br>
<br><font color="#FFFFFF"> </font><?if($game[4] > $time){?>Round hasn't started yet<?}else{?>Go to the game<?}?><font color="#FFFFFF"> </font>
<br><?if($player[6] > 0){?>You have <font color="#FFFFFF"><?=$player[6]?></font> new messages<?}else{?><font color="#FFFFFF">You have no new messages</font><?}?>
</font><br>
<br><?if($player[7] > 0){?><font color="FF0000">You have been attacked</font></a> <font color="#FFFFFF"><?=$player[7]?></font> <?if($player[7] > 1){?>times<?}else{?>time<?}?>.<?}else{?><font color="#FFFFFF">You have not been attacked</font><?}?>
<br><font color="#FFFFFF"><?=commas($player[3])?></font> hoes, <font color="#FFFFFF"><?=commas($player[4])?></font> thugs
<br>with <font color="#FFFFFF"> <?=commas($player[5])?></font> rides and you have accumulated <font color="#66FFFF"><?=commas($player[8])?></font> turns.
<br>


</a> <?
}else{?>
<font size="+1"><?=$type?> Round</font>
<br><font color="blue"><b>Speed:</b></font> <?=$game[0]?> turns every 10 mins
<br><font color="#blue"><b>Reserves:</b></font> <?=$game[1]?> turns reserved
<br><font color="blue"><b>Turn Addon:</b></font> <?=$game[2]?> credits only
<br>
<br>

/******************************************
* from what i can tell the error is
* just below but can be wrong
******************************************/


<?
$citydb = "r".$round."_".$tab[city];

if($user[0] == admin){ $check=admin; }else{ $check=supporter; }

if(($type == supporters) && ($user[0] != $check))
{?><center><a href="credits.php"><font color="#FFFFFF"><small>You must be a supporter to join</small><br></font> click here to become one</a></center><?}
else{?>
<table align="center"><form method="post" action="play.php">
<tr><td align="right">pimpname:</td><td><input type="text" name="pimp" size="12"></td></tr>
<tr><td align="right">start in:</td>
<td><select name="city"><option value="">-select one-</option>
<?$get = mysql_query("SELECT id,name FROM $citydb ORDER BY id ASC;");
while ($city = mysql_fetch_array($get))
{?><option value="<?=$city[0]?>"><?=$city[1]?></option><?}?></select>
</td>
</tr>
<tr><td></td><td><input type="hidden" name="round" value="<?=$round?>"><input type="submit" value="&nbsp;join&nbsp;"></td></tr>
</form></table>
<?}
}?>

/******************************************
* end here for wat i think is location of error.
******************************************/
</td>
<td width="300" bgcolor="#333333">

<table width="300" height="200" background="http://img417.imageshack.us/img417/4743/perthclouds15el.jpg">
<tr>
<td>

<table width="300" cellspacing="1" cellpadding="1" bgcolor="524343">
<?
$getpimps = mysql_query("SELECT id,pimp,networth,nrank,crew FROM "."r".$round."_".$tab[pimp]." WHERE rank>0 ORDER BY nrank ASC LIMIT 5;");
while ($pimp = mysql_fetch_array($getpimps))
{
$crw = mysql_fetch_array(mysql_query("SELECT icon FROM "."r".$round."_".$tab[crew]." WHERE id='$pimp[4]';"));
if($rankstart==0){$rankcolor="#222222";$rankstart+ +;}
elseif($rankstart==1){$rankcolor="#333333";$rankst art--;}
?>
<tr bgcolor="<?=$rankcolor?>">
<td width=1><small><?=$pimp[3]?>.</small></td>
<td height="16"><nobr><?if($crw[0]){?><img src="<?=$crw[0]?>" width="14" height="14" align="absmiddle"><?}?><Small><a href="pimp.php?pid=<?=$pimp[1]?>&rnd=<?=$round?>"><?=$pimp[1]?></a></small></nobr></td>
<td align=right><small><font color="gold">$</font><?=commas($pimp[2])?></small></td>
</tr>
<?}?>
</table>


<br><br>

<br><br>


</td>
</tr>
</table>
<font color="#blue"><b>Round Type: </b>
<?=$type?></font>
<br>
<font color="blue"><b>Speed:</b> <?=$game[0]?> turns every 10 mins</font>
<br><font color="#blue"><b>Reserves:</b> <?=$game[1]?> turns reserved</font>
<br><font color="blue"><b>Turn Addon:</b> <?=$game[2]?> credits only</font>
<br><font color="#blue"><b>Crew Max:</b><?=$game[3]?></b></font>
</td>
</tr>
</table>

<br>
<font color="#8B4513"><small><?if ($game[4] > $time){?>Starts in <?countdown($game[4]);}else{?>Ends in <?countdown($game[5]);}?></small></font>
</font>
<br>
<br>
<?
}



$menu='pimp/';
secureheader();
siteheader();
?>
<table width="100%" height="100%">
<tr>
<td height="12"><b>Choose a game!</b></td>
</tr>
<tr>
<td height="3" align="center"><img src="http://www.masterpimpz.com/images/line1.gif"></td>
</tr>
<tr>
<td align="center" valign="top">
<?
if($msg == disabled){?><br><font color="#FF9900"><b>Your character has been frozen</b></font><br><?}
if($msg == select){?><br><font color="#FF9900"><b>Please select a game.</b></font><br><?}
elseif($msg){?><br><font color="#FF9900"><b><?=$msg?></b></font><br><?}?>
<?
$get = mysql_query("SELECT round,type FROM $tab[game] WHERE ends>'$time' ORDER BY round ASC;");
while ($game = mysql_fetch_array($get)){ printround($game[0],$game[1]); }
?>
</td>
</tr>
</table>
<?
sitefooter();
?>




<script type="text/javascript">

/******************************************
* Popup Box- By HipBII @ admin@masterpimpz.com
* Visit http://www.masterpimpz.com/ for full source code
* This notice must stay intact for use
******************************************/

var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

//drag drop function for NS 4////
/////////////////////////////////

var dragswitch=0
var nsx
var nsy
var nstemp

function drag_dropns(name){
if (!ns4)
return
temp=eval(name)
temp.captureEvents(Event.MOUSEDOWN | Event.MOUSEUP)
temp.onmousedown=gons
temp.onmousemove=dragns
temp.onmouseup=stopns
}

function gons(e){
temp.captureEvents(Event.MOUSEMOVE)
nsx=e.x
nsy=e.y
}
function dragns(e){
if (dragswitch==1){
temp.moveBy(e.x-nsx,e.y-nsy)
return false
}
}

function stopns(){
temp.releaseEvents(Event.MOUSEMOVE)
}

//drag drop function for ie4+ and NS6////
/////////////////////////////////


function drag_drop(e){
if (ie4&&dragapproved){
crossobj.style.left=tempx+event.clientX-offsetx
crossobj.style.top=tempy+event.clientY-offsety
return false
}
else if (ns6&&dragapproved){
crossobj.style.left=tempx+e.clientX-offsetx+"px"
crossobj.style.top=tempy+e.clientY-offsety+"px"
return false
}
}

function initializedrag(e){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
var firedobj=ns6? e.target : event.srcElement
var topelement=ns6? "html" : document.compatMode && document.compatMode!="BackCompat"? "documentElement" : "body"
while (firedobj.tagName!=topelement.toUpperCase() && firedobj.id!="dragbar"){
firedobj=ns6? firedobj.parentNode : firedobj.parentElement
}

if (firedobj.id=="dragbar"){
offsetx=ie4? event.clientX : e.clientX
offsety=ie4? event.clientY : e.clientY

tempx=parseInt(crossobj.style.left)
tempy=parseInt(crossobj.style.top)

dragapproved=true
document.onmousemove=drag_drop
}
}
document.onmouseup=new Function("dragapproved=false")

////drag drop functions end here//////

function hidebox(){
crossobj=ns6? document.getElementById("showimage") : document.all.showimage
if (ie4||ns6)
crossobj.style.visibility="hidden"
else if (ns4)
document.showimage.visibility="hide"
}

</script>

<div id="showimage" style="position:absolute;width:250px;left:250px;to p:250px">

<table border="0" width="348" bgcolor="#000080" cellspacing="0" cellpadding="2">
<tr>
<td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"
height="36px">




<tr>
<td width="100%" bgcolor="#123456" style="padding:4px" colspan="2">

<!-- PUT YOUR CONTENT BETWEEN HERE -->
<div align="center">Welcome To The News Page!!!</div>
<br><br><font size="3">
Great News The Scout Page Is Fully Working Now
& For All Those That It Cuased Any Trouble I Am
Deeply Sorry For That But All Is Good Now.
<br>
<div align="center">COMING SOON</div><br>

Whats up pimpz, a few things new to look for is Three(3) new rides to purchase besides the plain old boring lowriders. plus a few other changes in the game.

</font><br><br>
Vote for us at Top RPG and everytime you vote you will recieve 500 credits.
<br>
A second new site to vote for MP is Galaxy News and with the site you need to click inside the not complete circle an ex. will be posted here in due time.
<br>
Also if you see anything of Masterpimpz.com on any other site please do not hesitate to contact me.
<br><br>
<div align="center">
<a href="#" onClick="hidebox();return false">
<input type="submit" target="close" value="Accept"></a>
<!-- END YOUR CONTENT HERE -->

</td>
</tr>
</table>
</td>
</tr>
</table>
</div>

Last edited by HipB; 02-14-2011 at 04:04 AM..
HipB is offline
Reply With Quote
View Public Profile
 
Old 02-14-2011, 03:04 PM Re: figuring the issue
Super Spam Talker

Posts: 880
Name: Paul W
Trades: 0
Yuk! Looks like you were figuring out what the code should do just after you wrote it! Take a step back, plan the major flow - don't worry about html or db queries or that gubbins, just get the control structures in. Then you can plug in other bits. I'd rewrite from scratch but .... You use $type to make decisions - where is it set? Don't call a variable "type" anyway - it's a reserved word and will cause issues somewhere along in the line. Don't compare against strings that aren't in quotes. Don't assume any call will work - always test, eg on db queries. Always put an exit() after a header call. ...
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE


*** New:
Please login or register to view this content. Registration is FREE
PaulW is online now
Reply With Quote
View Public Profile
 
Reply     « Reply to figuring the issue
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.48311 seconds with 12 queries