Reply to Re: can anyone see a problem?

Your name:

Reply:


Posted by Cliff Smith on 12/16/05 07:48

gerg wrote:
> I'm having a problem with a code I'm writing to display a login form if
> there is no cookie data present. Here is my small code: this code is
> yielding this error:
>
> Parse error: parse error, unexpected $ in
> /home/thegofo/public_html/includes/login_functions.php on line 30
>
>
> The code is:
>
> <?
>
> // show login form
>
> function showlogin(){
>
> // if cookie data is empty, or does not match, show the form
>
> if ( (empty($_COOKIE['remember'])) || ($_COOKIE['remember'] !=
> "some_value") ){
> ?>
> <div align="center">
> <img src="../images/login.gif" alt="Please Login">
> <br>
> <table class="loginform" width="100%">
> <tr>
> <td>Username </td><td> <input name="user" type="text"
> size="10"></td>
> </tr>
> <tr>
> <td>Password </td><td> <input name="pass" type="password"
> size="10"></td>
> </tr>
> <tr>
> <td><input class="loginbutton" name="submit" type="submit"
> value="Go!"></td><td></td>
> </tr>
> </table>
> </div>
> <? }
>
> showlogin();
>
> ?>
>
> Thanks for any help.
Yep, a few things...

The parsing is due to not closing off the { brackets.
Change line 26 to
<? }}

Secondly, you will need to add a form to submit this data.

Thirdly, NEVER use cookies to check whether someone has logged in, as
these are client-side, and easily forged.... try $_SESSION values for
this purpose. Cookies should only be used for things that don't matter,
like user preferences and the like.

Happy Hunting!

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация