Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [SQL][PHP]skrypt logowania, przekierowanie uzytkownika , admina
navaga
post
Post #1





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 1.01.2014

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


  1.  
  2.  
  3. if ($usuario->getId()!=NULL) {
  4. $_SESSION['usuario']=$usuario; //jeśli jest użytkownik
  5.  
  6. header('Location: cuenta.php'); //przekierowanie do strony użytkownika
  7. }else{
  8. header('Location: error.php?mensaje=niepoprawne dane'); // przekierowanie do strony o błędzie
  9. }


jak zrobić żeby uzytkownik został przekierowany do strony cuenta.php np.($usuario="bolek")
a admin do cuentaAdmin.php ($usuario="admin")

Ten post edytował navaga 19.05.2017, 17:55:38
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
navaga
post
Post #2





Grupa: Zarejestrowani
Postów: 20
Pomógł: 0
Dołączył: 1.01.2014

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


masz rację powinno być
  1. if ($nombre=="admin") {
  2. header('Location: cuentaAdmin.php');
  3. } else {
  4. header('Location: cuenta.php');}


ale i tak nie działa.

  1. class Usuario{
  2. private $id;
  3. private $nombre;
  4. private $clave;
  5.  
  6. public function getId(){
  7. return $this->id;
  8. }
  9.  
  10. public function setId($id){
  11. $this->id = $id;
  12. }
  13.  
  14. public function getNombre(){
  15. return $this->nombre;
  16. }
  17.  
  18. public function setNombre($nombre){
  19. $this->nombre = $nombre;
  20. }
  21.  
  22. public function getClave(){
  23. return $this->clave;
  24. }
  25.  
  26. public function setClave($clave){
  27. $this->clave = $clave;
  28. }
  29. }


Go to the top of the page
+Quote Post

Posty w temacie


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

 



RSS Aktualny czas: 10.10.2025 - 02:21