Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> własny css, błędy
xXsaperekXx
post
Post #1





Grupa: Zarejestrowani
Postów: 9
Pomógł: 0
Dołączył: 16.04.2017

Ostrzeżenie: (0%)
-----


witam serwer lokalny to wamp serwer

błędy:

  1. ! ) Notice: Undefined offset: 0 in C:\wamp64\www\cms\sk_login\login.php on line 11
  2. Call Stack
  3. # Time Memory Function Location
  4. 1 0.0012 251536 {main}( ) ...\login.php:0


[



  1. Strict standards: Only variables should be passed by reference in C:\wamp64\www\cms\sk_login\models\m_auth.php on line 14
  2. Call Stack
  3. # Time Memory Function Location
  4. 1 0.0012 251536 {main}( ) ...\login.php:0
  5. 2 0.0114 290880 Auth->validateLogin( ) ...\login.php:14


  1. Fatal error: Call to undefined method Template::rediretc() in C:\wamp64\www\cms\sk_login\login.php on line 21
  2. Call Stack
  3. # Time Memory Function Location
  4. 1 0.0012 251536 {main}( ) ...\login.php:0



A to skrypty:

login.php

  1. <?php
  2.  
  3. include("includes/database.php");
  4. include("includes/init.php");
  5.  
  6. if(isset($_POST['submit'])) {
  7.  
  8. $Template->setData('input_user', $_POST['username']);
  9. $Template->setData('input_pass', $_POST['password']);
  10.  
  11. if($_POST['username' == ''] || $_POST['password'] == '') {
  12. $Template->setAlert('Uzupełnij wymagane pola!!!', 'error');
  13. $Template->load("views/v_login.php");
  14. } else if($Auth->validateLogin($Template->getData('input_user'), $Template->getData('input_pass') == FALSE)) {
  15. $Template->setAlert('Nieprawidłowy login lub hasło!!!', 'error');
  16. $Template->load("views/v_login.php");
  17. } else {
  18. $_SESSION['username'] = $Template->getData('input_user');
  19. $_SESSION['loggedin'] = TRUE;
  20. $Template->setAlert('Zostałeś zalogowany jako ' . $Template->getData('input_user') , 'success');
  21. $Template->rediretc('users.php');
  22. }
  23. } else {
  24. $Template->load("views/v_login.php");
  25. }
  26.  
  27. ?>


m_auth.php

  1. <?php
  2.  
  3. class Auth {
  4.  
  5. private $salt = 'e3FGde4';
  6.  
  7. function __construct(){
  8. }
  9.  
  10. function validateLogin($user,$pass) {
  11. global $Database;
  12.  
  13. if($stmt = $Database->prepare("SELECT * FROM users WHERE username = ? AND password =?")) {
  14. $stmt->bind_param("ss", $user, md5($pass.$this->salt));
  15. $stmt->execute();
  16. $stmt->store_result();
  17.  
  18. if($stmt->num_rows > 0) {
  19. $stmt->close();
  20. return TRUE;
  21. } else {
  22. $stmt->close();
  23. return FALSE;
  24. }
  25. } else {
  26. die();
  27. }
  28. }
  29.  
  30. function chekLoginStatus() {
  31. if(isset($_SESSION['loggedin'])) {
  32. return TRUE;
  33. } else {
  34. return FALSE;
  35. }
  36. }
  37.  
  38. function logout() {
  39. }
  40. }
  41.  
  42. ?>


funkcja redirect

  1. function redirect($url) {
  2. header("Location: $url");
  3. }


Ten post edytował xXsaperekXx 16.04.2017, 21:19:32
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 19.08.2025 - 18:46