Hallo PHP.de Community,
ich versuche eine homepage etwas schöner zu machen, jedoch ist leider die Funktionstüchtigkeit von meiner register-Seite abhanden geraten -.-
Hier was ich gemacht habe:
vorher (funktionsfähig):
nacher (nicht funktionsfähig):
Also wenn ich irgendeinen Schrott in das Alte eingegeben hatte dann kam ne Fehlermeldung jetzt kommt nichts mehr und falls ich was gutes eingebe werde ich auch nicht in der DB registriert -.-
Hier noch das "modules/reg_m.php"
Hoffe ihr könnt mir weiterhelfen, hab schon alles mögliche probiert und meines erachtens nach sollte es gehen da ja die grobe Struktur genauso ist wie die vorherige, aber leider gehts nicht -.-
Grüße Jeazyee
ich versuche eine homepage etwas schöner zu machen, jedoch ist leider die Funktionstüchtigkeit von meiner register-Seite abhanden geraten -.-
Hier was ich gemacht habe:
vorher (funktionsfähig):
PHP-Code:
<?php
require "header.php";
require "modules/reg_m.php";
?>
<div class="case">
<div class="content">
<div class="news">
<div class="news-title"><center>Account Registration</center></div>
<div>
<table align="center">
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<tr>
<td width="150px">Login:</td>
<td><input type="text" class="field-reg" name="name" ></td>
</tr>
<tr>
<td width="150px">Password:</td>
<td><input type="password" class="field-reg" name="pass1" ></td>
</tr>
<tr>
<td width="150px">Repeat Password:</td>
<td><input type="password" class="field-reg" name="pass2"></td>
</tr>
<td width="150px">Your E-Mail:</td>
<td><input type="text" class="field-reg" name="mail"></td>
</tr>
<tr>
<td width="150px"><img src="modules/captcha.php"/></td>
<td><input type="text" class="field-reg" name="code" /></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" class="button-submit dark-shadow" value="Create" name="submit" ></td>
</tr>
</form>
</table>
<?php if(!empty($reg_error)) echo '<div class="error" align="center">'.$reg_error.'</div>'; ?>
<?php if(!empty($reg_success)) echo '<div class="accept" align="center">'.$reg_success.'</div>'; ?>
</div>
</div>
</div>
</div>
<?php require "sidebar.php"; ?>
<?php require "footer.php"; ?>
PHP-Code:
<?php
require "header.php";
require "modules/reg_m.php";
?>
<section>
<div class="full-screen dark section nopadding nomargin noborder ohidden" style="background-image: url('images/slider/swiper/7.jpg'); background-size: cover; background-position: center center;">
<div class="row nomargin" style="position: relative; z-index: 2;">
<div class="col-md-offset-7 col-md-5 full-screen" style="background-color: rgba(0,0,0,0.45);">
<div class="vertical-middle col-padding">
<div class="heading-block nobottomborder bottommargin-sm">
<h1 style="font-size: 22px;">Register now!</h1>
<span style="font-size: 16px;" class="t300 capitalize ls1 notopmargin">Get Started within a Minute.</span>
</div>
<form action='<?php echo $_SERVER['PHP_SELF']; ?>' method="POST" class="clearfix" style="max-width: 300px;">
<div class="col_full">
<label for="" class="capitalize t600">Choose Username</label>
<input type="text" id="template-op-form-text" name="name" value="" class="form-control not-dark" />
</div>
<div class="col_full">
<label for="" class="capitalize t600">Choose Password</label>
<input type="password" id="template-op-form-password" name="pass1" value="" class="form-control not-dark" />
</div>
<div class="col_full">
<label for="" class="capitalize t600">Reenter Password</label>
<input type="password" id="template-op-form-password" name="pass2" value="" class="form-control not-dark" />
</div>
<div class="col_full">
<label for="" class="capitalize t600">Your E-mail</label>
<input type="mail" id="template-op-form-email" name="mail" value="" class="form-control not-dark" />
</div>
<div class="col_full">
<label for="" class="capitalize t600">Captcha: </label><img src="modules/captcha.php"/>
<input type="text" id="template-op-form-text" name="code" value="" class="form-control not-dark" />
</div>
<div class="col_full nobottommargin">
<button type="submit" class="t400 capitalize button button-border button-light button-circle nomargin" value="submit">Register Now</button>
</div>
</form>
<p class="nobottommargin"><small class="t300"><em>* By clicking "Register Now" you accept our ToS!</em></small></p>
<?php if(!empty($reg_error)) echo '<p class="nobottommargin"><small class="t300"><em>'.$reg_error.'</em></small></p>'; ?>
<?php if(!empty($reg_success)) echo '<p class="nobottommargin"><small class="t300"><em>'.$reg_success.'</em></small></p>'; ?>
</div>
<!-- <a href="#" data-scrollto="#section-about" data-easing="easeInOutExpo" data-speed="1250" data-offset="65" class="one-page-arrow dark"><i class="icon-angle-down infinite animated fadeInDown"></i></a> -->
</div>
</div>
<div class="video-wrap" style="z-index:1;">
<div class="video-overlay" style="background: rgba(0,0,0,0.2);"></div>
</div>
</div>
</section>
<?php require "sidebar.php"; ?>
<?php require "footer.php"; ?>
Hier noch das "modules/reg_m.php"
PHP-Code:
<?php
if(isset($_POST['submit']))
{
if(!empty($_POST['name']) && !empty($_POST['pass1']) && !empty($_POST['pass2'])& !empty($_POST['mail']) && !empty($_POST['code']))
{
$code = strtolower($_POST['code']);
if($code == $_SESSION['rand_code'])
{
if(!empty($_POST))
{
$name = $_POST["name"];
$pass1 = $_POST["pass1"];
$pass2 = $_POST["pass2"];
$mail = trim($_POST["mail"]);
if($pass1 != $pass2)
{
$reg_error = "Passwords do not match";
}
else
{
if ( !preg_match("/^([a-z0-9]([\-\_\.]*[a-z0-9])*)+@([a-z0-9]([\-]*[a-z0-9])*\.)+[a-z]{2,6}$/i", $mail) OR empty( $mail ) OR strlen( $mail ) > 50)
{
$reg_error .= "Not correctly filled field E-Mail";
}
else
{
$name = trim(mysql_real_escape_string($_POST["name"]));
$pass1 = trim(mysql_real_escape_string($_POST["pass1"]));
$pass2 = trim(mysql_real_escape_string($_POST["pass2"]));
$cnt = $sql_ls->result($sql_ls->query("SELECT count(*) FROM `account_data` WHERE `name`='$name'"),0);
if($cnt > 0)
{
$reg_error = "Name busy";
}
else
{
$password = trim($pass1);
$password = base64_encode(sha1($password, true));
$sql_ls->query("INSERT INTO `account_data` (`name`,`password`,`email`) VALUES ('$name','$password','$mail')");
$reg_success = "Welcome, ".$name;
}
}
}
}
}
else
{
$reg_error = "Verification code does not match";
}
}
else
{
$reg_error = "Fill in all fields";
}
}
Grüße Jeazyee
Kommentar