Jump to content
View in the app

A better way to browse. Learn more.

GTAGames.nl - De Nederlandse Grand Theft Auto Community!

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Hallo allemaal, ik heb een probleem. Ik heb de volgende script:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
//Calculate 60 days in the future
//seconds * minutes * hours * days + current time
$inTwoMonths = 60 * 60 * 24 * 60 + time(); 
setcookie(lastVisit, date("G:i - m/d/y"), $inTwoMonths);

if(isset($_COOKIE['lastVisit']))
$visit = $_COOKIE['lastVisit']; 
else
echo "You've got some stale cookies!";

echo "Your last visit was - ". $visit; 
?>
</body>
</html>

Het script werkt wel alleen krijg ik de volgende fout:

[b]Warning[/b]:  Cannot modify header information - headers already sent by (output started at /web-drive/gimyweb/homes/roy/counter.php:9) in [b]/web-drive/gimyweb/homes/roy/counter.php[/b] on line [b]10[/b]

Weet iemand waar dit door komt en hoe ik dit op kan lossen? Alvast bedankt. _O_

Featured Replies

Hey, Roy!

De functie setCookie() moet geplaatst worden vóórdat er enige output geparsed is. Dus voordat er tekst op het beeldscherm verschijnt, maar ook voordat je HTML tags gebruikt, of zelfs een spatie voor de <?php zet. Het zelfde geld ook voor de sessie gerelateerde functies en de header() functies. Kijk naar het volgende script:

   <?php
setCookie(x,x,x);
?>

Fout - Er staat een spatie (dat dus output is) voor <?php

Dus in jouw script zal dit wel werken:

<?php
$inTwoMonths = 60 * 60 * 24 * 60 + time();
  setcookie(lastVisit, date("G:i - m/d/y"), $inTwoMonths);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<?php
//Calculate 60 days in the future
//seconds * minutes * hours * days + current time

if(isset($_COOKIE['lastVisit']))
$visit = $_COOKIE['lastVisit'];
else
echo "You've got some stale cookies!";

echo "Your last visit was - ". $visit;
?>
</body>
</html>

Succes!

Edited by ViceAgent

  • Author
_O_ Dat werkt! Je bent de beste :clown:

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Recently Browsing 0

  • No registered users viewing this page.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.