Logo
file-based simple guest book
Online Now: 0
Snippet Code

<?php

define
("USERS_LOG","users.log");

if(
$_SERVER["REQUEST_METHOD"] == "POST"){
$fn trim(strip_tags($_POST["fname"]));  
$ln trim(strip_tags($_POST["lname"])); 
$user "$fn $ln \n";
file_put_contents(USERS_LOG,$userFILE_APPEND);
header("Location: test.php");
exit;
}
?>

<form  action="" method="post">
<input type='text' name='fname'>
<input type='text' name='lname'>
<input type='submit' value='submit it'>

</form>

<?php
if(file_exists(USERS_LOG)){
    
    
$users file(USERS_LOG);
    if(
is_array($users)){
        
$users array_reverse($users);
        echo 
"<ol>";
        foreach (
$users as $user){
            echo 
"<li>$user</li>";
        }
        echo 
"</ol>";
    }
    
}
?>
 
Snippet Comments

Add Your Comment

No Comments Yet.

Add Your Comment

 
Snippet Tools
Rate this Snippet:

Rate the difficulty level:

Request Snippet Update


Suggested Difficulty Level: No votes yet.
Current Score: No votes yet

Total Views: 180

Other top snippets by maque:

1. Read file or site in a string
2. If else
3. Types of loops (for, foreach, while)
4. put links on homepage only
5. Showing date

Search
Search for:







User Panel

User name:

Password:

Register And Post Your Own Snippets

New Snippets

1.  Shorten text and (4 of 1)

2.  file-based simple guest (0 of 0)

3.  adding an entry (0 of 0)

4.  integer to currency (1.33 of 3)

5.  Aggregate IP addresses (0 of 0)

6.  file handling (0 of 0)

7.  testing system with (0 of 0)

8.  Make an php (1 of 1)

9.  allow download in (5 of 1)

10.  redirect in 3 (0 of 0)

11.  live clock with (0 of 0)

12.  visit counter (3.5 of 2)

13.  contact form with (4 of 1)

14.  show a specific (0 of 0)

15.  The & sign (0 of 0)

16.  static variable in (0 of 0)

17.  multiplication table with (0 of 0)

18.  function with multiplicationt (0 of 0)

19.  php generated menu (0 of 0)

20.  drawing a table (0 of 0)

21.  embedded array (one (0 of 0)

22.  checks the week (0 of 0)

23.  put links on (4.5 of 2)

24.  Directory Image Gallery (0 of 0)

25.  TOS (4 of 1)

Home | Forum | Free PHP Web Hosting | Contact | Terms & Conditions |  
Donate
PHPSnips.com - ©2012 Amethyst Creative