Basic PHP Programming

Your guide to basic PHP Programming

Archive for May, 2008

On restricting some users.

without comments

12.jpg

There are some website owners who wish to restrict the access of their webpage to certain individuals or groups. It is inconceivable since every website owner’s dream is for him or her to have more traffic. Perhaps because some spammers have infiltrated their website, or maybe they have personal reasons. Nevertheless, there is actually a way to restrict the access of a certain user/s to the website or a certain page in a website. Captcha is being used by most webmasters in preventing spammers to send and send information in their website, however, here is the trick to totally ban them from entering your site. The key? IP addresses. Yes, this number sequence means a lot. You can find the coding here for your reference.

Photo taken from http://www.css-design-yorkshire.com

Written by editor

May 29th, 2008 at 3:31 pm

Posted in Information

Email forms.

without comments

12.gif

php scripting is not a limited deal. It can create wonderful and secure pages (much more secure than HTML), and so webmasters prefer using it when it comes to online transactions. But aside from making a certain page of your website secure, php can also do lots of things. In fact, you can also make an email sender and put it on your website. You can use it and send personal or business related emails, without using the usual web-based clients people use. Limesoftware has a step by step tutorial on how you can make an email client on your website. What’s more is that you can even make a feedback form so that people can just leave you messages on your website. This can be very beneficial if you have an online business.

Photo taken from http://www.websiteuserguide.com

Written by editor

May 27th, 2008 at 2:41 pm

Posted in Information

Create a free SMS counter.

without comments

11.gif

There are a number of reasons why you would want to have a “send free SMS” corner on your website. First, you can drive people to visit your site. Talk about traffic (and I hope that’s enough reason for you to put up a free SMS corner). Second, you can actually use it and send free SMS to your friends. Third, the free SMS counter adds a “friendly” aura to your site. Farheen Rehman posted in Auroranet how people can add SMS boxes in their websites. He even laid everything in a step by step manner, starting with the definitions that most people who don’t have gateway and php scripting skills cannot understand.

Photo taken from http://auroranet.fre3.com

Written by editor

May 22nd, 2008 at 12:17 pm

Posted in Information

How to create news feeds. (part III)

without comments

1.gif

You are actually halfway through by the time you’re reading this post. If you have religiously done the previous instructions correctly, expect that you will soon have a news feed of your own. Your index.php page serves as your window, so basically, it is just like an interface. What you need to make is an HTML page full of tables (but not too many) so as just to separate the news from each other. And then you have to make use of this coding to shorten and convert lines into a string:

$list = getNewsList();
foreach ($list as $value) {
$newsData = file(“news/”.$value);
$newsTitle = $newsData[0];
$submitDate = $newsData[1];
unset ($newsData['0']);
unset ($newsData['1']);

$newsContent = “”;
foreach ($newsData as $value) {
$newsContent .= $value;
}

echo “$newsTitle
$submitDate”;
echo “”.$newsContent.

________________________________________
“;
}
?>

Photo taken from http://geology.com

Written by editor

May 13th, 2008 at 10:52 am

Posted in Information

How to create news feeds. (part II)

without comments

11.jpg

With the codes posted on the first part of the news feeds tutorial, assuming that the codes were posted to the correct forms, you should now have a storage file system where you can dump all the articles you have and you are now able to post it. But of course, what is the sense of a news display if people can’t see it? So there should be a page where your news can be flashed and displayed. To do this, the index.php page you have created will come into use. You have to use the “opendir” and “readdir” commands so that your news files will be arranged in a chronological order. You then have to put these codes:

function getNewsList(){

$fileList = array();

// Open the actual directory
if ($handle = opendir(“news”)) {
// Read all file from the actual directory
while ($file = readdir($handle)) {
if (!is_dir($file)) {
$fileList[] = $file;
}
}
}

rsort($fileList);

return $fileList;
}
?>

Photo taken from http://news.dmusic.com

Written by editor

May 8th, 2008 at 10:39 am

Posted in Information

How to create news feeds. (part I)

without comments

1.jpg

If you wish to create a news feed system using php, it is actually easier than you thought. The basic news system comprises of a php editor (for easier editing), an index.php page (where your news will be displayed) and an admin.php page (where you will post the news). You must create first a page using html so that you can make forms embedded into a page. Then you must insert this coding in the head area of the admin page:

Insert name of php editor here.init({ mode : “textareas”, theme : “advanced”,
theme_advanced_buttons3 : “”, theme_advanced_toolbar_location : “top”,
theme_advanced_toolbar_align : “left”,});

All you have to do to make sure that your coding works is to add in the processing field these codes:

$newsTitel = isset($_POST['title']) ? $_POST['title'] : ‘Untitled’;
$submitDate = date(‘Y-m-d g:i:s A’);
$newsContent = isset($_POST['newstext']) ? $_POST['newstext'] : ‘No content’;

$filename = date(‘YmdHis’);
$f = fopen(‘news/’.$filename.”.txt”,”w+”);
fwrite($f,$newsTitel.”\n”);
fwrite($f,$submitDate.”\n”);
fwrite($f,$newsContent.”\n”);
fclose($f);

header(‘Location:index.php’);
?>

Photo taken from http://blog2.protopage.com

Written by editor

May 6th, 2008 at 9:18 am

Posted in Information