Witam,
Mam pliczek main.php, który służy do logowania :
<?php
/*
* Main.php
*
* This is an example of the main page of a website. Here users will be able to login.
* However, like on most sites the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether the user has logged in or not.
*
* Originally written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated by the Angry Frog: October 19, 2011
*/
include("include/session.php");
$config = $database->getConfigs();
?>
<html>
<head>
<title>
<?php echo $config['SITE_NAME']; ?> - Main</title>
<style type="text/css">
<!--
body {
font: 12px/1.5 Lucida Grande, Arial, Helvetica, 'Liberation Sans', FreeSans, sans-serif;
}
-->
</style>
</head>
<body>
<table>
<tr><td>
<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
echo "<h1>Logged In</h1>"; echo "Welcome <b>$session->username</b>, you are logged in. <br><br>" ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] "
."[<a href=\"useredit.php\">Edit Account</a>] ";
if($session->isAdmin()){
echo "[<a href=\"admin/index.php\">Admin Center</a>] "; }
echo "[<a href=\"process.php\">Logout</a>]"; }
else{
?>
<h1>Login</h1>
<?php
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>"; }
?>
<form action="process.php" method="POST" autocomplete="off">
<table align="left" border="0" cellspacing="0" cellpadding="3">
<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>
<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>
<tr><td colspan="2" align="left"><input type="checkbox" name="remember"
<?php if($form->value("remember") != ""){ echo "checked"; } ?>>
Remember me
<input type="hidden" name="sublogin" value="1">
<input type="submit" value="Login"></td></tr>
<tr><td colspan="2" align="left"><br><font size="2">[<a href="forgotpass.php">Forgot Password?</a>]</font></td><td align="right"></td></tr>
<tr><td colspan="2" align="left"><br>Not registered? <a href="register.php">Sign-Up!</a></td></tr>
</table>
</form>
</td></tr>
</table>
<?php
}
include("include/view_active.php");
?>
</body>
</html>
Powyższy kod zeedytowalem i wyszło takie coś :
<?php
/*
* Main.php
*
* This is an example of the main page of a website. Here users will be able to login.
* However, like on most sites the login form doesn't just have to be on the main page,
* but re-appear on subsequent pages, depending on whether the user has logged in or not.
*
* Originally written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated by the Angry Frog: October 19, 2011
*/
include("include/session.php");
$config = $database->getConfigs();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html"/>
<title>
<?php echo $config['SITE_NAME']; ?> - Strona Główna</title>
<link rel="stylesheet" type="text/css" href="main.css" />
<link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
</head>
<body>
<div id="wrapper">
<div id="header">
<a href="index.php"><img src="images/logo.png" alt="logo" /></a>
</div>
<div class="wrapper1">
<div class="wrapper" style="width:600px;">
<div class="nav-wrapper">
<div class="nav">
<ul id="navigation" style="width:538px";>
<li class="#">
<a href="/index.php" target="_self">
<span class="menu-left"></span>
<span class="menu-mid">Strona Główna</span>
<span class="menu-right"></span>
</a>
</li>
<li class="#">
<a href="chat.php" target="_self">
<span class="menu-left"></span>
<span class="menu-mid">Chat</span>
<span class="menu-right"></span>
</a>
</li>
<li class="#">
<a href="kontakt.php" target="_self">
<span class="menu-left"></span>
<span class="menu-mid">Kontakt</span>
<span class="menu-right"></span>
</a>
</li>
<li class="#">
<a href="" target="_self">
<span class="menu-left"></span>
<span class="menu-mid">Kontakt</span>
<span class="menu-right"></span>
</a>
</li>
</ul>
</div>
<br><br>
</div>
</div>
</div>
<div id="glowny">
<!-- poczatek lewa kolumna -->
<div id="panel_lewa">
<div class="srodek"><div class="lewa"><div class="prawa"><span class="nazwa_forum">Panel Logowania</span></div></div></div>
<div class="bgie">
<?php
/**
* User has already logged in, so display relavent links, including
* a link to the admin center if the user is an administrator.
*/
if($session->logged_in){
echo "<h1>Logged In</h1>"; echo "Welcome <b>$session->username</b>, you are logged in. <br><br>" ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] "
."[<a href=\"useredit.php\">Edit Account</a>] ";
if($session->isAdmin()){
echo "[<a href=\"admin/index.php\">Admin Center</a>] "; }
echo "[<a href=\"process.php\">Logout</a>]"; }
else{
?>
<?php
/**
* User not logged in, display the login form.
* If user has already tried to login, but errors were
* found, display the total number of errors.
* If errors occurred, they will be displayed.
*/
if($form->num_errors > 0){
echo "<font size=\"2\" color=\"#ff0000\">".$form->num_errors." error(s) found</font>"; }
?>
<form name='loginform' method='post' action='process.php' autocomplete="off">
<table align="left" border="0" cellspacing="0" cellpadding="3">Login<br>
<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>
<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>
<input type='checkbox' name='remember'
<?php if($form->value("remember") != ""){ echo "checked"; } ?>>Zapamiętaj mnie<br><br>
<input type="hidden" name="sublogin" value="1">
<input type='submit' name='Login' value='Loguj' class='button'><br>
</table>
</form>
<br>
<a href='register.php' class='side'>Rejestracja</a><br>
<a href='forgotpass.php' class='side'>Zapomniałeś hasło?</a>
</div>
<div class="bottomsrodek"><div class="bottomlewa"><div class="bottomprawa"></div></div></div>
<div class="srodek"><div class="lewa"><div class="prawa"><span class="nazwa_forum">Statystyki</span></div></div></div>
<div class="bgie">
<?php
include("zlicz.php");
include("include/view_active.php");
?>
</div>
<div class="bottomsrodek"><div class="bottomlewa"><div class="bottomprawa"></div></div></div>
</div>
<div id="panel_prawa">
<div class="srodek"><div class="lewa"><div class="prawa"><span class="nazwa_forum">Opis</span></div></div></div>
<div class="bgie">
Test
</div>
<div class="bottomsrodek"><div class="bottomlewa"><div class="bottomprawa"></div></div></div>
</div>
</div>
<div id="footer">
STOPKA
</div>
</div>
</body>
</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)