TP-Docs
HTML5 Icon HTML5 Icon HTML5 Icon
TP on Social Media

Recent

Welcome to TinyPortal. Please login or sign up.

June 17, 2024, 08:03:55 AM

Login with username, password and session length
Members
Stats
  • Total Posts: 195,254
  • Total Topics: 21,225
  • Online today: 149
  • Online ever: 3,540 (September 03, 2022, 01:38:54 AM)
Users Online
  • Users: 0
  • Guests: 136
  • Total: 136

[Block] Guest Page View Limit

Started by Thurnok, November 17, 2006, 04:51:03 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

Thurnok

Ok, you can put in any block, regardless if that block shows on the same page as registration page or not now without issue.  New code in first post.

ianus

Greetings!

This is not a question, a request or something like this. I only like the Idea in general, but see some problems and maybe an improvement.

IÃ,´m running a board, to provide Informationââ,¬â,,¢s about games and know, that a lot of people come to read my stuff. Also I invited even Guest to post, at some boards, but nearly nobody use the chance to get (easily) involved.

Thatââ,¬â,,¢s why I like your Idea, but I donÃ,´t want to force my guests hand.

So, point one is, that I would prefer, if not the registration site is shown up, but a general (handmade) site with a short hint like ââ,¬Å"You have now seen x sites of my contend. I like to invite you to register (link). Please klick here to continue without registering.ââ,¬Â
(Only as an example).

This extra site, even without the possibility to continue, seems to be more polite, because it allow to explain, why somebody is forced to register. Without, I only get a register page and donÃ,´t know what happens.

Second thing, the duration.
I like it, if guests come back to my side, looking for new contend.
If the have a static IP, they canÃ,´t do this, without being forced to register immediately.
If they have an dynamic IP, it could happen, that this IP is noticed in the database already.

To make a long story short, I would prefer a kind of circle.
Count page views of an IP. Show a short hint every x page view. Count next x page views, show a hint, etc.

Accent: This is not a question, a request or something like this. I donÃ,´t ask your to modify your code. I only like your (basic) idea and canÃ,´t keep my mouth shut.

Have al lot of fun and successes with everything you do.
ianus



knat

#12
I think the solution to your first idea is easy to do


Create an article to say the things you want to say to your guests.. plus a link to register

Then change this code to direct the guest to your new article instead of the registration page..

From this:
// Send to registration if they are at or above max pages
if ($gpvl_NumPages >= $gpvl_MaxPages){
header("Location: ".$scripturl."?action=register");
}
}


To This

// Send to registration if they are at or above max pages
if ($gpvl_NumPages >= $gpvl_MaxPages){
header("Location: ".$scripturl."?page=17");
}
}


Tested, and fixed to work... just change the page number to your page  ;)

Thurnok

Yep.. Knat nailed it.
Follow his changes and suggestion and you are there on your first request.

Your second request is a bit more tricky (not impossible, nor difficult for some situations) but it really depends on how you want to track time, and what constitutes your clearing of the count so they aren't redirected and the count starts over.  It would involve adding another field to the table for a date/time stamp, then a determination made as to the logic for saying "It's been long enough to reset this IP".

I'll consider updating it with this in the future as soon as I have some free time again.  Knat might beat me to it however.. hehe

ianus

Greetings!
IÃ,´m not skilled enough in using the English language to express the way your support astonished me. ItÃ,´s absolute excellent!

Quote from: Thurnok on December 06, 2006, 02:35:23 AM
Yep.. Knat nailed it.
Follow his changes and suggestion and you are there on your first request.
As I mentioned, this isnÃ,´t a request. IÃ,´m only trying to mention my idea of a (possible) improvement.

So, the solution, Knat mentioned, is working (of course). Well, I can imagine, that a backlink to the last viewed page, would be nice, if the custom page is shown up. This would make it perfect.

No need to write code for it!

The second part.

/ Send to registration if they are at or above max pages
if ($gpvl_NumPages >= $gpvl_MaxPages){
header("Location: ".$scripturl."?action=register");
}

In my oppinon, a simple

ââ,¬Å"if ($gpvl_NumPages >= $gpvl_MaxPages)ââ,¬Å"
First action : header("Location: ".$scripturl."?action=register");
Second action: delete $gpvl_ip of user

should be enough.


But, for this point, itÃ,´s also not necessary to write code for it!

If you want to alter your snippet, feel free, but I donÃ,´t want to waste your time.

Have al lot of fun and successes with everything you do.
ianus


metal13

hi, can i request.. im like planing to do the page view limit on all membergroups and i want them to be redirected on an html page.. do you think thats possible?

thanks for the code!

Thurnok

Yes, but I'm not sure why you would want to limit all membergroups to viewing your site.  Viewing a specific article might be more appropriate - say if you only wanted them to be able to view the article a number of times before redirecting them somewhere.  If you want to do it for your entire site however, you probably would want the count to be reset right afterwards for them as well.

What specifically were you planning to do with it?  That info would probably help understand what you really need anyway.

metal13

ohh sorry, i mean limit the page views per day..for all membergroups..  is that possible?

knat

Quote from: metal13 on December 21, 2006, 04:29:41 PM
ohh sorry, i mean limit the page views per day..for all membergroups..  is that possible?

That sounds unhealthy to any forum :D

metal13

hmm why is that? my server is overloaded and my smf cant connect to the data base everytime i get around 100+ users online... so i think i need that..

any ideas on how to solve this? i dont want to stop using tp, hmm.. is there any way to minimize the queries of my smf and tp? i onl have 5 important mods installed on  forum and still overloaded...