Pomoc - Szukaj - Użytkownicy - Kalendarz
Pełna wersja: [JavaScript][MySQL][PHP]Problem z linkami w panelu logowania
Forum PHP.pl > Forum > Przedszkole
ToTamir
Wygląd strony:
index.php
  1. <?php
  2. // zmienna potrzebna do prawidlowego wczytania includowanych plikow
  3. $add_site = true;
  4. ?>
  5. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  6. <html>
  7. <meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" />
  8. <meta http-equiv="" />
  9. <meta name="Author" content="" />
  10. <head>
  11. <title>Szablon</title>
  12. </head>
  13. <body>
  14. <table border="0" cellpadding="0" cellspacing="0" width="100%">
  15. <tr>
  16. <td width="100%" colspan="3"><?php include "include/naglowek.php"; ?></td>
  17. </tr>
  18. <tr>
  19. <td width="15%" valign="top"><?php include "include/menu_lewe.php"; ?></td>
  20. <td width="70%" valign="top">
  21. <?php
  22. // zmienna $go przekazana metoda GET
  23. $go = $_GET['go'];
  24.  
  25. // sprawdzamy czy zmienna $go nie jest pusta
  26. if(!empty($go)) {
  27. // sprawdzamy czy plik o danej nazwie istnieje
  28. if(is_file("page/$go.html")) include "page/$go.html";
  29. // jezeli plik nie istnieje wyswietla się komunikat
  30. else echo "<br />Nie ma takiej strony :-(";
  31. }
  32. // jezeli zmienna $go jest pusta wyswietla się strona glowna
  33. else include "page/start.html";
  34.  
  35. ?>
  36. </td>
  37. <td width="15%" valign="top"><?php include "include/menu_prawe.php"; ?></td>
  38. </tr>
  39. <tr>
  40. <td width="100%" colspan="3"><?php include "include/stopka.php"; ?></td>
  41. </tr>
  42. </table>
  43. </body>
  44. </html>

menu_prawe.php
  1. <div align="center">
  2. <?php
  3. if(!$add_site) exit;
  4. include "main.php";
  5. ?>
  6. </div>

main.php
  1. <?
  2. /**
  3.  * Main.php
  4.  *
  5.  * This is an example of the main page of a website. Here
  6.  * users will be able to login. However, like on most sites
  7.  * the login form doesn't just have to be on the main page,
  8.  * but re-appear on subsequent pages, depending on whether
  9.  * the user has logged in or not.
  10.  *
  11.  * Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
  12.  * Last Updated: August 26, 2004
  13.  */
  14. include("include/session.php");
  15. ?>
  16.  
  17.  
  18. <html>
  19.  
  20. <body>
  21.  
  22. <table>
  23. <tr><td>
  24.  
  25.  
  26. <?
  27. /**
  28.  * User has already logged in, so display relavent links, including
  29.  * a link to the admin center if the user is an administrator.
  30.  */
  31. if($session->logged_in){
  32. echo "Witaj <b>$session->username</b>, jesteś zalogowany w serwisie. <br><br>"
  33. ."[<a href=\"userinfo.php?user=$session->username\">Moje konto</a>] &nbsp;&nbsp;<br>"
  34. ."[<a href=\"index.php?go=useredit.php\">Edytuj konto</a>] &nbsp;&nbsp;<br>";
  35. if($session->isAdmin()){
  36. echo "[<a href=\"admin/admin.php\">Panel admina</a>] &nbsp;&nbsp;<br>";
  37. }
  38. echo "[<a href=\"process.php\">Wyloguj</a>]<br>";
  39. }
  40. else{
  41. ?>
  42.  
  43. <h1>Login</h1>
  44. <?
  45. /**
  46.  * User not logged in, display the login form.
  47.  * If user has already tried to login, but errors were
  48.  * found, display the total number of errors.
  49.  * If errors occurred, they will be displayed.
  50.  */
  51. if($form->num_errors > 0){
  52. echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
  53. }
  54. ?>
  55. <form action="process.php" method="POST">
  56. <table align="left" border="0" cellspacing="0" cellpadding="3">
  57. <tr><td>Login:</td><td><input type="text" name="user" maxlength="30" value="<? echo $form->value("user"); ?>"></td><td><? echo $form->error("user"); ?></td></tr>
  58. <tr><td>Hasło:</td><td><input type="password" name="pass" maxlength="30" value="<? echo $form->value("pass"); ?>"></td><td><? echo $form->error("pass"); ?></td></tr>
  59. <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <? if($form->value("remember") != ""){ echo "checked"; } ?>>
  60. <font size="2">Zapamiętaj mnie &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
  61. <input type="hidden" name="sublogin" value="1">
  62. <input type="submit" value="Login"></td></tr>
  63. <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Zapomniałeś hasło?</a>]</font></td><td align="right"></td></tr>
  64. <tr><td colspan="2" align="left"><br>Nie zarejestrowany? <a href="register.php">Zarejestruj się!</a></td></tr>
  65. </table>
  66. </form>
  67.  
  68. <?
  69. }
  70.  
  71. /**
  72.  * Just a little page footer, tells how many registered members
  73.  * there are, how many users currently logged in and viewing site,
  74.  * and how many guests viewing site. Active users are displayed,
  75.  * with link to their user information.
  76.  */
  77. echo "</td></tr><tr><td align=\"center\"><br><br>";
  78. echo "<b>Zarejestrowanych ".$database->getNumMembers()." użytkowników<br>";
  79. echo "Aktualnie $database->num_active_users użytkowników i ";
  80. echo "$database->num_active_guests gości online.<br><br>";
  81.  
  82. include("include/view_active.php");
  83.  
  84. ?>
  85.  
  86.  
  87. </td></tr>
  88. </table>
  89.  
  90.  
  91. </body>
  92. </html>

I tu moje pytanie jak zrobić by po wciśnięciu "Moje konto" strona odtworzyła się w tym okienku w którym jest includowane "menu_prawe", a nie na całej stronie

Nikt nie potrafi czy po prostu zadałem głupie pytanie?
nospor
Z dwojga rzeczy skłaniałbym się ku temu drugiemu wink.gif

Nie możesz tak zrobic jak chcesz. Danie w linku adresu url powoduje przejście na ten adres i tyle. Jesli pod danym adresem masz tylko konto, to tylko konto ci się otworzy.

Masz do wyboru:
iframe
ajax
albo zrobić to porządnie i konto ma też lecieć na index.php ino z info ze to jest akurat konto otwarte i normalnie wyswietlać całą stronę z podstroną konto
!*!
umieść to tam gdzie chcesz, aby było.
  1. if(isset($_GET['user']))
  2. {
  3. // cos
  4. }


lub skorzystaj z ajax. W zależności o co Ci chodzi.
To jest wersja lo-fi głównej zawartości. Aby zobaczyć pełną wersję z większą zawartością, obrazkami i formatowaniem proszę kliknij tutaj.
Invision Power Board © 2001-2025 Invision Power Services, Inc.