Instellen agreement?

Gestart doorRootzz4 reacties33 weergaven

5 berichten · pagina 1 van 1

Rootzz

Lid · Topicstarter

Berichten
1.245
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Ik wil dus op mijn website instellen dat iedereen die er naar toe gaat eerst een agreement krijgt en dan de index dus

Agreement.php
en daarna pas de index,heeft iemand enig idee hoe dit te doen?
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Wil je echt controleren of de gebruiker al geweest is ?

want dan kan je dit doen met het ip adres van de gebruiker.

dan een scriptje maken dat controleert of het ip adres in de database voorkomt zo niet doorschakelen naar index.

als je wil dat de beginpagina altijd agreement.php is dan kan je dit met .htaccess doen met deze regel:

DirectoryIndex filename.html
0
Rootzz

Lid · Topicstarter

Berichten
1.245
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Oke ik doe het voorlopig wel met de .htaccess alvast bedankt!
0
Berichten
515
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Rootzz schreef:
Oke ik doe het voorlopig wel met de .htaccess alvast bedankt!
[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #FF8000]//bovenin bijv index.php[/COLOR]

[COLOR= #0000BB]$IP[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]];[/COLOR]
[COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"SELECT IP_adres FROM IP WHERE IP_adres = $IP"[/COLOR][COLOR= #007700]);[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/mysql_num_rows"]mysql_num_rows[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$sql[/COLOR][COLOR= #007700]) ==[/COLOR] [COLOR= #0000BB]0[/COLOR] [COLOR= #007700]) {[/COLOR]
    [URL="http://www.php.net/header"]header[/URL] [COLOR= #007700]([/COLOR][COLOR= #DD0000]location: agreement.php[/COLOR][COLOR= #007700]);[/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]();
}[/COLOR]

?>

[COLOR= #0000BB]<?php[/COLOR]

[COLOR= #FF8000]//Agreement.php[/COLOR]

[URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]accept[/COLOR][COLOR= #007700]])) {[/COLOR]
    [COLOR= #0000BB]$IP[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]$_SERVER[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]REMOTE_ADDR[/COLOR][COLOR= #007700]];[/COLOR]
    [COLOR= #0000BB]$sql[/COLOR] [COLOR= #007700]=[/COLOR] [URL="http://www.php.net/mysql_query"]mysql_query[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]"INSERT INTO IP (IP_adres) VALUES ($IP)"[/COLOR][COLOR= #007700]);[/COLOR]
    
    [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]Dank u wel voor het accepteren u word binnen 3 seconden doorgeschakeld[/COLOR][COLOR= #007700];[/COLOR]
    [URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]refresh: 3; URL=http://www.jouwsite.nl[/COLOR][COLOR= #007700]);][/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]();
}[/COLOR]
[URL="http://www.php.net/elseif"]elseif[/URL] [COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]decline[/COLOR][COLOR= #007700]])) {[/COLOR]
    [URL="http://www.php.net/die"]die[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]U moet accepteren om de site te kunnen zien[/COLOR][COLOR= #007700]);
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL] [COLOR= #007700]{[/COLOR]
    [COLOR= #FF8000]//jou voorwaarden hier[/COLOR]
    
    ?>
    <form action="agreement.php" method="post">
        <input type="submit" name="accept" value="Accept" />
        <input type="submit" name="decline" value="Decline" />
    </form>
    [COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]
?>

[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #FF8000]// database sql    "Jou database veranderen in jou database naam "[/COLOR]

CREATE TABLE  `Jou database`[COLOR= #007700].[/COLOR]`IP` [COLOR= #007700]([/COLOR]
`IP_adres` VARCHAR[COLOR= #007700]([/COLOR] [COLOR= #0000BB]50[/COLOR] [COLOR= #007700])[/COLOR] NOT NULL [COLOR= #007700],[/COLOR]
PRIMARY [URL="http://www.php.net/KEY"]KEY[/URL] [COLOR= #007700]([/COLOR]  `IP_adres` [COLOR= #007700])
)[/COLOR] ENGINE [COLOR= #007700]=[/COLOR] MYISAM [COLOR= #007700];[/COLOR]
?>


Dit zou je kunnen gebruiken met ip

als goed is zou hij meteen moeten werken.. anders moet je ff mogelijke fouten doorgeven.. het is laat in de middag ben hele dag al aan programeren en shit dusja foutje kan dichtbij zitten bloos
0
Tgrm

Lid

Berichten
2.133
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Het ligt eraan of je de agreement ALTIJD wil laten komen of maar één keer.

Je kunt bijvoorbeeld ook doen:

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]agree[/COLOR][COLOR= #007700]]))
{[/COLOR]
  [COLOR= #FF8000]// hier volgt de rest van de pagina[/COLOR]
[COLOR= #007700]}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
[URL="http://www.php.net/header"]header[/URL][COLOR= #007700]([/COLOR][COLOR= #DD0000]location: agreement.php[/COLOR][COLOR= #007700]);
}[/COLOR]

?>


en dan bij agreement.php doe je

[COLOR= #0000BB]<?php[/COLOR]

[URL="http://www.php.net/session_start"]session_start[/URL][COLOR= #007700]();[/COLOR]

[URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][URL="http://www.php.net/isset"]isset[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$_POST[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]agree[/COLOR][COLOR= #007700]]))
{[/COLOR]
[COLOR= #0000BB]$_SESSION[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]agree[/COLOR][COLOR= #007700]] =[/COLOR] agree[COLOR= #007700];[/COLOR]
[URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]"Klik <a href=index.php>hier</a> om verder te gaan"[/COLOR][COLOR= #007700];
}[/COLOR]
[URL="http://www.php.net/else"]else[/URL]
[COLOR= #007700]{[/COLOR]
?>
<form name=agreement method=post>
<input type=submit name=agree value=accepteren>
<input type=submit name=disagree value=niet accepteren>
</form>
[COLOR= #0000BB]<?php[/COLOR]
[COLOR= #007700]}[/COLOR]

?>
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren