PHP scripts and programs for Beginner to Master php programs, php ready to use scripts & functions, css tutorials, html, javascripts, ajax examples for Beginner to Master
Selasa, 23 Maret 2010
New version 3.0.4 of ApPHP Calendar released
The new version 3.0.4 of ApPHP Calendar is available now for downloading. There are mansome bugs fixed and also many additions and improvements. This version requires full re-installation, if you work with one of previous. Here the main additions and improvements:* Feature: [added] possibility to work with events, related to certain user by using SetUserID() method * Feature: [added]
Sabtu, 20 Maret 2010
New version 6.0.7 of PHP DataGrid released
The new version 6.0.7 of PHP DataGrid is available now for downloading. There are many improvements and new features, like new field types ("color", "percent"), new PEAR database drivers, new version of JS AFV using etc. This version requires full re-installation, if you work with one of previous. Read carefully Getting Started. Here the main additions and improvements:* Feature: [added] in
Kamis, 18 Maret 2010
New product released: ApPHP TreeMenu!
The ApPHP TreeMenu is a PHP script that generates multilevel tree menu control. It was specially designed for web developers. Tree menu is one of the most popular and commonly used navigation controls and it allows you to set up and use in no time.It has a collapsible vertical tree listing, that resembles the Windows Explorer folder view. It also makes it easier for visitors of your website to
Senin, 01 Maret 2010
Create Guestbook / Shoutbox in php, mysql with css
Hi everyone,
Today i am going to show you how to Create Guestbook / Shoutbox in php mysql, in a very easy way and with simple code.
First thing that you might be thinking is what is a Guestbook or Shoutbox ?
These are the places where your website visitors or users can type their views or some information in a simple box.
In this program we are going to create a simple shoutbox / Guestbook which will allow your website visitor to enter some simple data about your website.
So lets start,
First we need to create the table which will store our data into database.
Create the table structure in your MySQL database as follows
After creating database and table you need to create a database connection file.
If you don't know how to create a database connection file then you should check this.
Specify the settings in database connection file.
Now we will be creating a form which will accept user's name and their shout or opinion.
So lets design it.
If the form is not posted then we will display the form and show the existing records from the database.
So now you will see a form which will show you a textbox and a textarea for entering name and some shout. Just enter name and shout and click submit.
Now is the actual part of entering shout into database and come back to entry page.
So now we will be checking if the form is submitted then we will process the form.
For security we will be adding a simple spam comment prevention logic, we will not allow one ip to enter more than 5 shouts, comments to our form on same day.
And you are done. Our shoutbox is ready to accept your website viewers shouts.
Now some interesting part to design your form and display with css
So you are ready with a nice looking shoutbox.
See here is the full source code for your testing
Let us know whether you liked it or not. This is just a basic sample example for you.
Its not fully secure. If you know some simple function to prevent bots using this for data entry then let me know.
Today i am going to show you how to Create Guestbook / Shoutbox in php mysql, in a very easy way and with simple code.
First thing that you might be thinking is what is a Guestbook or Shoutbox ?
These are the places where your website visitors or users can type their views or some information in a simple box.
In this program we are going to create a simple shoutbox / Guestbook which will allow your website visitor to enter some simple data about your website.
So lets start,
First we need to create the table which will store our data into database.
Create the table structure in your MySQL database as follows
After creating database and table you need to create a database connection file.
If you don't know how to create a database connection file then you should check this.
Specify the settings in database connection file.
Now we will be creating a form which will accept user's name and their shout or opinion.
So lets design it.
If the form is not posted then we will display the form and show the existing records from the database.
if (!isset($_POST["submit"]))
{
$query = "SELECT id, name, message, DATE_FORMAT(date, '%D %M, %Y') as newdate FROM guests ORDER BY id DESC LIMIT 0, 8";
$result = mysql_query($query);
?>Post a message
}
?>
So now you will see a form which will show you a textbox and a textarea for entering name and some shout. Just enter name and shout and click submit.
Now is the actual part of entering shout into database and come back to entry page.
So now we will be checking if the form is submitted then we will process the form.
For security we will be adding a simple spam comment prevention logic, we will not allow one ip to enter more than 5 shouts, comments to our form on same day.
$name = stripslashes($_POST['name']);
$message = stripslashes($_POST['msg']);
if(isset($_POST["submit"]))
{
// Add new entry to the database
$ip = $_SERVER['REMOTE_ADDR'];
$now = date("Y-m-d");
$query1 = "SELECT * FROM guests WHERE guestip='$ip' and date ='$now'";
$result1 = mysql_query($query1);
$cnt = mysql_num_rows($result1);
if($cnt<5)
{
$now = date("Y-m-d");
$query = "INSERT INTO guests (name, message, date, guestip) VALUES ('$name','$message','$now','$ip')";
$result = mysql_query($query) or die(mysql_error());
// go back to entry page
$referer = $_SERVER['HTTP_REFERER'];
header ("Location: $referer");
}
else
{
echo "Thank you for your comments. But you cannot submit more comments today as its a spam prevention mechanism to avoid spammers.";
echo "
If you are a spammer then just GO away.";
}
}
And you are done. Our shoutbox is ready to accept your website viewers shouts.
Now some interesting part to design your form and display with css
So you are ready with a nice looking shoutbox.
See here is the full source code for your testing
//code
<?php
// Database Settings
include "connect.php";
//connecting to databae and selecting database
mysql_connect($host, $user, $pass) OR die ("Error connecting to the server.");
mysql_select_db($db) OR die("Error selecting the database.");
$name = stripslashes($_POST['name']);
$message = stripslashes($_POST['msg']);
if(isset($_POST["submit"]))
{
// Add new entry to the database
$ip = $_SERVER['REMOTE_ADDR'];
$now = date("Y-m-d");
$query1 = "SELECT * FROM guests WHERE guestip='$ip' and date ='$now'";
$result1 = mysql_query($query1);
$cnt = mysql_num_rows($result1);
if($cnt<5)
{
$now = date("Y-m-d");
$query = "INSERT INTO guests (name, message, date, guestip) VALUES ('$name','$message','$now','$ip')";
$result = mysql_query($query) or die(mysql_error());
// go back to entry page
$referer = $_SERVER['HTTP_REFERER'];
header ("Location: $referer");
}
else
{
echo "Thank you for your comments. But you cannot submit more comments today as its a spam prevention mechanism to avoid spammers.";
echo "
If you are a spammer then just GO away.";
}
}
if (!isset($_POST["submit"]))
{
$query = "SELECT id, name, message, DATE_FORMAT(date, '%D %M, %Y') as newdate FROM guests ORDER BY id DESC LIMIT 0, 8";
$result = mysql_query($query);
?>Post a message
<?php
while ($row = mysql_fetch_object($result))
{
?>
<?php echo $row->message; ?>
Posted by <?php echo $row->name; ?> on <?php echo $row->newdate; ?>
<?php
}
?>
<?php
}
?>
Let us know whether you liked it or not. This is just a basic sample example for you.
Its not fully secure. If you know some simple function to prevent bots using this for data entry then let me know.
Langganan:
Postingan (Atom)
while ($row = mysql_fetch_object($result))
{
?>
message; ?>
Posted by name; ?> on newdate; ?>
}
?>