# PHP login script (i have the script but what do i do with it)

**URL:** <https://forum.kirupa.com/t/php-login-script-i-have-the-script-but-what-do-i-do-with-it/21583>\
**Category:** programming\
**Created:** [May 23, 2003, 1:02pm UTC](https://forum.kirupa.com/t/php-login-script-i-have-the-script-but-what-do-i-do-with-it/21583 "2003-05-23T13:02:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![chris9902](https://avatars.discourse-cdn.com/v4/letter/c/eb9ed0/32.png) [@chris9902](https://forum.kirupa.com/u/chris9902)\
**Post date:** [May 23, 2003, 1:02pm UTC](https://forum.kirupa.com/t/php-login-script-i-have-the-script-but-what-do-i-do-with-it/21583/1 "2003-05-23T13:02:39Z")

</div>

ok heres the script

```php

Blogger comments system. (php)

Last updated October 11, 2000 with url, email, timestamp and cookies. No longer as simple, the original simple code can be found here.

in your blogger template add this link somewhere so it is displayed at the bottom of each post.. 

<a href="javascript:void(0);"
onClick="commentPopUp('comments.php?comment=<$BlogItemNumber$>');">
Comments <? echo countlines("comments/<$BlogItemNumber$>.comment",0); ?></a> 

and these little scripts... 
<script language="JavaScript">
<!--
  function commentPopUp(theURL)
    {
    window.open(theURL,'comments','scrollbars=yes,resizable=yes,width=510,height=330'); 
    }
-->
</script>

<?
function countlines($list,$ctr) { if (file_exists($list)) { $lines = file($list); while(list($key, $val) = each($lines)) { if (stristr ($val, "<!-- comment -->")) { $ctr++; } } } if ($ctr > 0)
    return("(".$ctr.")");}
?>
and then these two php files which pull the comments. 

comments.php 

<?php

$lifetime = time()+86400*365; // expire in a year.

if ($email_cookie != "" && $email == "")
  $email = $email_cookie;
elseif ($email_cookie != $email)
  setcookie("email_cookie", $email, $lifetime);

if ($url_cookie != "" && $url == "")
  $url = $url_cookie;
elseif ($url_cookie != $url)
  setcookie("url_cookie", $url, $lifetime);

if ($name_cookie != "" && $name == "")
  $name = $name_cookie;
elseif ($name_cookie != $name)
  setcookie("name_cookie", $name, $lifetime);

?>

<html>
<head>
       <title>Comments <?php if ($comment) { echo (" on post ".$comment); } ?></title>
</head>
<body>
<b>comments <?php if ($comment) { echo (" on post ".$comment); } ?></b><p>
<?php require ("annotate.php"); ?>

</body>
</html>

annotate.php 

<?

if ($message) {
  $name = strip_tags($name);
  $message = strip_tags($message,"<a>,<b>,<i>,<p>,<br>");
  if (get_magic_quotes_gpc()) {
    $message = stripslashes($message);
    $name = stripslashes($name);
  }
  if (strlen($name) == 0) {
    $name = "anonymous";
  }

  if ($email && strlen($email) > 5 && stristr($email, "@")) {
    $message = "(<a href=\"mailto:$email\">email</a>) $message";
  }

  if (strlen($url) > 7) {
    if (substr($url, 0, 7) != "http://")
      $url = "http://$url";
    $message = "(<a href=\"$url\">www</a>) $message";
  }

  $message = ereg_replace("

", "
<P>", $message);

  $date = date("[D H:i]");
  $message = "<b>$date $name</b> $message <!-- comment --><br>";
  $fp = fopen ("comments/" .$comment. ".comment", "a");
  fwrite ($fp, $message . "
");
  fclose ($fp);
}
@readfile(("comments/" .$comment. ".comment"));

?>

<FORM method="post">
<b>name:</b><br><INPUT name="name" type="text" size="55" value="<? echo $name; ?>"><BR>
<b>email:</b><br><INPUT name="email" type="text" size="55" value="<? echo $email; ?>"><BR>
<b>url:</b><br><INPUT name="url" type="text" size="55" value="<? echo $url; ?>"><BR>
<b>comment:</b><br><TEXTAREA name="message" rows=10 cols=55 wrap=virtual>
</TEXTAREA><BR>
<div align="right"><INPUT name="submit" type="submit" value="submit"></div>
</FORM>

Finally make sure that the 'comments' subdirectory is writable by the webserver (chmod to 777), as its where the comments are stored and stuff.

```

or this URL [http://www.adnan.org/phpcomments/origcode.html](http://www.adnan.org/phpcomments/origcode.html)

what do i do with it, please post in terms i can understand (really really simple)

thank you:rambo:
