Heyho, ich bastel derzeit an ner kleinen Website,
Nun hab ich das problem, falls der account Ein Adminlevel hat, das jeder 2. login versuch fehlerhaft ist,
d.h. er will sich normal als user einloggen, obwohl er einen Adminrang hat, ich finde aber keinen Fehler.
In der tabelle hab ich ein Adminrang von 5
Code:
PHP
<?phprequire_once('../../lib/global.php');mysql_query("UPDATE `sites` SET logins=logins+1");?><!DOCTYPE html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="description" content="fresh Gray Bootstrap 3.0 Responsive Theme "/> <meta name="keywords" content="Template, Theme, web, html5, css3, Bootstrap,Bootstrap 3.0 Responsive Theme" /> <meta name="author" content="Mindfreakerstuff"/> <body style="background-image:url(../../bs/img/background.jpg)"> <title><?php echo $WebInfo->sitename ?> - Login</title> <!-- Bootstrap core CSS --> <link href="../../bs/css/bootstrap.css" rel="stylesheet"> <!-- Custom styles for this template --> <link href="../../bs/css/login.css" rel="stylesheet"> <link href="../../bs/css/animate-custom.css" rel="stylesheet"> <!-- HTML5 shim and Respond.js IE8 support of HTML5 elements and media queries --> <!--[if lt IE 9]> <script src="js/html5shiv.js"></script> <script src="js/respond.min.js"></script> <![endif]--> <script src="../../bs/js/custom.modernizr.js" type="text/javascript" ></script> </head> <body> <!-- start Login box --> <div class="container" id="login-block"> <div class="row"> <div class="col-sm-6 col-md-4 col-sm-offset-3 col-md-offset-4"> <h3 class="animated bounceInDown">Login</h3> <div class="login-box clearfix animated flipInY"> <div class="login-logo"> <a href="../../index.php"><img src="../../bs/img/login-logo.png" alt="Company Logo" /></a> </div> <hr /> <div class="login-form"> <div class="alert alert-error hide"> <button type="button" class="close" data-dismiss="alert">×</button> <h4>Error!</h4> Your Error Message goes here </div> <?php if(isset($_POST['submit'])) { if(empty($_POST['Name']) OR empty($_POST['Password'])){ echo 'Bitte fuelle alle Felder aus!<br />'; goto hier; } else { $Names = mysql_real_escape_string($_POST['Name']); $PW = mysql_real_escape_string($_POST['Password']); $ip = mysql_real_escape_string(getenv ("REMOTE_ADDR")); if(mysql_num_rows(mysql_query("SELECT id FROM accounts WHERE Name = '$Names' AND Passwort = '$PW'")) == 1) { $_SESSION['username'] = $Names; mysql_query("UPDATE `accounts` SET `IP`='$ip' WHERE `Name`='$Names'"); if($SpielerInfo->Adminlevel >= 1) { header('Location: ../acp/index.php'); } else { header('Location: acp/normal.php'); } } else { echo 'Falsche Zugangsdaten<br />'; goto hier; } } } else { hier: ?> <form action="login.phtml" method="post" class="form-signin" role="form"> <input name="Name" type="text" class="form-control" placeholder="Benutzername" required autofocus> <input name="Password" type="password" class="form-control" placeholder="Passwort" required> <input type="submit" class="btn btn-red" value="Einloggen" name="submit"> </form> <div class="login-links"> <a href="pwvergessen.phtml"> Passwort Vergessen? </a> <br /> <a href="register.phtml"> <strong>Registrieren</strong> </a> </div> <?php } ?> </div> </div> </div> </div> </div> <!-- End Login box --> <div style="color: #fff; height: 40px; width: 100%; background-color: rgba(0, 0, 0, 0.7); position: fixed; bottom: 0; border-top: 1px solid rgba(0, 0, 0, 0.95); z-index: 100000; "> <div style="padding: 10px 0 0 25px;"> <center>© <?php echo $WebInfo->sitename; ?> <? echo date("Y"); ?></a> </center> </div> </div> <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> <script>window.jQuery || document.write('<script src="../../bs/js/jquery-1.9.1.min.js"><\/script>')</script> <script src="../../bs/js/bootstrap.min.js"></script> <script src="../../bs/js/placeholder-shim.min.js"></script> <script src="../../bs/js/custom.js"></script> </body></html>
Das adminlevel hole ich mir über die "Global.php" darüber.
PHP
if(isset($_SESSION['username'])) { $SpielerInfo = mysql_fetch_object(mysql_query("SELECT * FROM accounts WHERE Name = '".$_SESSION['username']."'")); }
Ich wäre über hilfe dankbar
MfG Slash
/Push.