Check Code-VBForums
Results 1 to 12 of 12

Thread: Check Code

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Check Code

    Hello all,
    i had a request here for help, i cant manage to fix my code to work normal for example i got problems with function Execute() and ->RecordCount() i try replace execute with mssql_query() and for now it reads from database tables with mssql_query,but i'm not sure is it right like that to be,and i can't find a way to fix my code perfectly to work.
    Can someone take a look and say to me what i make mistake and how it should be, thanks

    Code:
    <style>
    .tcRTable
    {
    margin-top: 15px;
    background-color: #222222;
    border: 1px solid #444444; 
    border-radius:7px;
    }
    #tcRbg
    {
    background-color: #111111;	
    }
    .infoa
    {
    color: #888888;
    }
    .infob
    {
    color: #CCCCCC;
    }
    .infoc
    {
    color: #CCCCCC;
    font-weight: bold;
    }
    </style>
    
    <? 
    include ("config.php");
    include("transfer_config.php");
    	
        if ($coretc['OnOff'] == '0') {
            echo ('For the moment this page is closed. Please come back later.');
        } else {
    
    $username = secure($_SESSION['user']);
    
    $online  =	mssql_query("Select * from MEMB_STAT where memb___id='$username' and ConnectStat='1' ");
    $credits  = mssql_query("Select * from ".$coretc['CT']." where memb___id='$username'");			
    $tcinfo = mssql_query("Select * from Character where AccountID='$username'");						
    $tci	= 0;
    $tcresult= '';
    while ($tci < $tcinfo->RecordCount())  
    {
    $tcin = $tcinfo->fetchrow();
    $tci++;
    $tcresult.= '<option value="'.base64_encode($tcin[0]).'">'.htmlspecialchars($tcin[0]).'</option>';
    }
    
    $name = base64_decode($_POST['tcame']);
    $newacc = $_POST['newacc'];
    $allowacc = $_POST['cacc'];
    
    $tcinfoT = $core_db->Execute("Select Name from Character where Name ='$name' and AccountID=?", array(
    			$user_auth_id
                ));
    $gmem = $core_db->Execute("Select Name from GuildMember where Name ='$name' ");	
    $sat = $core_db->Execute("Select racc from AllowedTCharacter_List where racc ='$allowacc' and sacc ='$user_auth_id' ");
    $sat2 = $core_db->Execute("Select racc from AllowedTCharacter_List where racc ='$user_auth_id' and sacc ='$newacc' ");		
    $acce = $core_db2->Execute("Select memb___id from MEMB_INFO where memb___id ='$allowacc' ");
    $acce2 = $core_db2->Execute("Select memb___id from MEMB_INFO where memb___id ='$newacc' ");
    $gidsn = $core_db->Execute("Select GameID1,GameID2,GameID3,GameID4,GameID5,id from AccountCharacter where id ='$newacc'");	
    $online2  =	$core_db2->Execute("Select ConnectStat from MEMB_STAT where memb___id='$newacc' ");		
    $rcreditsac = $coretc['ReqCreditsAC'];			
    $rcredits = $coretc['ReqCredits'];	
    $nacredits = $credits->fields[0] - $rcreditsac;
    $ncredits = $credits->fields[0] - $rcredits;			
    
    if ($rcreditsac == 0) {
    $rqai = 'Free';
    $rqat = '';
    }
    elseif ($rcreditsac == 1) {
    $rqai = number_format($rcreditsac);
    $rqat = 'credit';
    }
    else {
    $rqai = number_format($rcreditsac);
    $rqat = 'credits';
    }
    if ($rcredits == 0) {
    $rqc = 'Free';
    }
    else {
    $rqc = number_format($rcredits);
    }
    
    $infoac = '<span class="infoa">Allow Transfer Cost :</span> <span class ="infob">'.$rqai.' '.$rqat.'</span>';
    $info = '<span class="infoa">Current Credits :</span> <span class ="infob">'.number_format($credits->fields[0]).'</span>
    <br><span class="infoa">Transfer Character Cost :</span> <span class ="infob">'.$rqc.'</span>';
    $info2 = '<span class="infoa">Old Credits :</span> <span class ="infob">'.number_format($credits->fields[0]).'</span>
    <br><span class="infoa">New Credits :</span> <span class ="infoc">'.number_format($ncredits).'</span>
    ';
    
    if ($coretc['AllowAcc'] == 1) {
    echo '<table border="0" cellspacing="2" cellpadding="2" width="100%" class="tcRTable">
    		<tr id="tcRbg" >
    		<td style="padding-top: 15px; padding-bottom: 15px;" rowspan="3" ><center>'.$infoac.'</center></td>
    		<center><form action="" method="post" onsubmit="return confirm(\'Are sure you want to allow transfer?\')">		
    		<tr id="tcRbg"><td style="padding-top: 15px; padding-bottom: 15px;" align="center"><span class="infob">Allow transfer for Account :</span></td>
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><input type="text" size="10" maxlength="10"  name="cacc"></td></tr>
    		<tr id="tcRbg"><td style="padding-bottom: 15px;" align="center" colspan="2"><br><button type="submit" id="cacc"  class="button">Confirm</button>
    		</form></center></td></tr></table>';
    }
    	if (isset($_POST['cacc'])) {
    	if ($sat->fields[0]) {
    	echo msg('0', "You have already allowed transfer for account $allowacc !");
    	}
    	elseif ($allowacc != check_acc($_POST['cacc'], "")) {
    	echo msg('0', 'Chosen account name contains characters that are not allowed or is empty.');
    	}
    	elseif (strlen($_POST['cacc'])< 4 || strlen($_POST['cacc']) > 10) {
    	echo msg('0', 'Error - account name lenght must be 4-10 Characters.');
    	}
    	elseif ($credits->fields[0] < $rcreditsac) { 
    	echo msg('0', 'Unable to allow transfer character, Reason: you dont have enough credits.');
    	}
    	elseif ($acce->fields[0] == '') { 
    	echo msg('0', 'Account doesnt exist !');
    	}	
    	elseif ($_POST['cacc'] == $user_auth_id) {
    	echo msg('0', 'Are you kidding me?');
    	}
    	else {	
    	echo msg('1', "Transfer character allowed to account $allowacc !");
    	$core_db->Execute("Insert Into AllowedTCharacter_List(sacc,racc)VALUES('$user_auth_id','$allowacc')");
    	$core_db2->Execute("Update ".$coretc['CT']." set ".$coretc['CC']." = '$nacredits' where memb___id=?", array(
    			$user_auth_id
                ));
    	if ($coretc['Logs'] == '1') {		
    	tclog($user_auth_id,'User has allowed transfer character to '.$allowacc.' account, for '.number_format($rcreditsac).' Credits.');			
    			  }		
    	     }
    	}
    	
    if ((!isset($_POST['tcame']) && !isset($_POST['newacc'])) && ($tcinfo->RecordCount() > 0)) 
    	{
    		echo'
    		<table border="0" cellspacing="2" cellpadding="2" width="100%" class="tcRTable">
    		<tr id="tcRbg" >
    		<td style="padding-top: 15px; padding-bottom: 15px;" rowspan="3" ><center>'.$info.'</center></td>
    		<center><form action="" method="post" onsubmit="return confirm(\'Are sure you want to transfer character?\')">
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><span class="infob">Character :</span></td>
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><select name="tcame"><option disabled>- Select -</option>'.$tcresult.'</select></td></tr><br>
    		<tr id="tcRbg"><td style="padding-top: 15px; padding-bottom: 15px;" align="center"><span class="infob">New Account :</span></td>
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><input type="text" size="10" maxlength="10"  name="newacc"></td></tr>
    		<tr id="tcRbg"><td style="padding-bottom: 15px;" align="center" colspan="2"><br><button type="submit" id="newacc"  class="button">Transfer Character</button>
    		</form></center></td></tr></table>
    		';
    	}
    	elseif (isset($_POST['tcame'] ) && isset($_POST['newacc'] )) 
    			{
    	if ($gmem->fields[0] && $coretc['GuildMember'] == 1) {
    	echo msg('0', 'You have to leave guild before use transfer character function.');
    	}	
    	elseif (strlen($_POST['newacc'])< 4 || strlen($_POST['newacc']) > 10) {
    	echo msg('0', 'Error - account name lenght must be 4-10 Characters.');
    	}
    	elseif ($newacc != check_acc($_POST['newacc'], "")) {
    	echo msg('0', 'Chosen account name contains characters that are not allowed or is empty.');
    	}
        elseif (check_nonall($non_all, $newacc)) {
    	echo msg('0', 'Chosen account name is not allowed.');
    	}
    	elseif ($online->fields[0] == 1) { 
    	echo msg('0', 'Account is connected on game, please logout.');
    	}
    	elseif ($online2->fields[0] == 1) { 
    	echo msg('0', "Account $newacc is connected on game, please logout.");
    	}	
    	elseif ($credits->fields[0] < $rcredits) { 
    	echo msg('0', 'Unable to transfer character, Reason: you dont have enough credits.');
    	}
    	elseif ($newacc == $user_auth_id ) { 
    	echo msg('0', 'Are you kidding me?');
    	}
    	elseif ($sat2->fields[0] == '' && $coretc['AllowAcc'] == 1) {
    	echo msg('0', "Account $newacc doesnt allowed transfer character !");
    	}
    	elseif ($acce2->fields[0] == '') { 
    	echo msg('0', 'Account doesnt exist !');
    	}
    	elseif ($gidsn->fields[0] > '' && $gidsn->fields[1] > '' && $gidsn->fields[2] > '' && $gidsn->fields[3] > '' && $gidsn->fields[4] > '') {
    	echo msg('0', "Account $newacc doesnt have free slot for transfer character !");
    	}
    	elseif (!$tcinfoT->fields[0] ) { 
    	echo msg('0', 'H4X0R (Character doesnt belong to you) !');
    	if ($coretc['HackAttempt'] == '1') {
    	tclog($user_auth_id,'Tried to modify Character Name. (Character doesnt belong to ['.$user_auth_id.'] or doesnt exist)');
    		}
    	}
    	else {
    	if ($gidsn->fields[5] == '') {
    	$core_db->Execute("Insert Into AccountCharacter(id,GameID1,GameID2,GameID3,GameID4,GameID5,GameIDC)VALUES('$newacc',NULL,NULL,NULL,NULL,NULL,NULL)");
    	}
    	echo msg('1', "$name transfered to account $newacc !");
    	echo $info2;
    	$core_db->Execute(" Update Character set AccountID ='$newacc' where Name ='$name'; 
    	Update AccountCharacter set GameID1 =NULL where GameID1 ='$name'; 
    	Update AccountCharacter set GameID2 =NULL where GameID2 ='$name'; 
    	Update AccountCharacter set GameID3 =NULL where GameID3 ='$name'; 
    	Update AccountCharacter set GameID4 =NULL where GameID4 ='$name'; 
    	Update AccountCharacter set GameID5 =NULL where GameID5 ='$name';
    	Update AccountCharacter set GameIDC =NULL where GameIDC ='$name';
    	");
    	if ($gidsn->fields[0] == NULL ) {
    	$core_db->Execute("Update AccountCharacter set GameID1 = '$name' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[1] == NULL ) {
    	$core_db->Execute("Update AccountCharacter set GameID2 = '$name' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[2] == NULL ) {
    	$core_db->Execute("Update AccountCharacter set GameID3 = '$name' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[3] == NULL ) {
    	$core_db->Execute("Update AccountCharacter set GameID4 = '$name' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[4] == NULL ) {
    	$core_db->Execute("Update AccountCharacter set GameID5 = '$name' where id ='$newacc'");
    	}
    	$core_db2->Execute("Update ".$coretc['CT']." set ".$coretc['CC']." = '$ncredits' where memb___id=?", array(
    			$user_auth_id
                ));
    	if ($coretc['AllowAcc'] == 1) {		
    	$core_db->Execute("Delete from AllowedTCharacter_List where racc ='$user_auth_id' and sacc ='$newacc'");	
    	}
    	if ($coretc['Logs'] == '1') {		
    	tclog($user_auth_id,''.$name.' has transfered his character to '.$newacc.' account, for '.number_format($rcredits).' Credits.');	  }			
    	}
    }	
    	else {
    		 echo ('No characters were found on your Account.');
    	}
    }	
    			
    ?>

  2. #2
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    150

    Re: Check Code

    what does the function exactly do ? i cant find the function! and what does the error says ? no syntax error but i couldn't find the function !!!
    Itís just begun to began to begin
    To end, to start back again, smarter man and his retarded friend

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Re: Check Code

    for recordcount it reads from db account name and record it
    for the other its counting like ranking #1, #2, #3 , or if its more good to remove them but how should the others do, okey for Execute will replace it with mssql_query about the others idea?
    if you need more info tell me so i can help

  4. #4
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    150

    Re: Check Code

    does this even work ? its like you put another query and the first query is not finished
    PHP Code:
    $core_db->Execute(" Update Character set AccountID ='$newacc' where Name ='$name'; 
        Update AccountCharacter set GameID1 =NULL where GameID1 ='
    $name'; 
        Update AccountCharacter set GameID2 =NULL where GameID2 ='
    $name'; 
        Update AccountCharacter set GameID3 =NULL where GameID3 ='
    $name'; 
        Update AccountCharacter set GameID4 =NULL where GameID4 ='
    $name'; 
        Update AccountCharacter set GameID5 =NULL where GameID5 ='
    $name';
        Update AccountCharacter set GameIDC =NULL where GameIDC ='
    $name';
        "
    ); 
    both execute and recordit did you try mssql_get_last_message(); to see if you get any error ? try to run the function it self and give it some see if any error pops up
    PHP Code:
     $cs mssql_query("SELECT * FROM db");
    if(!
    $cs) {
      die(
    'MSSQL error: ' mssql_get_last_message());

    if it didnt can you paste your functions so we can take a look
    Itís just begun to began to begin
    To end, to start back again, smarter man and his retarded friend

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Re: Check Code

    i manage to fix a lot of the stuff like this, but i cant imagane why not take info from table Character where name='$character' it should display users names there but it shows blank fields with no name
    the problem is in tcresult it should get info from there but i dont see any problem or maybe i make mistake somewhere
    i market with red the 2 fields
    Code:
    <style>
    .tcRTable
    {
    margin-top: 15px;
    background-color: #222222;
    border: 1px solid #444444; 
    border-radius:7px;
    }
    #tcRbg
    {
    background-color: #111111;	
    }
    .infoa
    {
    color: #888888;
    }
    .infob
    {
    color: #CCCCCC;
    }
    .infoc
    {
    color: #CCCCCC;
    font-weight: bold;
    }
    </style>
    
    <? 
    include ("config.php");
    include("transfer_config.php");
    	
        if ($coretc['OnOff'] == '0') {
            echo ('For the moment this page is closed. Please come back later.');
        } else {
    
    $username = secure($_SESSION['user']);
    $query2 = mssql_query("Select credits from memb_credits where memb___id='$username'");
    $row2 = mssql_fetch_row($query2);
    $xonline = mssql_query("Select * from MEMB_STAT where memb___id='$username' and connectstat='1'");
    $online = mssql_num_rows($xonline);
    $accont = mssql_query("Select * from Character where AccountID='$username'");
    $tcinfo = mssql_num_rows($accont);
    
    //$online  =	mssql_query("Select * from MEMB_STAT where memb___id='$username' and ConnectStat='1' ");
    //$credits  = mssql_query("Select * from memb_credits where memb___id='$username'");			
    //$tcinfo = mssql_query("Select * from Character where AccountID='$username'");						
    $tci	= 0;
    $tcresult= '';
    while ($tci < $tcinfo)//->RecordCount()//)  
    {
    $tcin = $tcinfo ; //->fetchrow();//
    $tci++;
    $tcresult.= '<option value="'.($tcin[0]).'">'.htmlspecialchars($tcin[0]).'</option>';
    }
    
    //$character = base64_decode($_POST['tcame']);
    $newacc = $_POST['newacc'];
    $allowacc = $_POST['cacc'];
    $username = secure($_SESSION['user']);
    $character = secure($_POST['character']); // hero name
    
    //$charq = mssql_query("Select name from Character where AccountID='$username'");
    //$tcinfoT = mssql_fetch_row($charq);
    
    $tcinfoT = mssql_query("Select Name from Character where Name ='$character' and AccountID='$username'");
    $gmem = mssql_query("Select Name from GuildMember where Name ='$character' ");	
    $sat = mssql_query("Select racc from AllowedTCharacter_List where racc ='$allowacc' and sacc ='$username' ");
    $sat2 = mssql_query("Select racc from AllowedTCharacter_List where racc ='$username' and sacc ='$newacc' ");		
    $acce = mssql_query("Select memb___id from MEMB_INFO where memb___id ='$allowacc' ");
    $acce2 = mssql_query("Select memb___id from MEMB_INFO where memb___id ='$username' ");
    $gidsn = mssql_query("Select GameID1,GameID2,GameID3,GameID4,GameID5,id from AccountCharacter where id ='$username'");	
    $online2  =	mssql_query("Select ConnectStat from MEMB_STAT where memb___id='$username' ");		
    $rcreditsac = $coretc['ReqCreditsAC'];			
    $rcredits = $coretc['ReqCredits'];	
    $nacredits = $row2[0] - $rcreditsac;
    $ncredits = $row2[0] - $rcredits;			
    
    if ($rcreditsac == 0) {
    $rqai = 'Free';
    $rqat = '';
    }
    elseif ($rcreditsac == 1) {
    $rqai = number_format($rcreditsac);
    $rqat = 'credit';
    }
    else {
    $rqai = number_format($rcreditsac);
    $rqat = 'credits';
    }
    if ($rcredits == 0) {
    $rqc = 'Free';
    }
    else {
    $rqc = number_format($rcredits);
    }
    
    $infoac = '<span class="infoa">Allow Transfer Cost :</span> <span class ="infob">'.$rqai.' '.$rqat.'</span>';
    $info = '<span class="infoa">Current Credits :</span> <span class ="infob">'.number_format($row2[0]).'</span>
    <br><span class="infoa">Transfer Character Cost :</span> <span class ="infob">'.$rqc.'</span>';
    $info2 = '<span class="infoa">Old Credits :</span> <span class ="infob">'.number_format($row2[0]).'</span>
    <br><span class="infoa">New Credits :</span> <span class ="infoc">'.number_format($ncredits).'</span>
    ';
    
    if ($coretc['AllowAcc'] == 1) {
    echo '<table border="0" cellspacing="2" cellpadding="2" width="100%" class="tcRTable">
    		<tr id="tcRbg" >
    		<td style="padding-top: 15px; padding-bottom: 15px;" rowspan="3" ><center>'.$infoac.'</center></td>
    		<center><form action="" method="post" onsubmit="return confirm(\'Are sure you want to allow transfer?\')">		
    		<tr id="tcRbg"><td style="padding-top: 15px; padding-bottom: 15px;" align="center"><span class="infob">Allow transfer for Account :</span></td>
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><input type="text" size="10" maxlength="10"  name="cacc"></td></tr>
    		<tr id="tcRbg"><td style="padding-bottom: 15px;" align="center" colspan="2"><br><button type="submit" id="cacc"  class="button">Confirm</button>
    		</form></center></td></tr></table>';
    }
    	if (isset($_POST['cacc'])) {
    	if ($sat->fields[0]) {
    	echo ("You have already allowed transfer for account $allowacc !");
    	}
    	elseif ($allowacc != check_acc($_POST['cacc'], "")) {
    	echo ('Chosen account name contains characters that are not allowed or is empty.');
    	}
    	elseif (strlen($_POST['cacc'])< 4 || strlen($_POST['cacc']) > 10) {
    	echo ('Error - account name length must be 4-10 Characters.');
    	}
    	elseif ($row2[0] < $rcreditsac) { 
    	echo ('Unable to allow transfer character, Reason: you dont have enough credits.');
    	}
    	elseif ($acce == '') { 
    	echo ('Account not exist !');
    	}	
    	elseif ($_POST['cacc'] == $user_auth_id) {
    	echo ('Are you kidding me?');
    	}
    	else {	
    	echo ("<font color='green'>Transfer character allowed to account $allowacc !</font>");
    	mssql_query("Insert Into AllowedTCharacter_List(sacc,racc)VALUES('$username','$allowacc')");
    	mssql_query("Update MEMB_CREDITS set credits = '$nacredits' where memb___id='$username'");
    	if ($coretc['Logs'] == '1') {		
    	tclog($username,'User has allowed transfer character to '.$allowacc.' account, for '.number_format($rcreditsac).' Credits.');			
    			  }		
    	     }
    	}
    	
    if ((!isset($_POST['tcame']) && !isset($_POST['newacc'])) && ($tcinfo > 0)) 
    	{
    		echo'
    		<table border="0" cellspacing="2" cellpadding="2" width="100%" class="tcRTable">
    		<tr id="tcRbg" >
    		<td style="padding-top: 15px; padding-bottom: 15px;" rowspan="3" ><center>'.$info.'</center></td>
    		<center><form action="" method="post" onsubmit="return confirm(\'Are sure you want to transfer character?\')">
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><span class="infob">Character :</span></td>
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><select name="tcame"><option disabled>- Select -</option>'.$tcresult.'</select></td></tr><br>
    		<tr id="tcRbg"><td style="padding-top: 15px; padding-bottom: 15px;" align="center"><span class="infob">New Account :</span></td>
    		<td style="padding-top: 15px; padding-bottom: 15px;" align="center"><input type="text" size="10" maxlength="10"  name="newacc"></td></tr>
    		<tr id="tcRbg"><td style="padding-bottom: 15px;" align="center" colspan="2"><br><button type="submit" id="newacc"  class="button">Transfer Character</button>
    		</form></center></td></tr></table>
    		';
    	}
    	elseif (isset($_POST['tcame'] ) && isset($_POST['newacc'] )) 
    			{
    	if ($gmem->fields[0] && $coretc['GuildMember'] == 1) {
    	echo ('You have to leave guild before use transfer character function.');
    	}	
    	elseif (strlen($_POST['newacc'])< 4 || strlen($_POST['newacc']) > 10) {
    	echo ('Error - account name lenght must be 4-10 Characters.');
    	}
    	elseif ($newacc != check_acc($_POST['newacc'], "")) {
    	echo ('Chosen account name contains characters that are not allowed or is empty.');
    	}
        elseif (check_nonall($non_all, $newacc)) {
    	echo ('Chosen account name is not allowed.');
    	}
    	elseif ($online->fields[0] == 1) { 
    	echo ('Account is connected on game, please logout.');
    	}
    	elseif ($online2->fields[0] == 1) { 
    	echo ("Account $newacc is connected on game, please logout.");
    	}	
    	elseif ($row2[0] < $rcredits) { 
    	echo ('Unable to transfer character, Reason: you dont have enough credits.');
    	}
    	elseif ($newacc == $user_auth_id ) { 
    	echo ('Are you kidding me?');
    	}
    	elseif ($sat2 == '' && $coretc['AllowAcc'] == 1) {
    	echo ("Account $newacc doesnt allowed transfer character !");
    	}
    	elseif ($acce2 == '') { 
    	echo ('Account doesnt exist !');
    	}
    	elseif ($gidsn->fields[0] > '' && $gidsn->fields[1] > '' && $gidsn->fields[2] > '' && $gidsn->fields[3] > '' && $gidsn->fields[4] > '') {
    	echo ("Account $newacc doesnt have free slot for transfer character !");
    	}
    	elseif (!$tcinfoT->fields[0] ) { 
    	echo ("Character $character doesnt belong to you !");
    	if ($coretc['HackAttempt'] == '1') {
    	tclog($username,'Tried to modify Character Name. (Character doesnt belong to ['.$username.'] or doesnt exist)');
    		}
    	}
    	else {
    	if ($gidsn->fields[5] == '') {
    	mssql_query("Insert Into AccountCharacter(id,GameID1,GameID2,GameID3,GameID4,GameID5,GameIDC)VALUES('$newacc',NULL,NULL,NULL,NULL,NULL,NULL)");
    	}
    	echo ("$character transfered to account $newacc !");
    	echo $info2;
    	mssql_query(" Update Character set AccountID ='$newacc' where Name ='$character'; 
    	Update AccountCharacter set GameID1 =NULL where GameID1 ='$character'; 
    	Update AccountCharacter set GameID2 =NULL where GameID2 ='$character'; 
    	Update AccountCharacter set GameID3 =NULL where GameID3 ='$character'; 
    	Update AccountCharacter set GameID4 =NULL where GameID4 ='$character'; 
    	Update AccountCharacter set GameID5 =NULL where GameID5 ='$character';
    	Update AccountCharacter set GameIDC =NULL where GameIDC ='$character';
    	");
    	if ($gidsn->fields[0] == NULL ) {
    	mssql_query("Update AccountCharacter set GameID1 = '$character' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[1] == NULL ) {
    	mssql_query("Update AccountCharacter set GameID2 = '$character' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[2] == NULL ) {
    	mssql_query("Update AccountCharacter set GameID3 = '$character' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[3] == NULL ) {
    	mssql_query("Update AccountCharacter set GameID4 = '$character' where id ='$newacc'");
    	}
    	elseif ($gidsn->fields[4] == NULL ) {
    	mssql_query("Update AccountCharacter set GameID5 = '$character' where id ='$newacc'");
    	}
    	mssql_query("Update MEMB_CREDITS set credits = '$ncredits' where memb___id='$username'");
    	if ($coretc['AllowAcc'] == 1) {		
    	mssql_query("Delete from AllowedTCharacter_List where racc ='$username' and sacc ='$newacc'");	
    	}
    	if ($coretc['Logs'] == '1') {		
    	tclog($user_auth_id,''.$character.' has transferred his character to '.$newacc.' account, for '.number_format($rcredits).' Credits.');	  }			
    	}
    }	
    	else {
    		 echo ('No characters were found on your Account.');
    	}
    }	
    			
    ?>
    about this i can try make it like this if its normal
    Code:
    $a = mssql_query("Update Character set AccountID ='$newacc' where Name ='$character'"); 
    	$a = mssql_query("Update AccountCharacter set GameID1 =NULL where GameID1 ='$character'"); 
    	$a = mssql_query("Update AccountCharacter set GameID2 =NULL where GameID2 ='$character'"); 
    	$a = mssql_query("Update AccountCharacter set GameID3 =NULL where GameID3 ='$character'"); 
    	$a = mssql_query("Update AccountCharacter set GameID4 =NULL where GameID4 ='$character'"); 
    	$a = mssql_query("Update AccountCharacter set GameID5 =NULL where GameID5 ='$character'");
    	$a = mssql_query("Update AccountCharacter set GameIDC =NULL where GameIDC ='$character'");
    Last edited by diablo21; Aug 18th, 2013 at 07:55 AM.

  6. #6
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    150

    Re: Check Code

    i see another one like that
    PHP Code:
    echo ("$character transfered to account $newacc !");
        echo 
    $info2;
        
    mssql_query(" Update Character set AccountID ='$newacc' where Name ='$character'; 
        Update AccountCharacter set GameID1 =NULL where GameID1 ='
    $character'; 
        Update AccountCharacter set GameID2 =NULL where GameID2 ='
    $character'; 
        Update AccountCharacter set GameID3 =NULL where GameID3 ='
    $character'; 
        Update AccountCharacter set GameID4 =NULL where GameID4 ='
    $character'; 
        Update AccountCharacter set GameID5 =NULL where GameID5 ='
    $character';
        Update AccountCharacter set GameIDC =NULL where GameIDC ='
    $character';
        "
    ); 
    and i should mention the name of the table and row they are case sensitive and in the code i see
    PHP Code:
    $gmem mssql_query("Select Name from GuildMember where Name ='$character' "); 
    but in your note is name='$character'. so try to check if its capital or not cause usualy if you get empty it can be because of that OR syntax error in your query, it may cause because the type of the row cant accept the string.i'm recommending you to use mssql_get_last_message() to findout.

    $tcresult.= '<option value="'.($tcin[0]).'">'.htmlspecialchars($tcin[0]).'</option>';

    whats the dot there ?

    Off Topic : are you trying to make a character transfer for World of warcraft? if that is what server and realm ?!
    Last edited by Pc Monk; Aug 18th, 2013 at 08:05 AM.
    Itís just begun to began to begin
    To end, to start back again, smarter man and his retarded friend

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Re: Check Code

    yes the code is for transfer character
    i had edited my last post with information

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Re: Check Code

    the dot is mistake it should not be there so i removed it but still cant read the rows

  9. #9
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    150

    Re: Check Code

    if its not giving any data to $tcin it means either RecordCount() got a problem or fetchrow() this might be a stupid question but did you include the functions page ? if you did then copy and paste the functions they may be our problem! mssql_get_last_message() is HIGHLY recommended so if there is ANY error in the query that wont let the function to work properly it will tell you use it in both fetchrow and recordcount and makesure there is no error!
    as you know you have to make an if statement for mssql_query and then use the mssql_get_last_message() if the query did not run!
    the code makes me , are you sure theres data in the rows that you are fetching ? (sounds like another stupid question! dont mention )

    PHP Code:
    $tcinfo mssql_query("Select * from Character where AccountID='$username'");                        
    $tci 0;
    $tcresult'';
    while (
    $tci $tcinfo->RecordCount())  
    {
    $tcin $tcinfo->fetchrow();
    $tci++;
    $tcresult'<option value="'.base64_encode($tcin[0]).'">'.htmlspecialchars($tcin[0]).'</option>';

    first of all these capitals makes me sick make sure they are the exact one in the db
    second of all its the while, try to get the records first in another argument then put it in the while, as you know if the recordcount = 0 then the while will not work.
    no syntax error in your mssql_query other than it might be the capital letter problem so whatever the problem is , its in recordcount or fetcharrow.


    GoodDuck
    Itís just begun to began to begin
    To end, to start back again, smarter man and his retarded friend

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Re: Check Code

    the other file that is maded is :
    PHP Code:
    <?

    $coretc
    ['OnOff'] = '1';    // 1 = ON | 0 = OFF
    $coretc['AllowAcc'] = '1';    // 1 = ON | 0 = OFF (Allow Transfer System)
    $coretc['ReqCreditsAC'] = '100'// Required Credits for Allow Transfer Character (0 = Free)
    $coretc['GuildMember'] = '0';    // Guild Check 1 = ON | 0 = OFF
    $coretc['ReqCredits'] = '200'// Required Credits for Transfer Character
    $coretc['Logs'] = '1'// 1 = ON | 0 = OFF
    $coretc['HackAttempt'] = '1'// 1 = ON | 0 = OFF
    $coretc['CT'] = 'MEMB_CREDITS'// Credits Table
    $coretc['CC'] = 'Credits'// Credits Column

    // Non-allowed words in account names, function will check if word exist.
    $non_all = array (
    'Admin',
    '****'
    );


    function 
    check_nonall($list$nname
    {
    foreach(
    $list as $nalist
        {
    if (
    stristr($nname$nalist)) 
            {
    return 
    true;
            }
        }
    }

    function 
    check_acc($ns,$ne)

    $ns ereg_replace("[^A-Za-z0-9".$ne."]"""$ns );
    return 
    $ns
    }

    $core_db "MuOnline";
    function 
    tclog($acc$tcmsg)
    {
    global 
    $core_db;
    $core_db mssql_query("Insert Into TCharacter_Logs(acc,tc_msg,tc_time)VALUES('$acc','$tcmsg',".time().")");
    }

    ?>

  11. #11
    Addicted Member Pc Monk's Avatar
    Join Date
    Feb 2010
    Posts
    150

    Re: Check Code

    give me more information.. did you do all those things that i said ? whats wrong with this file ?
    Last edited by Pc Monk; Aug 20th, 2013 at 09:09 AM.
    Itís just begun to began to begin
    To end, to start back again, smarter man and his retarded friend

  12. #12

    Thread Starter
    Hyperactive Member
    Join Date
    Jul 2009
    Posts
    395

    Re: Check Code

    yes i checked but didnt see any problem about this
    even in capital letters its not the problem, and this file that also copy, its bouth used for this module...
    i cant see why it should not read the tables, okey for $character its like this, tables are like this for sure Charachter > Name
    what else it should be the problem for this, i'm out of ideas to fix this to display character names and to transfer them this $tcresult should be something else for displaying them can you help ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width

Survey posted by VBForums.