|
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
Navigation:
[Reply to this message]
|