witam serwer lokalny to wamp serwer
błędy:
! ) Notice: Undefined offset: 0 in C:\wamp64\www\cms\sk_login\login.php on line 11
Call Stack
# Time Memory Function Location
1 0.0012 251536 {main}( ) ...\login.php:0
[
Strict standards: Only variables should be passed by reference in C:\wamp64\www\cms\sk_login\models\m_auth.php on line 14
Call Stack
# Time Memory Function Location
1 0.0012 251536 {main}( ) ...\login.php:0
2 0.0114 290880 Auth->validateLogin( ) ...\login.php:14
Fatal error: Call to undefined method Template::rediretc() in C:\wamp64\www\cms\sk_login\login.php on line 21
Call Stack
# Time Memory Function Location
1 0.0012 251536 {main}( ) ...\login.php:0
A to skrypty:
login.php
<?php
include("includes/database.php");
include("includes/init.php");
if(isset($_POST['submit'])) {
$Template->setData('input_user', $_POST['username']);
$Template->setData('input_pass', $_POST['password']);
if($_POST['username' == ''] || $_POST['password'] == '') {
$Template->setAlert('Uzupełnij wymagane pola!!!', 'error');
$Template->load("views/v_login.php");
} else if($Auth->validateLogin($Template->getData('input_user'), $Template->getData('input_pass') == FALSE)) {
$Template->setAlert('Nieprawidłowy login lub hasło!!!', 'error');
$Template->load("views/v_login.php");
} else {
$_SESSION['username'] = $Template->getData('input_user');
$_SESSION['loggedin'] = TRUE;
$Template->setAlert('Zostałeś zalogowany jako ' . $Template->getData('input_user') , 'success');
$Template->rediretc('users.php');
}
} else {
$Template->load("views/v_login.php");
}
?>
m_auth.php
<?php
class Auth {
private $salt = 'e3FGde4';
function __construct(){
}
function validateLogin($user,$pass) {
if($stmt = $Database->prepare("SELECT * FROM users WHERE username = ? AND password =?")) {
$stmt->bind_param("ss", $user, md5($pass.$this->salt)); $stmt->execute();
$stmt->store_result();
if($stmt->num_rows > 0) {
$stmt->close();
return TRUE;
} else {
$stmt->close();
return FALSE;
}
} else {
}
}
function chekLoginStatus() {
if(isset($_SESSION['loggedin'])) { return TRUE;
} else {
return FALSE;
}
}
function logout() {
}
}
?>
funkcja redirect
function redirect($url) {
}
Ten post edytował xXsaperekXx 16.04.2017, 21:19:32