Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start ( );
- header ( "Content-type: text/html" );
- if ( isset ( $_SESSION [ "views" ] ))
- {
- if ( empty ( $_SESSION [ "views" ] ) || $_SESSION [ "views" ] == false )
- {
- $_SESSION [ "views" ] = 0;
- }
- if ( isset ( $_POST [ "stopcount" ] ) && $_POST [ "stopcount" ] == 1 )
- {
- session_destroy ( );
- header ( "Location: http://localhost/mer-php/neocounter.php" );
- }
- $_SESSION [ "views" ] ++;
- }
- else
- {
- $_SESSION [ "views" ] = 1;
- }
- ?>
- <html>
- <head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8">
- <title>Besøks teller</title>
- </head>
- <body>
- <span>Antall besøk: <?php echo isset ( $_SESSION [ "views" ] ) ? $_SESSION [ "views" ] : 0 ; ?></span>
- <form action="" method="post">
- <input type="checkbox" name="stopcount" value="1"><span>Ja, nullstill</span>
- <input type="submit" value="send inn">
- </form>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement