Forum Moderators: coopster
I am assuming that you want to put this system in place to keep people from the download and run scenario.
Do you store anything in a database? How would you know if they had posted. I fyou store in a database you could just check to see if they had ever posted and then only show the content if $postcount > 1.
Someone clicks on the download link
logged in?
no = dont show content or show login form
if yes
have they posted?
no = dont show content or show login form
yes = show downloads
As far as how/where all this data is stored you will have to familiarize yourself more with your system. Look at the mysql data to see what is available to use, maybe insert a new field. Then build the script on the actual download page. There are many more complex ways to do this but this would seem the most straightforward.
As far as how/where all this data is stored you will have to familiarize yourself more with your system
Thats the problem, I have no idea how your system works or what it stores or how it stores it. You would have to do a select from your database, based on the username stored in the session/cookie and see if they have any posts.
You would have to find out the name of the column and table that stores the post count. Once you have selected this data you can do something like this above the content.
if ($postcount > 1) {
//actual content here
} else {
//show "please post first" message
}
That code is simple. Here is a generic example of what the whole thing might look like. Fieldnames, tablenames, whether session or cookie for login you will have to figure out.
if (!isset($_SESSION['username'])) {
//show the login script
} else {
$pquery = "select postcount from usertable where username='".$_SESSION['username']."'";
$postcountquery = mysql_query($pquery);
$postcount = mysql_fetch_field($postcountquery);
if ($postcount > 1) {
//actual content here
} else {
//show "please post first" message
}
} All of the bold values can be searched on www.php.net for more information. This is a very generic example and must be customized to your system to work.