PDA

View Full Version : Displaying Information


WindWalker
09-01-2003, 10:46 AM
Ok, I have the script working great, luv it!! :D But I want to display information about the members on all pages using the smarty template system thru-out my whole site, and if they are not logged in display a welcome andl ogin instead of the members information. Such as if you go to the site it would say welcome, would you liek to log in? so you do and then instead the message is gone after login and instead displays a memebers menu or something. Can it be done?

alex-adm
09-02-2003, 05:32 PM
Sure, it is possible, use code like that:

1. Use
session_start();
in top of all your PHP pages

2. Use the following in your smarty code:
{if $smarty.session._amember_login}
Hello {$smarty.session._amember_user.name_f}!
{else}
Please login
{/if}

komlos
09-03-2003, 01:13 PM
Hi,

What code do I have to use for the same problem with the exception that I want to display info on my PHP pages, not in the smarty templates?

Thanks

WindWalker
09-04-2003, 06:02 AM
I agree, I would like to know how to do this also. I Would like to be able to only show certain content for my members and not visitors on my other php pages that are not using the smarty templates.. B)

alex-adm
09-05-2003, 07:13 PM
<?
session_start();
if ($_SESSION['_amember_login']){
print "Hello " . $_SESSION['_amember_user']['name_f'] . "!";
} else {
print "Please login";
}
?>

microlinx
02-07-2005, 10:16 AM
Hi Alex:

I was wondering if there is a way to dynamically display the current number of subscibers on an html page, either inside my protected area or outside the protected area, like on the home "sales" page before someone signs up, so they can see that other's are subscribed and how many.

It just need it to be automatically updated each time someone subscribes.

Thanks again for a GREAT script & keep up the good work!
:D

alex
02-12-2005, 06:10 PM
something like this:

<?php
function get_amember_users_count(){
$mc = mysql_connect("localhost", "username", "password",1 );
if (!$mc) { print "MySQL connection failed: " . mysql_error(); return -1; }
$ok = mysql_select_db("databasename", $mc);
if (!$ok) { print "Cannot change MySQL database : " . mysql_error(); return -1; }
$q = mysql_query("SELECT COUNT(member_id) FROM amember_members
WHERE status > 0", $mc);
if (!$q) { return "Query error: ".mysql_error(); return -1; }
list($c) = mysql_fetch_row($q);
return $c;
}
print get_amember_users_count();
?>

microlinx
02-27-2005, 02:38 PM
Thanks Alex!

One more question related to this:

Is it possible to display the current number of LOGGED IN users on a page?

This could prove useful on a download page, just in case 20 people are all downloading the same file at once...of it is slow, they would know why.

Thanks!

alex
02-27-2005, 03:38 PM
No, it is completely impossible.