I'll take the easy one...
#3: instead of:
<input type="TEXT" name="password">
use
<input type="PASSWORD" name="password">

Cal
http://www.calevans.com
 

-----Original Message-----
From: Marc Bragg [mailto:[EMAIL PROTECTED]]
Sent: Saturday, March 10, 2001 11:46 AM
To: [EMAIL PROTECTED]
Subject: [PHP-DB] help on modifications / subscribe / unsubscribe script


Am using the following subscribe/unsubscribe script with great success,
but it does not have all the functionality I would like. Any one have
any ideas on how to:

1.  open in a java  window, and once info is put, and person is
subscribed, java window closes and a selected http page comes up?

2. compare information submitted in this table, with same variable in
another table, and if data is not there, then include it?

3. make the password show up as ***** characters in the browser rather
than the lettters typed by user, and add a portion of script to compare
to what is in database, and if there, is it correct.

4. how to add minute and seconds to date stamp.

Thanx

Marc


<?php
// connect to db
$db = mysql_connect("xxxxx","yyy") or die ("Couldn't connect.");

mysql_select_db("law", $db) or die ("Couldn't select db.");

// get a date stamp
$add_date = date("Y-m-d");

if ($op != "ds") {
        //they need to subscribe or unsubscribe
        $text_block = "
<form name=\"form\" method=post action =\"subscribe.phtml\">
<input type=hidden name=op value =ds>

<p><strong>Enter Your e-Mail Address. This will be your User
Name:</strong><br>
<input type=text name=\"email\" size=25></p>
<p><strong>Enter a Password.</strong><br>
<input type=text name=\"password\" size=25></p>


<p><strong>Click your selection:</strong><br>
<input type=radio name=\"action\" value=\"sub\" checked> Subscribe
<input type=radio name=\"action\" value=\"unsub\"> Unsubscribe</p>

<p><input type=submit name=\"submit\" value=\"Subscribe / Unsubscribe
Now\"></p>
</form>

";

}

else if (($op == "ds") && ($action == "sub")) {

// check they're not already subscribed
// then subscribe them or return message

$check = "select email from subscribe
        where email = \"$email\"";

$check_result = mysql_query($check)
        or die("Can't execute check email address.");

$check_num = mysql_num_rows($check_result);

if ($check_num == 0) {

        // if $check_num is 0, then no match was found,
        // and the user should be subscribed

        $sql = "insert into subscribe (email, password, add_date,
sub_id) values(\"$email\", \"$password\", \"$
add_date\", \"\")";

        @mysql_query($sql) or die ("Couldn't insert email.");

        $text_block = "
        <p><h1><center><font color=green>Thanks for Joining Bid
Attorney!</h1></center></font></p>
        ";

} else {

        // if $check_num is not 0, then the user is
        // already subscribed, and let them know it.

        $text_block = "
        <p><font color=green><b>You are already a member of Bid
Attorney. Thank you!</b></font></p>
        ";

        }
}

else if (($op == "ds") && ($action == "unsub")) {

        // check they're already subscribed,
        // then unsubscribe them or return message.

$check = "select email from subscribe
        where email = \"$email\"";

$check_result = mysql_query($check)
        or die("Can't execute check e-mail address.");

$check_num = mysql_num_rows($check_result);

if ($check_num == 0) {

        // if $check_num is 0, then no match is found,
        // and the user cannot be unsubscribed

        $text_block = "
        <p><font color=red><b>Couldn't find your e-mail / user name on
the list.</b></font></p>
        <p><i>You haven't been unsubscribed because the e-Mail you
entered is not in
        the database.</i>";

}  else {

        // if $check_num is not 0, then the user is on the list, so can
be unsubscribed.

        $sql = "delete from subscribe
                where email = \"$email\"";

        @mysql_query($sql) or die ("Couldn't delete email.");

        $text_block = "
        <p><font color=black><b> You are unsubscribed from the Bid
Attorney Database!<i> Hope to see you back s
oon!</i></b></font></p>
        ";
                }
}

?>

<html>
<head>
<title>Form: Join the Bid Attorney Database / username -
password</title>
</head>
<body>

<h1><font color=blue><center>Use this Form to Subscribe /
Unsubscribe<br> to the <br>Bid Attorney Database.</ce
nter></font></h1>

<?php echo "$text_block";  ?>

</body>
</html>


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to