Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [HTML][PHP] Błąd przy zmianie layoutu
karol002
post
Post #1





Grupa: Zarejestrowani
Postów: 2
Pomógł: 0
Dołączył: 27.02.2012

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


Witam,
Mam pliczek main.php, który służy do logowania :
  1. <?php
  2. /*
  3.  * Main.php
  4.  *
  5.  * This is an example of the main page of a website. Here users will be able to login.
  6.  * However, like on most sites the login form doesn't just have to be on the main page,
  7.  * but re-appear on subsequent pages, depending on whether the user has logged in or not.
  8.  *
  9.  * Originally written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
  10.  * Last Updated by the Angry Frog: October 19, 2011
  11. */
  12.  
  13. include("include/session.php");
  14. global $database;
  15. $config = $database->getConfigs();
  16. ?>
  17.  
  18. <html>
  19. <head>
  20. <title><?php echo $config['SITE_NAME']; ?> - Main</title>
  21.  
  22. <style type="text/css">
  23. <!--
  24. body {
  25. font: 12px/1.5 Lucida Grande, Arial, Helvetica, 'Liberation Sans', FreeSans, sans-serif;
  26. }
  27. -->
  28. </style>
  29. </head>
  30. <body>
  31.  
  32. <table>
  33. <tr><td>
  34.  
  35.  
  36. <?php
  37. /**
  38.  * User has already logged in, so display relavent links, including
  39.  * a link to the admin center if the user is an administrator.
  40.  */
  41. if($session->logged_in){
  42. echo "<h1>Logged In</h1>";
  43. echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
  44. ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
  45. ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
  46. if($session->isAdmin()){
  47. echo "[<a href=\"admin/index.php\">Admin Center</a>] &nbsp;&nbsp;";
  48. }
  49. echo "[<a href=\"process.php\">Logout</a>]";
  50. }
  51. else{
  52. ?>
  53.  
  54. <h1>Login</h1>
  55. <?php
  56. /**
  57.  * User not logged in, display the login form.
  58.  * If user has already tried to login, but errors were
  59.  * found, display the total number of errors.
  60.  * If errors occurred, they will be displayed.
  61.  */
  62. if($form->num_errors > 0){
  63. echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
  64. }
  65. ?>
  66. <form action="process.php" method="POST" autocomplete="off">
  67. <table align="left" border="0" cellspacing="0" cellpadding="3">
  68. <tr><td>Username:</td><td><input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>"></td><td><?php echo $form->error("user"); ?></td></tr>
  69. <tr><td>Password:</td><td><input type="password" name="pass" maxlength="30" value="<?php echo $form->value("pass"); ?>"></td><td><?php echo $form->error("pass"); ?></td></tr>
  70. <tr><td colspan="2" align="left"><input type="checkbox" name="remember" <?php if($form->value("remember") != ""){ echo "checked"; } ?>>
  71. Remember me &nbsp;&nbsp;&nbsp;&nbsp;
  72. <input type="hidden" name="sublogin" value="1">
  73. <input type="submit" value="Login"></td></tr>
  74. <tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
  75. <tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
  76. </table>
  77. </form>
  78.  
  79. </td></tr>
  80. </table>
  81. <?php
  82. }
  83. echo "<br><br>";
  84. include("include/view_active.php");
  85.  
  86. ?>
  87.  
  88. </body>
  89. </html>


Powyższy kod zeedytowalem i wyszło takie coś :
  1. <?php
  2. /*
  3.  * Main.php
  4.  *
  5.  * This is an example of the main page of a website. Here users will be able to login.
  6.  * However, like on most sites the login form doesn't just have to be on the main page,
  7.  * but re-appear on subsequent pages, depending on whether the user has logged in or not.
  8.  *
  9.  * Originally written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
  10.  * Last Updated by the Angry Frog: October 19, 2011
  11. */
  12.  
  13. include("include/session.php");
  14. global $database;
  15. $config = $database->getConfigs();
  16. ?>
  17.  
  18. <html xmlns="http://www.w3.org/1999/xhtml">
  19. <head>
  20. <meta http-equiv="Content-Type" content="text/html"/>
  21. <title><?php echo $config['SITE_NAME']; ?> - Strona Główna</title>
  22. <link rel="stylesheet" type="text/css" href="main.css" />
  23. <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
  24. </head>
  25.  
  26. <body>
  27.  
  28. <div id="wrapper">
  29.  
  30. <div id="header">
  31. <a href="index.php"><img src="images/logo.png" alt="logo" /></a>
  32. </div>
  33.  
  34. <div class="wrapper1">
  35. <div class="wrapper" style="width:600px;">
  36. <div class="nav-wrapper">
  37. <div class="nav">
  38. <ul id="navigation" style="width:538px";>
  39.  
  40. <li class="#">
  41. <a href="/index.php" target="_self">
  42. <span class="menu-left"></span>
  43. <span class="menu-mid">Strona Główna</span>
  44. <span class="menu-right"></span>
  45. </a>
  46. </li>
  47.  
  48. <li class="#">
  49. <a href="chat.php" target="_self">
  50. <span class="menu-left"></span>
  51. <span class="menu-mid">Chat</span>
  52. <span class="menu-right"></span>
  53. </a>
  54. </li>
  55.  
  56. <li class="#">
  57. <a href="kontakt.php" target="_self">
  58. <span class="menu-left"></span>
  59. <span class="menu-mid">Kontakt</span>
  60. <span class="menu-right"></span>
  61. </a>
  62. </li>
  63.  
  64. <li class="#">
  65. <a href="" target="_self">
  66. <span class="menu-left"></span>
  67. <span class="menu-mid">Kontakt</span>
  68. <span class="menu-right"></span>
  69. </a>
  70. </li>
  71.  
  72. </ul>
  73. </div>
  74. <br><br>
  75. </div>
  76. </div>
  77. </div>
  78.  
  79.  
  80. <div id="glowny">
  81.  
  82. <!-- poczatek lewa kolumna -->
  83. <div id="panel_lewa">
  84. <div class="srodek"><div class="lewa"><div class="prawa"><span class="nazwa_forum">Panel Logowania</span></div></div></div>
  85.  
  86. <div class="bgie">
  87. <?php
  88. /**
  89.  * User has already logged in, so display relavent links, including
  90.  * a link to the admin center if the user is an administrator.
  91.  */
  92. if($session->logged_in){
  93. echo "<h1>Logged In</h1>";
  94. echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
  95. ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
  96. ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
  97. if($session->isAdmin()){
  98. echo "[<a href=\"admin/index.php\">Admin Center</a>] &nbsp;&nbsp;";
  99. }
  100. echo "[<a href=\"process.php\">Logout</a>]";
  101. }
  102. else{
  103. ?>
  104. <?php
  105. /**
  106.  * User not logged in, display the login form.
  107.  * If user has already tried to login, but errors were
  108.  * found, display the total number of errors.
  109.  * If errors occurred, they will be displayed.
  110.  */
  111. if($form->num_errors > 0){
  112. echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>";
  113. }
  114. ?>
  115. <form name='loginform' method='post' action='process.php' autocomplete="off">
  116. <table align="left" border="0" cellspacing="0" cellpadding="3">Login<br>
  117. <tr><td><input type="text" name="user" maxlength="30" class="text" value="<?php echo $form->value("user"); ?>"></td><br><td><?php echo $form->error("user"); ?></td><br>Hasło<br>
  118. <tr><td><input type="password" name="pass" maxlength="30" class="text" value="<?php echo $form->value("pass"); ?>"></td><br><td><?php echo $form->error("pass"); ?></td><br>
  119. <input type='checkbox' name='remember' <?php if($form->value("remember") != ""){ echo "checked"; } ?>>Zapamiętaj mnie<br><br>
  120. <input type="hidden" name="sublogin" value="1">
  121. <input type='submit' name='Login' value='Loguj' class='button'><br>
  122. </table>
  123. </form>
  124. <br>
  125. <a href='register.php' class='side'>Rejestracja</a><br>
  126. <a href='forgotpass.php' class='side'>Zapomniałeś hasło?</a>
  127.  
  128. </div>
  129. <div class="bottomsrodek"><div class="bottomlewa"><div class="bottomprawa"></div></div></div>
  130.  
  131.  
  132. <div class="srodek"><div class="lewa"><div class="prawa"><span class="nazwa_forum">Statystyki</span></div></div></div>
  133.  
  134. <div class="bgie">
  135. <?php
  136. include("zlicz.php");
  137. echo "<br><br>";
  138. include("include/view_active.php");
  139. ?>
  140. </div>
  141. <div class="bottomsrodek"><div class="bottomlewa"><div class="bottomprawa"></div></div></div>
  142. </div>
  143.  
  144. <div id="panel_prawa">
  145. <div class="srodek"><div class="lewa"><div class="prawa"><span class="nazwa_forum">Opis</span></div></div></div>
  146.  
  147. <div class="bgie">
  148. Test
  149. </div>
  150. <div class="bottomsrodek"><div class="bottomlewa"><div class="bottomprawa"></div></div></div>
  151.  
  152. </div>
  153.  
  154. </div>
  155.  
  156. <div id="footer">
  157.  
  158. STOPKA
  159.  
  160. </div>
  161.  
  162. </div>
  163. </body>
  164. </html>


W tym zeedytowanym kodzie wyskakuje błąd :
Kod
Parse error: syntax error, unexpected $end in /home/xxxx/domains/xxxx/public_html/index.php on line 166


Jeśli domknę klamrę to osoba, która sie zaloguje widzi pola do zalogowania.

PS. Tamten pierwszy skrypt chodzi elegancko..

Pomóżcie (IMG:style_emoticons/default/smile.gif)
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: 24.08.2025 - 06:33