Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Disable/enable email *senior programmers question*

Status
Not open for further replies.

dawnjulie

Programmer
Nov 22, 2002
22
0
0
CA
Hi all,

I am in the process of putting together an online dating site.

There is one aspect which has me absolutely stumped.

On these sites, everyone can sign up free and do a profile (ad). But although everyone can view the ads, only the paying members can click the email link to send email. When Non-paying members click the email link, nothing happens.

How is this done?! Any help would be appreciated :)
- Dawn
 
Well, of course I've never used one these sites myself, you understand :~/ but...

Generally you sign on to the site with yourown user account. The pages that are the served up to you are generated dynamically on the fly.

So it's easy! The program/script/whatever that's building the page can see who the current user is, look up his/her account status in the customer database, and place (or omit) links on the web pages as appropriate.

-- Chris

-- Chris Hunt
Extra Connections Ltd
 
Hi Dawn,

On the e-mail page, put a check to match the members status (Paid or not paid) and then show them the output based on that.

The actual coding depends on what language you use, the following is a very simple example in Coldfusion:

<cfif dbcheck.customer NEQ &quot;Paid&quot;>
You need to pay to access this area!
<cfabort>
</cfif>

Hope this helps


Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Thanks very much for the response:)

Would you know what I would use in the link for ASP? The d-base field is called PAID (in this example :)

Dawn
 
Hi Dawn,

I don't use ASP so can't help you with that but a simple IF statment in nearly any language will do this.

Just check if the db record is paid, if not then do something else.

A search on google will give you results of how to do an IF statment in ASP.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Simple solution is to use Session information. When the Session starts make a variable and set it to 0 Session(&quot;valid&quot;)=&quot;0&quot; meaning not a member. After the user is identified as member set it to 1 Session(&quot;valid&quot;)=&quot;1&quot;then in your email code it's simply something like this:
Code:
<% 
var mailto = &quot;#&quot;;
var sValid = new String(Session(&quot;valid&quot;));
if( sValid.charAt(0) == '1')
// get the email address from the database recordset
  mailto = &quot;mailto://&quot; + rs(&quot;emailAddr&quot;);
%>

<a href=&quot;<%=mailto%>&quot;>E-Mail</a>

-pete
[sub]I just can't seem to get back my IntelliSense[/sub]
 
Palbano,

The session variable is certainly a good possibility. However, since both non-paying & paying log-on with same info (username & password), there is no way of differentiating paying from non-paying.

I am thinking that retrieving info from the d-base during log-in would solve that problem (ie, seperate field to check 'paid' for example) but still not too sure how to code it all to tie in with the email links on all the pages.

The session variable sounds like it would be workable if I could tie it in to a d-base check for the info... any idea how that could be done ? :)

thanks again everyone for your input!
 
>> any idea how that could be done ? :)

Code:
var rs = ....query database;
Session(&quot;valid&quot;) = new String(rs(&quot;memberStatus&quot;));

Or if your asking about using databases in general check out the FAQs in the ASP forum. Almost all the database questions/solutions you would have in ASP are in the FAQs.

ASP Forum: forum333

-pete
[sub]I just can't seem to get back my IntelliSense[/sub]
 
I'm not really too sure how to incorporate the code into this... does it look right below?

<%@LANGUAGE=&quot;VBSCRIPT&quot;%>
<!--#include file=&quot;driverinfo/connectString-info.asp&quot; -->
<%
var mailto = &quot;#&quot;;
var sValid = new String(Session(&quot;valid&quot;));
if( sValid.charAt(0) == '1')
// get the email address from the database recordset
mailto = &quot;mailto://&quot; + rs(&quot;emailAddr&quot;);
%>

<html>
<head><title>html page</title>
</head>
<body>
<a href=&quot;<%=mailto%>&quot;>E-Mail</a>
</body></html>

 
Dawn,

What is your background? You don't know that the code i posted is Javascript and not VBScript? We need to know more about what your skill level is to post replies that will be helpful to you.


-pete
[sub]I just can't seem to get back my IntelliSense[/sub]
 
I had problems associating the 'var' to a script & javascript is not my forte, so I did not recognize it!

I am working with VBscript & ASP pages. If there is a way to do this with javascript -- that's fine with me too, however, since the d-base field has to be checked to verify paying/nonpaying, & I do not know how to do this in javascript (access database), I would have to have the coding for this if you know it.

Sorry, should have been more specific :)
 
Sure you can do all that same logic in VBScript you just have to port the syntax etc. to VBS. I am not the person you want helping you with anything VB [lol]

-pete
[sub]I just can't seem to get back my IntelliSense[/sub]
 
Using your own code, I suppose something like:

Code:
<!--#include file=&quot;driverinfo/connectString-info.asp&quot; -->
<% 
mailto = &quot;&quot;
sValid = Session(&quot;valid&quot;)
if ( sValid = 1)
' get the email address from the database recordset
  mailto = &quot;<a href=&quot;&quot;mailto:&quot; & rs(&quot;emailAddr&quot;) & &quot;&quot;&quot;>Email</a>&quot;
end if
%>

<html>
<head><title>html page</title>
</head>
<body>
<%=mailto%>
</body></html>

That's assuming you've already set the session variable 'valid' to 1 or 0, and rs is a valid recordset. I've also put the entire email link into the code so that you don't end up with a link that goes nowhere!
 
Hi Blueark... here are the d-base details...

Email addresses stored in EMAIL
Field with 1 or 0 (paying or non-paying, respectively) MEMBER

In your example, it would look like this...?

<!--#include file=&quot;driverinfo/connectString-info.asp&quot; -->
<%
mailto = &quot;&quot;
sValid = Session(&quot;valid&quot;)
if ( sValid = 1)
' get the email address from the database recordset
mailto = &quot;<a href=&quot;&quot;mailto:&quot; & rs(&quot;EMAIL&quot;) & &quot;&quot;&quot;>Email</a>&quot;
end if
%>

<html>
<head><title>html page</title>
</head>
<body>
<%=mailto%>
</body></html>

thank you.... dawn_julie@hotmail.com
 
Ok, I'm slightly confused.

Instead of showing a mailto link, would you not be better pointing to a form so that it doesn't reveal the e-mail address of the user? This allows the user to decide whether or not they disclose their e-mail to the sender.

Also, would it not be better displaying something if the user has not paid? Something like the following:

Send a message to USERNAME

When they click this button, if they have paid take them to the mail form, if they haven't paid, send them to a page listing the details of why they should upgrade their account.

Hope this helps

Wullie


The pessimist complains about the wind. The optimist expects it to change.
The leader adjusts the sails. - John Maxwell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top