Reply to Re: [PHP] How would you write this?

Your name:

Reply:


Posted by Michael B Allen on 12/05/05 03:39

On Sun, 4 Dec 2005 11:44:12 -0800
Curt Zirzow <czirzow@gmail.com> wrote:

> <style>
> .errored {
> color: #FF0000;
> }
> </style>
> <?php
> $set_class = array(0 => '', 1 => 'errored');
> define('SET_USERNAME', 0x01);
> define('SET_PASSWORD', 0x02);
> define('SET_ALL', SET_USERNAME & SET_PASSWORD);
> $set = 0;
> $username = "";
> $password = "";
>
> if (isset($_POST['username'])) {
> $username = trim($_POST['username']);
> if (strlen($username) > 0) {
> $set |= SET_USERNAME;
> }
> }
> > ...
> if (($set & SET_ALL) == SET_ALL) {
> echo "Logging in with: " . $username . ':' . $password;
> } else {
> ?>
> <form action="login.php" method="post">
> <table>
> <tr><td colspan="2">Login:</td></tr>
> <tr><td>Username:</td>
> <?php
> $class = $set_class[ $set & SET_USERNAME ];
> echo "<td class="$class">
> echo "<input type=\"username\" name=\"username\" value=\"" . $username . "\"/>";
> > ...
>
> It might be a bit overkill for such a simple thing.. but heck.. i
> was bored :)

Interesting. This gives me some ideas. I'm also happy to know I wasn't
too far off :->

Thanks,
Mike

[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

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