Click here to Skip to main content
15,906,106 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi Guys
My name is Marzena and I'm from Lithuania.
I have a problem- to me it is a huge one, to you probably a joke.
Being complete noob at php I have managed to find the script to embed a cookie onto the client browser and its working well. The reason for the cookie to be placed is that I want my visitors to be able to visit some of my web pages only once, and the cookie should work as a indicator for the server not to let the client browser in again.
I know its unusual way to use cookies but this is the only way that I can think of to be relatively certain that there will be no mess. In lithuania the ISP's still use dynamic IP's , and some sort of device based identification is required.
Could any one of you type this few lines of code for me so I could simply restrict previous visitors (those who already have the cookie).
The cookie will be placed with their consent and the reason for the whole thing is as follows:
I have to present a proof of work on my website but it will be different for each group of people, and it will be changed quite a few times. I simply don't want others to see the proof of work not intended for them and one visit per client is enough to download the file. Also I would email the thing to interested parties but, well, I don't know who they are ( for most part). I'm not gaining anything from this except I would be welcomed to certain college society (country-wide)- the proof of work is poetry related and have nothing to do with IT.
Is there anybody out there who would be ready to get me going, I'm stuck and google shows no results whatsoever.
Thank you for any help in advance
Marzena

What I have tried:

I have tried to find any similar issue on google with no result...
My idea must be very weird... :)
Posted
Updated 30-Nov-18 1:13am
Comments
Mohibur Rashid 8-Oct-18 17:38pm    
At the beginning of the script check for that cookie. If that cookie is there, return 404 error or however you like to deny. But cookie is not a solution. Cookie can be reseted. Cookie can be denied. In a loop your resources can be downloaded millions of times. Since you have email, you can ask user to register with email and you can use the email as id to store access information.

1 solution

PHP isnt difficult, learn it, there are many websites that teaches you or even books.
It is one of the easiest languages to step into.

if you want to customize your website your self, this is the minimum what you should be able to do, being ignorant of what you run/use is a risk for your own webserver and your visitors privacy / security.

To give a little slack in the matter, what you need is a simple filter, for example;

mysql table with id, ip and reason
a header in all your php files that run a script that compares $_SERVER['REMOTE_ADDR'] with the ip row in your table. for example:

PHP
$query = mysqli_query("SELECT reason from IP_BANS WHERE ip = " . $_SERVER['REMOTE_ADDR']);
if (mysqli_rum_rows($query) > 0)
{
// THOU SHALL NOT PASS
}

Do some research, learn php, shouldnt take long and then come back with what you have if it doesnt work.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900