[ ctpaba @ 16.02.2005. 21:38 ] @
treba mi mala pomoc oko jedne stranice

u stvari par sitnica za koje sam nasao skripte u javi ali u ovom mom slucaju java ne dolazi u obzir tako da mi php ostaje jedino resenje :(

treba da dozvolim pristup stranici ali samo ukoliko posetilac dolazi sa odredjenog linka i da ne moze koristiti refresh dugme, i ako bi mi neko reko kako da uradim da se pop up sam zatvori posle par sekundi ??

hvala unapred
[ Nemanja Avramović @ 16.02.2005. 21:48 ] @
evo ti za referer:
Code:

<?php
$keyword = 'localhost'; //keyword which must be inna url!
$prethodni = getenv('HTTP_REFERER');
if (ereg($keyword, $prethodni) == false) { die("Access denied"); }
?>


popup? ne zanima me :)

edit: kao keyword mozes staviti celu adresu

[Ovu poruku je menjao JaHvram dana 16.02.2005. u 22:51 GMT+1]
[ igac @ 16.02.2005. 21:48 ] @
pa imas $_SERVER["HTTP_REFERER"] to ti vraca "odakle" je dosao user tj gleda ko je referer... ako uradi refresh onda tog nece biti pa znaci samo to provjeris... a za popup imas na netu javascriptova pa pogledaj ili ako neko ima...

//edit
pogledao sam sada za refresh i ne skida referera... nista onda, stavi preko sesije da gleda da li je vec bio jednom...ako jeste die()
[ boccio @ 16.02.2005. 22:31 ] @
.htaccess je majka za takve stvari...
Code:

RewriteEngine On 
RewriteCond %{HTTP_REFERER} !^http?://www\.example\.com/.*$ [NC] 

U ovom primeru samo pristup sa domena www.example.com ce biti dozvoljen...

Sa druge strane, mozes i ovako:
Code:

order allow,deny
deny from 123.123.123.123
allow from all

U ovom primeru bice zabranjen pristup sa IP adrese 123.123.123.123, a sa svih ostalih dozvoljen....

choose your flavor :)
[ gagi @ 17.02.2005. 14:32 ] @
Da se pop-up zatvori nakon odredjenog vremena .....


Code:


<!-- FIVE STEPS TO INSTALL AUTOCLOSE INACTIVE POPUP:

  1.  Copy the coding into the HEAD of your HTML document
  2.  Add the onLoad event handler into the BODY tag
  3.  Put the last coding into the BODY of your HTML document
  4.  Create a new HTML file with the code below
  5.  Create a new HTML file with the code below  -->

<!-- STEP ONE: Paste this code into the HEAD of your HTML document  -->

<HEAD>

<SCRIPT LANGUAGE="JavaScript">

<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Edward Huspeka ([email protected]) -->


<!-- Begin
var TimeOut = 30;    // Initial time to Close window after __ number of seconds?
var TimeRemain = 0;  // Remaining time to Close window after __ number of seconds?
var RefreshRate = 2; // Check to close window every __ number of seconds?
var ChildWin = null;
function TimedPopup(url)
{
 windowprops = "left=250,top=250,width=200,height=200"; // May be adjusted according to your needs
 if (ChildWin)
     return false;
 ChildWin = window.open(url, "ChildWin", windowprops);
 ResetTimer();
 if (TimeOut && RefreshRate)
    setTimeout("CheckClose();",RefreshRate * 1000);
}
function ResetTimer()
{
 TimeRemain = TimeOut;
 document.form1.field1.value = TimeRemain; // For demo purposes only (May be removed)
}
function CheckClose()
{
 TimeRemain -= (RefreshRate);
 if (TimeRemain > 0)
    {
    if (ChildWin && ChildWin.closed)
       {
    document.form1.field1.value = TimeOut; // For demo purposes only (May be removed)
    ChildWin = null;
       }
    else
    if (ChildWin)
       {
        document.form1.field1.value = TimeRemain; // For demo purposes only (May be removed)
    setTimeout("CheckClose();",RefreshRate * 1000);
       }
    }
 else
 if (ChildWin)
    {
     document.form1.field1.value = TimeOut; // For demo purposes only (May be removed)
     if (ChildWin.closed)
     ChildWin = null;
     else
    {
         ChildWin.close();
     ChildWin = null;
        }
    }
}
//  End -->
</script>

</HEAD>

<!-- STEP TWO: Insert the onLoad event handler into your BODY tag  -->

<BODY onUnload="if (ChildWin){ChildWin.close()};">

<!-- STEP THREE: Copy this code into the BODY of your HTML document  -->

<div align="center">

<form name="form1" method="post" action="">
  <input type="button" name="Submit" value="Show Popup" onClick="TimedPopup('autoclose-inactive-popup2.htm');">
  <br><br>
  Time Remaining: <input type="text" name="field1" value="30" size="4">
</form>

</div>


<!-- STEP FOUR: Paste this code into a new HTML document  -->
<!-- Be sure it matches the name in line two of the form above after 'onClick='  -->

<html>
<head>
<title>JavaScript Example</title>
</head>

<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Edward Huspeka ([email protected]) -->

<!-- Begin
if (window.opener)
    window.opener.ResetTimer();
//  End -->
</script>

<body>
Page 2
<p>
If you click on "Next Page", the timer will be reset.
<p>
<a href="autoclose-inactive-popup3.htm">Next Page </a>
</body>
</html>


<!-- STEP FIVE: Paste this code into a new HTML document  -->
<!-- Be sure it matches the name in line two of the form above after 'onClick='  -->

<html>
<head>
<title>JavaScript Example</title>
</head>

<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Original:  Edward Huspeka ([email protected]) -->

<!-- Begin
if (window.opener)
    window.opener.ResetTimer();
//  End -->
</script>

<body bgcolor="#FFFFFF" text="#000000">
Page 3
<p>
If you click on "Next Page", the timer will be reset.
<p>
<a href="popup2.htm">Next Page </a>
</body>
</html>


<p><center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided<br>
by <a href="http://javascriptsource.com">The JavaScript Source</a></font>
</center><p>

<!-- Script Size:  4.20 KB -->