Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Jak zrobić /?strona=profile?id=x
coolorzel
post
Post #1





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 2.03.2013

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


Witam!

Mam pewien skrypt na komputerze, lecz nie działa on poprawnie.

Chodzi mi o to, żeby skrypt pokazywał profile graczy.

plik silnik.php:

  1. <?php
  2. $get = addslashes($_GET['strona']);
  3. include '../config/config.php';
  4. $user_data = get_user_data();
  5.  
  6. switch($get) {
  7. case '':
  8. include('includes/home.php');
  9. break;
  10.  
  11. case 'glowna':
  12. include('includes/home.php');
  13. break;
  14.  
  15. case 'register':
  16. include('includes/register.php');
  17. break;
  18.  
  19. case 'login':
  20. include('includes/login.php');
  21. break;
  22.  
  23. case 'edit_profile':
  24. include('includes/edytuj_profil.php');
  25. break;
  26.  
  27. case 'users':
  28. include('includes/userlist.php');
  29. break;
  30.  
  31. case 'profile':
  32.  
  33. $id=$_GET["id"];
  34.  
  35. if ($id=="1")
  36. {
  37. include("includes/profile.php");
  38. }
  39.  
  40. break;
  41.  
  42. case 'logout':
  43. include('includes/logout.php');
  44. break;
  45. }
  46. ?>



profile.php:

  1. <?php
  2. include '../config/config.php';
  3. db_connect();
  4.  
  5. check_login();
  6.  
  7. // filtrujemy id oraz rzutujemy je na int
  8. $_GET['id'] = (int)clear($_GET['id']);
  9.  
  10. // pobieramy dane usera z podanego id
  11. $user_data = get_user_data($_GET['id']);
  12.  
  13. // sprawdzamy czy znalazło użytkownika
  14. // jeśli nie to wyświetlamy komunikat
  15. // a jeśli tak to wyświetlamy wszystkie jego dane
  16. // jeśli user nie ma podanej strony www lub skąd jest to wyświetlamy "brak"
  17. if($user_data === false) {
  18. echo '<p>Niestety, taki uĹĽytkownik nie istnieje.</p>
  19. <p>[<a href="index.php">PowrĂłt</a>]</p>';
  20. } else {
  21. echo '<h2>Profil uĹĽytkownika</h2>
  22. <p>Nick: <b>'.$user_data['user_name'].'</b></p>
  23. <p>Email: '.$user_data['user_email'].'</p>
  24. <p>Data rejestracji: '.date("d.m.Y, H:i", $user_data['user_regdate']).'</p>
  25. <p>Strona WWW: '.(empty($user_data['user_website']) ? 'brak' : $user_data['user_website']).'</p>
  26. <p>SkÄ…d: '.(empty($user_data['user_from']) ? 'brak' : $user_data['user_from']).'</p>';
  27. }
  28.  
  29. db_close();
  30. ?>


Proszę o pomoc!
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
b4rt3kk
post
Post #2





Grupa: Zarejestrowani
Postów: 1 933
Pomógł: 460
Dołączył: 2.04.2010
Skąd: Lublin

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


Widzisz ten warunek?

  1. if ($id=="1")
  2. {
  3. include("includes/profile.php");
  4. }


Plik zostanie zaincludowany wyłącznie w przypadku gdy $id wynosi 1... Pozbądź się tego ifa.
Go to the top of the page
+Quote Post
coolorzel
post
Post #3





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 2.03.2013

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


http://celnia.pl/projects/kalkulator/str/?...na=profile?id=1

Nadal to samo, czyli nic.

profile czyta z pliku www.celnia.pl/projects/kalkulator/str/includes/profile.php?id=1

Pierw proszę się zalogować na stronie głónej www.celnia.pl/projects/kalkulator/str/?strona=login
login: admin
haslo: admin


Ten post edytował coolorzel 15.07.2013, 13:23:18
Go to the top of the page
+Quote Post
nospor
post
Post #4





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




nie: ?strona=profile?id=1
a: ?strona=profile&id=1
Go to the top of the page
+Quote Post
b4rt3kk
post
Post #5





Grupa: Zarejestrowani
Postów: 1 933
Pomógł: 460
Dołączył: 2.04.2010
Skąd: Lublin

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


Cytat(coolorzel @ 15.07.2013, 14:21:42 ) *
http://celnia.pl/projects/kalkulator/str/?...na=profile?id=1

Nadal to samo, czyli nic.

profile czyta z pliku www.celnia.pl/projects/kalkulator/str/includes/profile.php?id=1

Pierw proszę się zalogować na stronie głónej www.celnia.pl/projects/kalkulator/str/?strona=login
login: admin
haslo: admin


Pewnie nie działa, bo na tej stronie nic nie działa, można sobie dowolnie przeskakiwać po podstronach, a i tak wszystkie są puste.
Go to the top of the page
+Quote Post
nospor
post
Post #6





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




@b4rt3kk jak wprowadzisz poprawny link co podalem to o dziwo dziala (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
buliq
post
Post #7





Grupa: Zarejestrowani
Postów: 559
Pomógł: 93
Dołączył: 4.03.2008
Skąd: Olsztyn

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


Fajnie że po zalogowaniu w polu logowania wstawiasz hasło zakodowane (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
coolorzel
post
Post #8





Grupa: Zarejestrowani
Postów: 12
Pomógł: 0
Dołączył: 2.03.2013

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


Cytat(nospor @ 15.07.2013, 14:23:55 ) *
nie: ?strona=profile?id=1
a: ?strona=profile&id=1



Dzięki (IMG:style_emoticons/default/wink.gif) Pomogło.
Go to the top of the page
+Quote Post

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: 24.08.2025 - 04:20