Register script funzt nicht

03/03/2016 15:25 Crypt3c#1
hey habe nen register script geschrieben was aber leider nicht funzt :/ kann jemand mal drüberschauen? Errors erscheinen auch keine.

functions.php
PHP Code:
<?php

$server 
"127.0.0.1:3307";
$user "root";
$password "";
$_data "_data";
$_db "_db";
$_auth "_auth";
$_post "_post";
$pwsalt "phoohie1yaihooyaequae7PuiWoeNgahjieth3ru3yeeghaepahb7aeYaipe2we6zii6mai6uweig8siasheinoungeoyeiLohShi2xoh2xi8ooxee9ahpiehahc9Phe";

$con mysqli_connect($server$user$password) or exit(mysqli_error());

function 
con_data () {
    global 
$con$_data;
    
mysqli_select_db($con$_data) or exit(mysqli_error());
}

function 
con_db () {
    global 
$con$_db;
    
mysqli_select_db($con$_db) or exit(mysqli_error());
}

function 
con_auth () {
    global 
$con$_auth;
    
mysqli_select_db($con$_auth) or exit(mysqli_error());
}

function 
con_post () {
    global 
$con$_post;
    
mysqli_select_db($con$_post) or exit(mysqli_error());
}

?>
register.php
PHP Code:
<link href="css\styles.css" rel="stylesheet" type="text/css" />
<?php include ("footer.php"); ?>
<?php 
include ("navigation.php"); ?>
<?php 
include ("slideshow.php"); ?>
<?php 
include ("functions.php"); ?>
<div class="content">

<?php

con_auth
();

if(isset(
$_GET['register'])) {
    
$submit $_POST ['submit'];
    
$user_id $_POST ['user_id'];
    
$password $_POST ['password'];
    
$password2 $_POST ['password2'];
    
$email $_POST ['email'];


    if (
$submit) {

        if (empty(
$_POST['user_id'])) {
            echo 
"<br> [ERROR] Please fill in a username! <br>";
            
?>
            <meta http-equiv='refresh' content='5' ; URL=register.php">
            <?php
        
} elseif (empty($_POST['password'])) {
            echo 
"<br> [ERROR] Please fill in a password! <br>";
            
?>
            <meta http-equiv='refresh' content='5' ; URL=register.php">
            <?php
        
} elseif (empty($_POST['email'])) {
            echo 
"<br> [ERROR] Please fill in a e-mail! <br>";
            
?>
            <meta http-equiv='refresh' content='5' ; URL=register.php">

            }
            <?php
            
die;

            if ((
$_POST['password']) != ($_POST['password2'])) {
                echo 
"<br> [ERROR] Password must the same as Repeat Password!<br>";

                
?>

                <meta http-equiv='refresh' content='5' ; URL=register.php">

                <?php
                
die;
            }


            
$con = new mysqli($server$user$password$db_auth);

            
$mailresult "SELECT * FROM bg_user WHERE email = '$email'";
            
$mailres $con->query($mailresult);


            if (
$mailres->num_rows 0) {
                echo 
"<br> [ERROR] E-mail is already linked to another account. Please choose a new e-mail! <br>";
                
?>

                <meta http-equiv='refresh' content='5' ; URL=register.php">

                <?php
                
die;
            }


            
$user_result "SELECT * FROM bg_user WHERE user_id = '" $user_id "';";
            
$userres $con->query($user_result);

            If (
$userres->num_rows 0) {
                echo 
" <br> [ERROR] Accountname is in use! Please choose another account name!  ";
                
?>

                <meta http-equiv='refresh' content='5' ; URL=register.php">

                <?php
                
die;
            } else {

                
$cryptpasswd hash("sha256"$user_id $salt $password);

                
$queryreg mysqli_query("INSERT INTO bg_user (user_id, passwd, email)
                                VALUES ('
$user_id', '$cryptpasswd', '$email')");

                echo 
" <br>Succes ! Account created ! <br>";

            }

        }

    }
}

?>

<br/>


<form action='register.php' method='POST'>
    Username:<br/>
    <input type='text' class="texta"  name='user_id' size="30" maxlength="12">
    <br/>
    Password:<br/>
    <input type='password' class="texta"  name='password' size="30" maxlength="12">
    <br/>
    Repeat Password:<br/>
    <input type='password' class="texta" name='password2' size="30" maxlength="12">
    <br/>
    Email:<br/>
    <input type='text' class="texta" name='email' size="30" maxlength="12">
    <br>
    <br/>
    <input type='submit' class="buttonz" name='submit' style='padding:0px; padding-right: 0px; font-size:14px;  ' value=' Register '>
</form>

</div>
03/03/2016 16:57 NotEnoughForYou#2
Bist du sicher, dass du 127.0.0.1:3307 willst? Normalerweise ist 3306 der standard Mysqlport.

Einfach mal die php Fehler einschalten in der php.ini und schon weiss man mehr.

Btw.: Nutz nicht soviel globale Variablen. Das kann man eleganter anders lösen.
03/03/2016 17:07 Barca x3#3
Naja, MySQL kann doch von 3305-3308 laufen, wobei 3307 und 3308 meistens als SSL Ports genutzt werden wenn ich mich nicht irre. - Bzw wenn umgestellt auf jedem Port :D

Aber wie NotEnoughForYou bereits gesagt hat -> error_reporting(E_ALL) :)
03/03/2016 17:07 Crypt3c#4
Quote:
Originally Posted by NotEnoughForYou View Post
Bist du sicher, dass du 127.0.0.1:3307 willst? Normalerweise ist 3306 der standard Mysqlport.

Einfach mal die php Fehler einschalten in der php.ini und schon weiss man mehr.

Btw.: Nutz nicht soviel globale Variablen. Das kann man eleganter anders lösen.
ja habe den port umgestellt da 3306 von skype benutzt wird, teste im moment nur auf meinem pc.

EDIT: Hab gerade im php error log geschaut, dort werden auch keine fehler ausgegeben

error_reporting steht auf E_ALL und immernoch nichts :(

Kann es vllt daran liegen das ich dies mit html eingebaut hab und es da irgendwie zu errors kommt?
<meta http-equiv='refresh' content='5' ; URL=register.php">

weil normal müsste es ja einen fehler ausgeben wenn ich zb in ein feld nichts eingebe doch es passiert nichts
03/03/2016 20:16 ~ JWonderpig ~#5
Meines Wissens nach nutzt Skype Port 80.

Schon mal mit
PHP Code:
if (isset($submit)) { 
...

getestet?
03/03/2016 23:55 Crypt3c#6
Quote:
Originally Posted by ~ JWonderpig ~ View Post
Meines Wissens nach nutzt Skype Port 80.

Schon mal mit
PHP Code:
if (isset($submit)) { 
...

getestet?
hat leider nicht geholfen:o
03/04/2016 03:10 algernong#7
Wieso sollte $_GET['register'] gesetzt sein?

Im Allgemeinen: Mit echo schauen, welcher Teil vom Code ausgeführt wird und welcher nicht. Dann weißt du, was nicht klappt, und kannst das (z.B. eine Bedingung, die false ist, aber true sein sollte) genau untersuchen mit ganz vielen Ausgaben.
03/04/2016 14:49 .Barone#8
Du verwendest POST, fragst aber, ob GET gesetzt ist..
Verwende anstatt if(isset($_GET['register'])) - if(isset($_POST['register']))