View Full Version : View a page once
Jordan,
02-01-2008, 01:42 AM
On some DJ Panels there is a script were users can only view a page once dose any one no it
Aflux
02-01-2008, 02:07 AM
PHP is logical so it would be something like $user view="page.php" 1> echo = "page content" else $user view="page.php" 1< echo="lol no".
I'm not good at thinking logically but the first thing that comes to my head is having a mysql db and inserting the users IP into it and checking if the user has viewed thepage using their IP if so tell them no if not let them view:
<?php
$dbuser = "username";
$dbpass = "pass";
$dbname = "databasename";
$dbhost = "localhost";
//Change the values to your details for accessing the database..
$connect = mysql_connect($host, $dbuser, $dbpass);
mysql_select_db($dbname, $connect);
//Connect to the database..
$ip = $_SERVER['REMOTE_ADDR'];
//The users IP
$get = mysql_query("SELECT * FROM `tablename` WHERE `ip` = '" . $ip . "'");
//Check the database for any maches..
if(mysql_num_rows($get) > 0)
{
echo("No access already been viewed by this person..");
}
else
{
echo("Page content..");
mysql_query("INSERT INTO `tablename` (`ip`) VALUES ('" . $ip . "')");
//Add the users IP to the db to prevent them from accessing again..
}
?>
There might be a much easyer way to do this I just can't think atm. Hope it helps.
Dentafrice,
02-01-2008, 04:51 AM
PHP is logical so it would be something like $user view="page.php" 1> echo = "page content" else $user view="page.php" 1< echo="lol no".
Are you high? rofl.
You could set a cookie, use a database, or do a session (once per session)
Are you high? rofl.
You could set a cookie, use a database, or do a session (once per session)
See i thought about sessions/cookies but i'm not too sure how to go about so they never expire?
See i thought about sessions/cookies but i'm not too sure how to go about so they never expire?
You bake them out of lead.
Want to hide these adverts? Register an account for free!
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.