Post: [AJAX] Simple html comment box **NGU exclusive script**
05-02-2011, 08:28 PM #1
<Jimbo>
</Jimbo>
(adsbygoogle = window.adsbygoogle || []).push({});
Well I noticed that a lot of people have their own sites, so as the title says... You can put this onto your site and have your own 'comment box'.
You must login or register to view this content.
That has no styling.
Example URL:
You must login or register to view this content.

The following script allows people to post a comment on your site and have it displayed instantly... without you using pre-made features like so.


First, your AJAX script which belongs with in the <head> tag's
    <html>
<head>
<script type="text/javascript">
function formRet()
{
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}
else
{
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("myDiv2").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","comments.txt",true);
xmlhttp.send();
}
</script>
</head>


Then this which can go anywhere within the <body> of your script.
    <body onLoad="formRet()">


Then have the have the form where people will input their comments in. As so:
    <form action="next.php" method="get">
Name: <input type="text" name="Name" />
Comment: <input type="text" name="Comment" />
<input type="submit" value="Submit" />
</form>

And edit the the values such as Name etc...

The text will be displayed on the loading of the page in the where ever you decide to place this:
    <!--Comment form by Jimbo-->
<div id="myDiv2">This will be replaced by text from the .txt file!</div>
<!--End of comment form by Jimbo-->

Feel free to edit all of the above with your own styling i.e. a CSS style sheet etc...

Then finally copy the following text and save it as "next.php" and upload it in the same directory as the comment box is!
    <?php
$datum = date('d-m-Y / H:i:s'Winky Winky;
header("Location: https://REPLACE THIS WITH THE URL OF THE COMMENT BOX!");
$handle = fopen("comments.txt", "a");
foreach($_GET as $variable => $value) {
fwrite($handle, $value);
fwrite($handle, "
");
}
fwrite($handle, "Date: $datum (Date=0 GTM)
");
fclose($handle);

setcookie ("user", "empty", time()+3600);
exit;
?>


And it really is that simple! :y: Don't forget to style this as you wish to make it look 'unique'!

And of course please leave feed back! Smile
Last edited by <Jimbo> ; 06-12-2011 at 03:02 PM.

The following 2 users say thank you to <Jimbo> for this useful post:

Kombust, thehardcore210
05-02-2011, 08:30 PM #2
--xXRyanXx--
Little One
photo of finished peice?
05-02-2011, 08:43 PM #3
<Jimbo>
</Jimbo>
I have done! :y:

Originally posted by xXRyanXx
photo of finished peice?
05-02-2011, 08:51 PM #4
--xXRyanXx--
Little One
Originally posted by RGB
I have done! :y:


Thank you Smile looks good i might use good job
05-03-2011, 04:33 PM #5
--xXRyanXx--
Little One
Originally posted by RGB
I have done! :y:


im using now im just making it so it has a nice bg Smile and pumping it up a bit i will post credits to you when im done Smile
05-03-2011, 09:03 PM #6
<Jimbo>
</Jimbo>
I'm glad you like it man! Smile I appreciate the feedback! :p

Originally posted by xXRyanXx
im using now im just making it so it has a nice bg Smile and pumping it up a bit i will post credits to you when im done Smile
05-05-2011, 08:45 PM #7
This is really cool! Thanks man.
05-05-2011, 09:08 PM #8
t0asty
Web Dev / Security
You need a .htaccess or atleast blank html pages on your server bro. I've found some really weird shit on there. Like this for example:

You must login or register to view this content.
Last edited by t0asty ; 05-05-2011 at 09:14 PM.
05-05-2011, 09:36 PM #9
<Jimbo>
</Jimbo>
Yes, I have a life Happy Sounds weird. But you can have so much fun with porn that you can access in school. I'll move that now. Seems people are browsing. :lol:

Originally posted by Lewbo11 View Post
You need a .htaccess or atleast blank html pages on your server bro. I've found some really weird shit on there. Like this for example:

You must login or register to view this content.


Plus I think that was the only one. :confused:
Last edited by <Jimbo> ; 05-05-2011 at 09:38 PM.
05-06-2011, 06:38 AM #10
nice wana help me put this on my site

Copyright © 2024, NextGenUpdate.
All Rights Reserved.

Gray NextGenUpdate Logo