Salve,
ho questo script di autorizzazione che sto convertendo in php 7
Ho riscritto " $loginStrGroup = mysqli_result($LoginRS,0,'AuthLev'); " come segue ma non mi funziona:
any help ?
ho questo script di autorizzazione che sto convertendo in php 7
PHP:
if (!isset($_SESSION)) {
session_start();
}
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck'];
}
if (isset($_POST['username'])) {
$loginUsername=mysqli_real_escape_string($tao_conn, $_POST['username']);
$password=mysqli_real_escape_string(sha1($tao_conn, $_POST['password']));
$MM_fldUserAuthorization = "AuthLev";
$MM_redirectLoginSuccess = "index.php";
$MM_redirectLoginFailed = "loginSorry.php";
$MM_redirecttoReferrer = false;
mysqli_select_db($tao_conn, $database_tao_conn);
$LoginRS__query=sprintf("SELECT username, password, AuthLev FROM adminauth WHERE username=%s AND password=%s",
GetSQLValueString($tao_conn,$loginUsername, "text"), GetSQLValueString($tao_conn,$password, "text"));
$LoginRS = mysqli_query($tao_conn,$LoginRS__query) or die(mysqli_error($tao_conn));
$loginFoundUser = mysqli_num_rows($LoginRS);
if ($loginFoundUser) {
$loginStrGroup = mysqli_result($LoginRS,0,'AuthLev');
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']) && false) {
$MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
}
header("Location: " . $MM_redirectLoginSuccess );
}
else {
header("Location: ". $MM_redirectLoginFailed );
}
Ho riscritto " $loginStrGroup = mysqli_result($LoginRS,0,'AuthLev'); " come segue ma non mi funziona:
PHP:
$field = AuthLev ;
mysql_data_seek($LoginRS,0);
if( !empty($field) ) {
while($finfo = mysqli_fetch_field( $LoginRS )) {
if( $field == $finfo->name ) {
$f = mysqli_fetch_assoc( $LoginRS );
$loginStrGroup = $f[ $field ];
}
}
} else {
$f = mysqli_fetch_array( $LoginRS );
$loginStrGroup = $f[0];
}
any help ?