Register for your free account! | Forgot your password?

Go Back   elitepvpers > Coders Den > Web Development
You last visited: Today at 15:01

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Mysql import/auslese frage

Discussion on Mysql import/auslese frage within the Web Development forum part of the Coders Den category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Jun 2010
Posts: 762
Received Thanks: 85
Mysql import/auslese frage

Code:
<style type="text/css">
body {
padding-top:200px;
font-family:Verdana;
}

</style>
<?php
ini_set('display_errors', 'Off');

function Error($Error)
{
    echo "<br /><br /><br /><br /><br /><br /><center><b><span style='color:#CD0000;'> " . $Error . "</span></b></center>";
}
function ConnectMysql()
{
    include("configs.php");
    $link=mysql_connect("" . $mysql_host . "","" . $mysql_user . "","" . $mysql_pass . "");
    
    if(!$link) {
    echo "Cannot connect to database!";
    }else{
    mysql_select_db("". $mysql_db . "",$link);
    }
}

function register()
{
include('configs.php');

if($core == 1) {
        if(isset($_POST['flags'])) {
        if($_POST['flags'] == "0") {
        $flags = "0";
        }elseif($_POST['flags'] == "8") {
        $flags = "1";
        }elseif($_POST['flags'] == "24") {
        $flags = "2";
        }
        
        }else{ echo '<script type="text/javascript">window.location = "index.php?error=Please select an expansion.";</script>'; exit(); }
        ConnectMysql();
        $user_chars = "#[^a-zA-Z0-9_\-]#";
        
        if ((empty($_POST["user"]))||(empty($_POST["password"])) ) {
                echo '<script type="text/javascript">window.location = "index.php?error=You did not enter all the required information.";</script>';
        } else {
                $username = strtoupper($_POST["user"]);
                $password = strtoupper($_POST["password"]);
                if (strlen($username) < 3) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Username is too short.";</script>';
                        exit();
                };
                if (strlen($username) > 30) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Username is too long.";</script>';
                        exit();
                };
                if (strlen($password) < 3) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Password is too short.";</script>';
                        exit();
                };
                if (strlen($password) > 30) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Password is too long.";</script>';
                        exit();
                };
                if (preg_match($user_chars,$username)) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Please only use A-Z and 0-9.";</script>';
                        exit();
                };
                if (preg_match($user_chars,$password)) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Please only use A-Z and 0-9.";</script>';
                        exit();
                };
                $username = mysql_real_escape_string($username);
                $password = mysql_real_escape_string($password);
                $qry = mysql_query("SELECT username FROM account WHERE username = '" . $username . "'");
                if (!$qry) {
                    echo '<script type="text/javascript">window.location = "index.php?error=Error querying database.";</script>';
                    exit();
                };
                if ($existing_username = mysql_fetch_assoc($qry)) {
                        foreach ($existing_username as $key => $value) {
                                $existing_username = $value;
                        };
                };
                $existing_username = strtoupper($existing_username);
                if ($existing_username == strtoupper($_POST['user'])) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Chosen username is already taken!";</script>';
                        exit();
                };
                unset($qry);
                $sha_pass_hash = sha1(strtoupper($username) . ":" . strtoupper($password));
                $register_sql = "INSERT INTO account (username, sha_pass_hash, expansion) VALUES ('" . $username . "','" . $sha_pass_hash . "','" . $flags . "')";
                $qry = mysql_query($register_sql);
                if (!$qry) {
                    echo '<script type="text/javascript">window.location = "index.php?error=Error creating account.";</script>';
                    exit();
                };
                echo '<br /><br /><br /><br /><br /><br /><center><span style="color:#00FFFF;">Your Account was successfully created!<br /></span></center>';
        };

}elseif($core == 2) {

        if(isset($_POST['flags'])) { $flags = "" . $_POST['flags'] . ""; }else{ echo '<script type="text/javascript">window.location = "index.php?error=Please select an expansion.";</script>'; exit(); }
        ConnectMysql();
        $user_chars = "#[^a-zA-Z0-9_\-]#";
        
        if ((empty($_POST["user"]))||(empty($_POST["password"])) ) {
                echo '<script type="text/javascript">window.location = "index.php?error=You did not enter all the required information.";</script>';
        } else {
                $username = strtoupper($_POST["user"]);
                $password = strtoupper($_POST["password"]);
                if (strlen($username) < 3) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Username is too short.";</script>';
                        exit();
                };
                if (strlen($username) > 30) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Username is too long.";</script>';
                        exit();
                };
                if (strlen($password) < 3) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Password is too short.";</script>';
                        exit();
                };
                if (strlen($password) > 30) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Password is too long.";</script>';
                        exit();
                };
                if (preg_match($user_chars,$username)) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Please only use A-Z and 0-9.";</script>';
                        exit();
                };
                if (preg_match($user_chars,$password)) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Please only use A-Z and 0-9.";</script>';
                        exit();
                };
                $username = mysql_real_escape_string($username);
                $password = mysql_real_escape_string($password);
                $qry = mysql_query("SELECT login FROM accounts WHERE login = '" . $username . "'");
                if (!$qry) {
                    echo '<script type="text/javascript">window.location = "index.php?error=Error querying database.";</script>';
                    exit();
                };
                if ($existing_username = mysql_fetch_assoc($qry)) {
                        foreach ($existing_username as $key => $value) {
                                $existing_username = $value;
                        };
                };
                $existing_username = strtoupper($existing_username);
                if ($existing_username == strtoupper($_POST['user'])) {
                        echo '<script type="text/javascript">window.location = "index.php?error=Chosen username has already been taken.";</script>';
                        exit();
                };
                unset($qry);
                $register_sql = "INSERT INTO accounts (login, password, flags) VALUES ('" . $username . "','" . $password . "','" . $flags . "')";
                $qry = mysql_query($register_sql);
                if (!$qry) {
                    echo '<script type="text/javascript">window.location = "index.php?error=Error creating account.";</script>';
                    exit();
                };
                echo '<br /><br /><br /><br /><br /><br /><center><span style="color:#00FFFF;">Your account was successfully created!<br /></span></center>';
        };
}
}
?>
Das ist n regi code, werden die profis sofort sehen^^
Ich hätte gerne dass dass das script während des tätigen der "$register_sql" (also eintragen in tabelle "account" aus der "Account" tabelle die spalte "accountId" ausliest mit 1 addiert und in die tabelle "rbac_account_groups" einträgt mit den zusätzlichen spalten "groupId", wert immer 1 und "realmId", wert immer -1.

Wenn mir wer weiterhelfen würde, es wäre obernice - lG
Ammonit is offline  
Old 07/11/2013, 15:48   #2
 
kissein's Avatar
 
elite*gold: 0
Join Date: Sep 2005
Posts: 427
Received Thanks: 87
Ich habe mir den Quellcode nicht gänzlich angesehen, aber das hier müsste bereits genügen laut der erklärung

Quote:
$register_sql2 = mysql_query("SELECT accountid FROM accounts");
$ids = mysql_num_rows($register_sql2);
$register_sql3 = "INSERT INTO rbac_account_groups (accountid, groupid, realmid) VALUES ($ids + 1 , 1, -1)";
kissein is offline  
Thanks
1 User
Old 07/11/2013, 19:25   #3
 
elite*gold: 0
Join Date: Jun 2010
Posts: 762
Received Thanks: 85
Quote:
Originally Posted by kissein View Post
Ich habe mir den Quellcode nicht gänzlich angesehen, aber das hier müsste bereits genügen laut der erklärung
Sieht gut aus aber hatte jetzt nicht funktioniert wie ich das eingefügt habe vielleicht kannst du das nochmal in den code eingefügt posten
Ammonit is offline  
Reply


Similar Threads Similar Threads
BF BC2 Uk Import Frage.
08/02/2011 - Consoles - 10 Replies
Hallo, ich will mir vielleicht BF BC2 für die Ps3 holen, und da der UK import um einiges(ca. 20 €) billiger ist, und trotzdem auf deutsch umstellbar ist, wollte ich mir halt die UK import Version kaufen. Ok, eine frage dazu, ich kann doch trotzdem ganz "normal" online spielen, auch mti denen, die die (sag ich mal) normale version haben, oder ?! Danke. MFg
Frage wegen UK import
04/20/2011 - Consoles - 11 Replies
Ich habe gerade auf amazon bissl rumgeschaut nach 2 spielen die ich mir kaufen wollte Resonance of Fate : Amazon.de: Games Star Ocean: The Last Hope International : Amazon.de: Games Und bei beiden steht uk import hinten dran und sie sind billiger als die version ohen das uk import hintendran. Meine frage ist was bedeutet dieses uk import eig und wo ist der haken. Wenn dies die falsche section ist entschuldige ich mich :S
d2nt frage - import/include ?
08/16/2010 - Diablo 2 - 4 Replies
moin ^^ erstmal, ich wusste nicht wo ich das reinschreiben soll da sich die frage keiner d2nt-variation konkret zuordnen lässt ^^ also sry fürs neue topic ^^ geht um folgendes - gibts in den d2nt scripts sone art include-anweisung? - also konkret möchte ich aus den char-configs z.b. die angriffseinstellung, die botroute etc auslagern damit ich das nicht für jeden char seperat einstellen muss ^^
CD key auslese Probleme
08/15/2010 - Diablo 2 - 0 Replies
Also ich will meinen CD key auslesen, das Problem ist nur , das wenn ich den Neuen Von 1.13 benutze Kommt mir diese Fehlermeldung: http://img717.imageshack.us/img717/1599/22323619. png Und bei dir 1.12 Version kommt dieser: http://img835.imageshack.us/img835/4012/93893629. png Aber wenn ich auf 1.12 Umpatchen will kommt diese Meldung: http://img69.imageshack.us/img69/8466/72699255.pn g EDIT: ]Hat sich schon erledigt wusste nicht das der für 1.13 in den Diablo II Ordner muss



All times are GMT +1. The time now is 15:02.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.