Gossamer Forum
Home : Products : Gossamer Links : Discussions :

How do i write an If-Else Statement

Quote Reply
How do i write an If-Else Statement
On my login sucess page, I want to show a link "to another page" for paid linkowners and an upgrade link for free and expired LinkOwners.
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
Hi Sies,

Below if/elseif should work.

Not sure what settings you have, however if you have field like paiduser and settings as Yes/No, you can use below. However if you are using different settings, than just change the required info:

<%if paidluser eq 'Yes'%>
Content for users with paid links.
<%else%>
Content for users without paid link.
<%endif%>

Vishal
-------------------------------------------------------
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
Hi,

So what you wanna see, is if they have any paid links - and if they do, show different stuff compared to someone who doesn't?

Not as simple as a condition if thats the case, as it would need a global to work out if they own a link thats been paid for. Won't bother writing it until I know that's what your trying to do =)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How do i write an If-Else Statement In reply to
I created a resource site that I only want made available to paid users
You have to log into this site with a usename and password that I change every month
On the login_sucess page, I want the paid users to see the link to the resource site and the necessary login info.
I want the free and expired listing users to see an upgrade/renewal link.
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
Ok, and how does your system know if they are paid, or non-paid/expired? Do you have a tag that you use for it?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How do i write an If-Else Statement In reply to
I really don't know. How can I tell? I using Glinks 3.3
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
Hi,

Erm, its your site LOL

What are you using for your payment system? How do you know if someone is a paid user?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How do i write an If-Else Statement In reply to
LOL ?

I use Authorize.net and paypal
I tell if a listing is paid by ExpiryDate
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
LOL = Laugh out loud =)

Code:
I use Authorize.net and paypal
I tell if a listing is paid by ExpiryDate

Ok, so the way you tell if someone is a "member" is if they have at least one paid link that is active, yes?

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How do i write an If-Else Statement In reply to
Yes, That is the only way I know. If their are other ways that I could tell, I sure would like to know.
The Expiration date is in unix. I have to convert that date into Gregorian to read it.
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
Ok, well this is totally untested - but try:

check_if_user_has_paid
Code:
sub {

my $cond = new GT::SQL::Condition;
$cond->add('isValidated','=','Yes');
$cond->add('LinkOwner','=',$USER->{Username});
$cond->add('ExpiryDate','<','2147483647');
$cond->add('ExpiryDate','>',GT::Date::timelocal());
$cond->bool('AND');

if ($DB->table('Links')->count($cond) > 0) {
# they have a paid link, that is active
return { has_active_paid_link => 1 };
} else {
# they dont have a paid link thats active
return { has_active_paid_link => 0 };
}

}

Then call with:

Code:
<%check_if_user_has_paid%>
<%if has_active_paid_link%>
they have at least one link , that is validated and still active
<%else%>
they dont have any paid links (that are validated, or active)
<%endif%>

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] How do i write an If-Else Statement In reply to
Thanks that work fine.
and to link back to the login-sucess page
http://www.db_cgi_url/page.cgi?p=login_success

I hasd to use your plugin to take the user straight to the upgrade page

<%Plugins::ULTRAGlobals::Users_Listings($LinkOwner)%>
<%if user_links.length%>
<%loop user_links%>
<%include link3.html%>
<%endloop%>
<%endif%>

Link3.html

Listing ID# <%ID%> - <%Title%><br/>
<a href="<%config.db_cgi_url%>/modify.cgi?do=payment_linked;process_payment=1;modify=1;ID=<%ID%>">
<br></a>
Quote Reply
Re: [Sies] How do i write an If-Else Statement In reply to
Cool, glad it worked :)

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Post deleted by nir In reply to