[PHP] Nation Transfer Script

  • Konbuyu başlatan Konbuyu başlatan ExtremE
  • Başlangıç tarihi Başlangıç tarihi
Konu Yazar

ExtremE

Mancıklıpır
Haz
436
10
Buyrun..

PHP:
<?php 

include('./anti_inject.php'); 

parth1tr(); 
parth1('100%', 2, 'center'); 
echo 'Nation Transfer ; 
parth2(); 
parth2tr(); 

if (isset($_SESSION['sesuser'])) { 
    if ($_GET['Confirmed'] == 1) { 
        $connect = odbc_connect("$dbname", "$dbuser", "$dbpass"); 
        $query = "SELECT strCharID1, strCharID2, strCharID3 FROM Account_Char WHERE strAccountID ='" . $_SESSION['sesuser'] . "' "; 
        $results = odbc_exec($connect, $query);  
        // Store all char names in var's..... 
        while (odbc_fetch_row($results)) { 
            $char1 = odbc_result($results, 1); 
            $char2 = odbc_result($results, 2); 
            $char3 = odbc_result($results, 3); 
        }  
        // Confirm they have a character 
        if ((empty($char1)) && (empty($char2)) && (empty($char3))) { 
            part1('100%', 1, 1, 'center'); 
            echo '</br>Your not part of a Nation, how do you expect to change it?'; 
            echo '</br></br><a href="./index.php">Back</a></br>'; 
            part2(); 
        } else { 
            // Confirm none of the chars are logged in.. 
            // Updated during the for loop 

            $query = "SELECT count(strCharID) FROM CURRENTUSER WHERE strCharID = '" . $char1 . "' OR strCharID = '" . $char2 . "' OR strCharID = '" . $char3 . "'"; 
            $results = odbc_exec($connect, $query); 
            while (odbc_fetch_row($results)) { 
                $online = odbc_result($results, 1); 
            }  
              if (strlen(trim($online)) > 0) { 
                part1('100%', 1, 1, 'center'); 
                echo '</br>All characters must be logged out of the game first!'; 
                echo '</br></br><a href="./index.php">Back</a></br>'; 
                part2(); 
                die(); 
            }  
            // Check they aren't in a clan on any of 3 characters. 
             
            $query = "SELECT count(Knights) FROM USERDATA WHERE strUserID = '" . $char1 . "' OR strUserID = '" . $char2 . "' OR strUserID = '" . $char3 . "'"; 
            $results = odbc_exec($connect, $query); 
            while (odbc_fetch_row($results)) { 
                $knights = odbc_result($results, 1); 
            }  
            if ($knights != 0) { 
                part1('100%', 1, 1, 'center'); 
                echo '</br>All characters on account have to be clanless.'; 
                echo '</br></br><a href="./index.php">Back</a></br>'; 
                part2(); 
                die(); 
            }  
            $query = "SELECT COUNT(*) FROM NT_LOG WHERE DATEDIFF(Hour,[Date],GETDATE()) < 48 AND Account = '" . $_SESSION['sesuser'] . "'"; 
            $results = odbc_exec($connect, $query); 
            while (odbc_fetch_row($results)) { 
                $logcheck = odbc_result($results, 1); 
            }  
            if ($logcheck > 0) { 
                part1('100%', 1, 1, 'center'); 
                echo '</br>You may only use this feature once every 48hours.'; 
                echo '</br></br><a href="./index.php">Back</a></br>'; 
                part2(); 
                die(); 
            } else { 
                // Get the nation and calculate desired nation 
                $query = "SELECT strAccountID, bNation FROM ACCOUNT_CHAR WHERE strAccountID = '" . $_SESSION['sesuser'] . "'"; 
                $results = odbc_exec($connect, $query); 
                while (odbc_fetch_row($results)) { 
                    $nation = odbc_result($results, 2); 
                }  
                if ($nation == 1) $desiredNation = 2; 
                if ($nation == 2) $desiredNation = 1;  
                // Test 1 
                $check1 = odbc_exec($connect, "SELECT COUNT(*) FROM USERDATA WHERE Nation='" . $desiredNation . "'"); 
                $check2 = odbc_exec($connect, "SELECT COUNT(*) FROM USERDATA"); 

                $tot1 = odbc_result ($check1, 1); 
                $tot2 = odbc_result($check2, 1); 
                if ($tot1 / $tot2 > 0.6) { 
                    part1('100%', 1, 1, 'center'); 
                    echo '</br>Sorry your desired nation has too many users.'; 
                    echo '</br>The desired population must be less than 60% Population!'; 
                    echo '</br></br><a href="./index.php">Back</a></br>'; 
                    part2(); 
                    die(); 
                }  
                // Test 2 
                $check3 = odbc_exec($connect, "SELECT SUM(Loyalty) AS nps FROM TB_USER WHERE Nation='" . $desiredNation . "'"); 
                $check4 = odbc_exec($connect, "SELECT SUM(Loyalty) AS totnps FROM TB_USER"); 
                $nps = odbc_result_all($check3); 
                $totnps = odbc_result_all($check4); 
                if ($nps / $totnps > 0.575) { 
                    part1('100%', 1, 1, 'center'); 
                    echo '</br>Sorry your desired nation has too many National Points.'; 
                    echo '</br>The desired population must be less than 57% total National Points!'; 
                    echo '</br></br><a href="./index.php">Back</a></br>'; 
                    part2(); 
                    die(); 
                } else { 
                    // Calculate the newrace + class of the characters.. 
                    foreach (array($char1, $char2, $char3) as $char) { 
                        if ($char != "") { 
                        $getuser = "SELECT strCharID FROM CURRENTUSER where strCharID = '" . $char . "'"; 
                        $getusere = odbc_exec($connect, $getuser); 
                        $characterID = odbc_result($getusere, 1); 

                        if (strlen(trim($characterID)) > 0) { 
                        $killed = 1; 
                        KillUserAndWait(trim($characterID), $connect); 
                         }  
                            $query = "SELECT strUserID, Race, Class FROM USERDATA WHERE strUserID = '" . $char . "'"; 
                            $results = odbc_exec($connect, $query); 
                            while (odbc_fetch_row($results)) { 
                                $race = odbc_result($results, 2); 
                                $class = odbc_result($results, 3); 
                            }  

                            if ($race < 12) { 
                                $hashmap = array (1 => 11, 2 => 12, 3 => 13, 4 => 13, 11 => 1); 
                                $NewRace = $hashmap[$race]; 
                            } elseif (($race == 12) || ($race == 13) || ($race == 14)) { 
                                if ($class == 201) $NewRace = 1; 
                                elseif ($class == 202) $NewRace = 2; 
                                elseif ($class == 203) $NewRace = 3; 
                                elseif ($class == 204) $NewRace = 4; 
                                elseif ($class == 205) $NewRace = 1; 
                                elseif ($class == 207) $NewRace = 2; 
                                elseif ($class == 209) $NewRace = 3; 
                                elseif ($class == 211) $NewRace = 4; 
                            }  
                            if ($class >= 199) { 
                                $NewClass = $class - 100; 
                            } else { 
                                $NewClass = $class + 100; 
                            }  
                            if (($NewRace == '') || ($NewClass == '')) { 
                                part1('100%', 1, 1, 'center'); 
                                echo 'Error: (Char: ' . $char . ')</br> New Class:'; 
                                echo $NewClass; 
                                echo '</br> New Race:'; 
                                echo $NewRace; 
                                echo '</br> Old Class:'; 
                                echo $class; 
                                echo '</br> Old Race:'; 
                                echo $race; 
                                echo '</br></br><a href="./index.php">Back</a></br>'; 
                                part2(); 
                                die(); 
                            }  
                            $query = "UPDATE USERDATA SET Nation = '" . $desiredNation . "', Race = '" . $NewRace . "', Class = '" . $NewClass . "', Zone = 21, PX = 33550, PZ = 38400, PY = 0 WHERE strUserID = '" . $char . "'"; 
                            $results = odbc_exec($connect, $query); 
                        }  
                    }  
                    $query = "INSERT INTO NT_LOG([Date], Account, Char1, Char2, Char3, NationTo) VALUES (GETDATE(), '" . $_SESSION['sesuser'] . "', '" . $char1 . "', '" . $char2 . "', '" . $char3 . "', '" . $desiredNation . "')"; 
                    $results = odbc_exec($connect, $query); 
                    $query = "UPDATE ACCOUNT_CHAR SET bNation = '" . $desiredNation . "' WHERE strAccountID = '" . $_SESSION['sesuser'] . "'"; 
                    $results = odbc_exec($connect, $query); 
                }  
                // Done 
                part1tr(); 
                part1('100%', 1, 1, 'center'); 
                echo 'Done'; 
echo '</br></br><a href="./index.php">Back</a>'; 
                if ($killed == 1) { echo '</br>A character was disconnected during this process'; } 
                part2(); 
                part2tr(); 
            }  
        }  
    } else { 
        part1tr(); 
        part1('25%', 1, 1, 'center'); 
        echo 'Please confirm your transfer:</br></br></br> 
        <li>You must be <b>logged out</b> of <b>all</b> characters</li> 
        <li>You must be <b>Clanless</b> on <b>all</b> characters</li> 
        <li>You may only use this feature <b>once</b> every 48hours</li> 
        <li>The Desired Nation must be <b>Less Than</b> 60% Total Population </li> 
        <li>The Desired Nation must be <b>Less Than</b> 57.5% Total National Points</li></br></br> 
        <FORM method=post name=confirm action=index.php?act=NationTransfer&Confirmed=1> 
            <input class="input" type="submit" value="Confirm"> 
            </form>'; 
        part2(); 
        part2tr(); 
    }  
} else { 
    part1('100%', 1, 1, 'center'); 
    echo 'You must login first!'; 
    part2(); 
}  

?>

Alıntı
 
Cevap:
PHP:
 Nation Transfer Script[/b]

./anti_inject.php

buraya ayar.php falan mı gelecek !
 
Cevap:
PHP:
 Nation Transfer Script[/b]

wiken servere ne oLdu kof network
 
Cevap:
PHP:
 Nation Transfer Script[/b]

[quote="sa1donder, post: 159166"]./anti_inject.php

buraya ayar.php falan mı gelecek ![/QUOTE]

[B]onu kaldır... Teşekkürler anıl :)[/B]
 
Cevap:
PHP:
 Nation Transfer Script[/b]

Teşekkürler. Biçok kişinin işine yarayacaktır :)
 
Geri
Üst Alt