Bitte helfen i alle Setup eine Login-Seite haben und mit meiner Remote-DatenbankUmleiten zu normalen Benutzer/Aktivierte Benutzerseite nach dem Login
id_number username password UserLevel
1 user user 1
2 Activeuser ActiveUser 2
, möchte ich in der Lage sein, Userlevel zu verwenden, um Benutzer zu ihren jeweiligen umleiten Seiten, dh normaler Benutzer mit Userlevel '1' zu demhboard.php while Aktivierter Benutzer mit Userlevel '2' zu Dashboardactivated.php.
Haben bereits Server-Verhalten in dreamweaver hinzugefügt, aber es scheint nur zu normalen Benutzer mit Userlevel '1' anmelden, während aktivierter Benutzer mit Userlevel '2' auf dieselbe Seite umgeleitet wird. Bitte wie mache ich es mit mir zu tragen Ich bin neu in der Welt der Codierung, also arbeite ich mit Dreamweaver, weil ich nicht die Codes selbst schreiben kann.
Hier ist mein Code:
<?php require_once('Connections/CashSpray.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
}
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$colname_Login = "-1";
if (isset($_SESSION['MM_Username'])) {
$colname_Login = $_SESSION['MM_Username'];
}
mysql_select_db($database_CashSpray, $CashSpray);
$query_Login = sprintf("SELECT * FROM users WHERE Username = %s", GetSQLValueString($colname_Login, "text"));
$Login = mysql_query($query_Login, $CashSpray) or die(mysql_error());
$row_Login = mysql_fetch_assoc($Login);
$totalRows_Login = mysql_num_rows($Login);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['UserName'])) {
$loginUsername=$_POST['UserName'];
$password=$_POST['Password'];
$MM_fldUserAuthorization = "UserLevel";
$MM_redirectLoginSuccess = "dashboard.php";
$MM_redirectLoginFailed = "log-in.php";
$MM_redirecttoReferrer = true;
mysql_select_db($database_CashSpray, $CashSpray);
$LoginRS__query=sprintf("SELECT Username, Password, UserLevel FROM users WHERE Username=%s AND Password=%s",
GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text"));
$LoginRS = mysql_query($LoginRS__query, $CashSpray) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysql_result($LoginRS,0,'UserLevel');
if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
//declare two session variables and assign them
$_SESSION['MM_Username'] = $loginUsername;
$_SESSION['MM_UserGroup'] = $loginStrGroup;
if (isset($_SESSION['PrevUrl']) && true) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess);
}
else {
header("Location: ". $MM_redirectLoginFailed);
}
}
?>
<!DOCTYPE html>
<html dir="ltr" lang="en-US"><head><!-- Created by Artisteer v4.3.0.60745 -->
<meta charset="utf-8">
<title>Log In!</title>
<meta name="viewport" content="initial-scale = 1.0, maximum-scale = 1.0, user-scalable = no, width = device-width">
<!--[if lt IE 9]><script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
<link rel="stylesheet" href="style.css" media="screen">
<!--[if lte IE 7]><link rel="stylesheet" href="style.ie7.css" media="screen" /><![endif]-->
<link rel="stylesheet" href="style.responsive.css" media="all">
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
<script src="jquery.js"></script>
<script src="script.js"></script>
<script src="script.responsive.js"></script>
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationPassword.js" type="text/javascript"></script>
<style>
.art-content .art-postcontent-0 .layout-item-0 { padding-right: 10px;padding-left: 10px; }
.ie7 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
.ie6 .art-post .art-layout-cell {border:none !important; padding:0 !important; }
</style>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css">
<link href="SpryAssets/SpryValidationPassword.css" rel="stylesheet" type="text/css">
</head>
<body>
<div id="art-main">
<header class="art-header">
<div class="art-shapes">
<div class="art-object111552341"></div>
<div class="art-object1196905085"></div>
</div>
</header>
<nav class="art-nav">
<div class="art-nav-inner">
<ul class="art-hmenu"><li><a href="home.php" class="">Home</a></li><li><a href="how-it-works.php" class="">How It Works</a></li><li><a href="sign-up.php" class="">Sign Up</a></li><li><a href="log-in.php" class="active">Log In</a></li><li><a href="contact-us.php">Contact Us</a></li></ul>
</div>
</nav>
<div class="art-sheet clearfix">
<div class="art-pageslider">
<div class="art-shapes">
</div>
<div class="art-slider art-slidecontainerpageslider" data-width="880" data-height="250">
<div class="art-slider-inner">
<div class="art-slide-item art-slidepageslider0">
</div>
<div class="art-slide-item art-slidepageslider1">
</div>
<div class="art-slide-item art-slidepageslider2">
</div>
<div class="art-slide-item art-slidepageslider3">
</div>
</div>
</div>
<div class="art-slidenavigator art-slidenavigatorpageslider" data-left="1" data-top="0">
<a href="#" class="art-slidenavigatoritem"></a><a href="#" class="art-slidenavigatoritem"></a><a href="#" class="art-slidenavigatoritem"></a><a href="#" class="art-slidenavigatoritem"></a>
</div>
</div>
<div class="art-layout-wrapper">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell art-content"><article class="art-post art-article">
<div class="art-postcontent art-postcontent-0 clearfix"><div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-0" style="width: 100%" >
<h2><img width="76" height="81" alt="" class="art-lightbox" src="images/user-login-icon-29.png"><span style="font-weight: bold;"><span style="font-family: Georgia; color: #065179;">Log In!</span></span></h2><h2><span style="font-weight: bold;"><span style="font-family: Georgia; font-size: 20px;">Please Enter Your Correct Details!..</span></span></h2><h2><span style="font-weight: bold;"><br></span></h2>
<form action="<?php echo $loginFormAction; ?>" method="POST" name="LoginForm" id="LoginForm">
<table width="500" border="0">
<tr>
<td> </td>
</tr>
<tr>
<td><span id="sprytextfield1">
<label for="UserName"></label>
UserName <br>
<input type="text" name="UserName" id="UserName">
<span class="textfieldRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><span id="sprypassword1">
<label for="Password"></label>
Password <br>
<input type="password" name="Password" id="Password">
<span class="passwordRequiredMsg">A value is required.</span></span></td>
</tr>
<tr>
<td><p>
</p>
<p>
<input name="LoginButton" type="submit" class="art-button" id="LoginButton" value="Login">
</p></td>
</tr>
<tr>
<td>Dont Have An Account Yet? <a href="sign-up.php"><u>Sign Up.</u></a></td>
</tr>
</table>
</form>
<h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span></h2><h2><span style="font-weight: bold;"><br></span><br></h2>
</div>
</div>
</div>
</div>
</article></div>
</div>
</div>
</div>
</div>
<footer class="art-footer">
<div class="art-footer-inner">
<div class="art-content-layout">
<div class="art-content-layout-row">
<div class="art-layout-cell layout-item-0" style="width: 100%">
<p><span style="font-size: 16px; color: #FFFFFF;">Copyright © 2017, CASHSPRAY. All Rights Reserved.</span></p>
</div>
</div>
</div>
<p class="art-page-footer">
<span id="art-footnote-links">Designed by <a href="cashspray.com" target="_blank">CashSpray</a>.</span>
</p>
</div>
</footer>
</div>
<script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1");
var sprypassword1 = new Spry.Widget.ValidationPassword("sprypassword1");
</script>
</body></html>
<?php
mysql_free_result($Login);
?>
Ihr Code ist ein Durcheinander. Bitte verwenden Sie mysqli vorbereitete Anweisungen/PDO vorbereitete Anweisungen, so können Sie einen sauberen Code haben –
Warum würde jemand solche Frage –
keine Idee upvote. Er hat 0 Kenntnisse und ich habe einen zufälligen Code als Antwort eingegeben, der einfach funktionieren sollte. aber er kann nicht einmal eine einfache if-Anweisung erhalten. –