[PHP-DB] help on modifications / subscribe / unsubscribe script

2001-03-10 Thread Marc Bragg

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("x","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

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


pstrongClick your selection:/strongbr
input type=radio name=\"action\" value=\"sub\" checked Subscribe
input type=radio name=\"action\" value=\"unsub\" Unsubscribe/p

pinput 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 = "
ph1centerfont color=greenThanks 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 = "
pfont color=greenbYou 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 = "
pfont color=redbCouldn't find your e-mail / user name on
the list./b/font/p
piYou 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 = "
pfont color=blackb You are unsubscribed from the Bid
Attorney Database!i Hope to see you back s
oon!/i/b/font/p
";
}
}

?

html
head
titleForm: Join the Bid Attorney Database / username -
password/title
/head
body

h1font color=bluecenterUse this Form to Subscribe /
Unsubscribebr to the brBid 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]




RE: [PHP-DB] help on modifications / subscribe / unsubscribe script

2001-03-10 Thread Cal Evans

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("x","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

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


pstrongClick your selection:/strongbr
input type=radio name=\"action\" value=\"sub\" checked Subscribe
input type=radio name=\"action\" value=\"unsub\" Unsubscribe/p

pinput 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 = "
ph1centerfont color=greenThanks 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 = "
pfont color=greenbYou 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 = "
pfont color=redbCouldn't find your e-mail / user name on
the list./b/font/p
piYou 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 = "
pfont color=blackb You are unsubscribed from the Bid
Attorney Database!i Hope to see you back s
oon!/i/b/font/p
";
}
}

?

html
head
titleForm: Join the Bid Attorney Database / username -
password/title
/head
body

h1font color=bluecenterUse this Form to Subscribe /
Unsubscribebr to the brBid 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]