This topic is locked

Advertising after login

12/22/2014 12:27:28
PHPRunner General questions
T
taumic author

Hello, after login I want to show the user an advertisement. This can be a JPG graphic or PDF, which is in a fixed directory on the server.

Does anyone have an idea or perhaps a sample code how to implement it with PHPR 8.0.
Thank you
Taumic

Sergey Kornilov admin 12/22/2014

Setup a separate page with advertisement and redirect user to that page using AfterSuccessfulLogin event i.e.

header("Location: my_ad_page.htm");

exit();
T
taumic author 12/23/2014



Setup a separate page with advertisement and redirect user to that page using AfterSuccessfulLogin event i.e.

header("Location: my_ad_page.htm");

exit();



Thank you for your quick response.

But if I do so, the user is outside the PHPR project. He has to stay inside after login. He should get displayed the advertisements and are led by a click on "OK" to the main menu.

I know it sounds simple, but I've played around a lot.
Merry Christmas
Taumic

Sergey Kornilov admin 12/23/2014

I'm not really sure I understand what being "inside" or "outside" means.
You simply create this sort of page, redirect user to that page after login and display "OK" button on your advertisement page that would take user to menu.php file.

Please delete this account 12/23/2014

Sergey, 1st, many thanks to you and your team for excellent shown support and v8.0 in particular. Merry XMAS, stay tuned and HAPPY NEW YEAR already by now.
Think, your reply 7 years ago refers here,
i.e. Posted 19 May 2007 - 08:36 PM
You cannot protect HTML page.
Rename your page to index2.php and add the following code snippet in the beginning of the page:
<?php

if(!@$_SESSION["UserID"])

{

$_SESSION["MyURL"]=$_SERVER["SCRIPT_NAME"]."?".$_SERVER["QUERY_STRING"];

header("Location: login.php?message=expired");

return;

}

?>

unquote
While one forum member posted the code below to have worked for him.
<?php

session_start();

if (!@$_SESSION['UserID']) {

$_SESSION['MyURL'] = $_SERVER['SCRIPT_NAME'].'?'.$_SERVER['QUERY_STRING'];

header('Location: login.php?message=expired');

die();

}
?>

Sergey Kornilov admin 12/23/2014

walk2fly,
thanks for chiming in. I'm just not sure why would you need to protect the page with some ads. If you need to, then yes, the suggested approach will help.