0
Posted on Friday, May 15, 2009 by chaitanya.gk and filed under


I've taken the basic idea from w3schools on how to upload files in php. I will show you now how to modify the code a bit and upload MS-word documents.

Create a php page which contains both upload form (html) and actual php code to load the file. You can have them both separately aswell.

upload.php

<?php

if(isset($_POST['submit']))
{

if ((($_FILES["file"]["type"] == "application/msword")))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "<p>Specifications document uploaded succesfully <br />";

if (file_exists("uploads/" . $_FILES["file"]["name"]))
{
echo $_FILES["file"]["name"] . " already exists. ";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"uploads/" . $_FILES["file"]["name"]);
echo "Stored in: " . "uploads/" . $_FILES["file"]["name"];

echo" <input type='button' value='Back to Previous Page'
onClick='javascript: history.go(-1)'> ";

}
}
}
else
{
echo "Invalid file";
}

}

else {

echo"
<form action='' method='post' enctype='multipart/form-data'>

<p><label for='file'>Filename:</label>
<input type='file' name='file' id='file' />
</p>
<p>
<input type='submit' style='margin-left:110px;' name='submit' value='Submit' />
</p>
</form>";

} ?>

Do not forget to put enctype="multipart/form-data" in the form tags. Here we are uploading word document which is of type msword so this ((($_FILES["file"]["type"] == "application/msword"))) tag specifies that, the file we are going to upload ins word type. This be changed to image type also to upload image files.

As shown in the code files goto uploads directory of your project directory. So uploads directory should be created where you have this code or you will get an error.

Thats it!! once everything is done you should be able to upload the word file.
5
Posted on Thursday, December 25, 2008 by chaitanya.gk and filed under


PHP/Mysql still prevails to be one of the best technologies for the web development and other web-related projects, mainly because it is an open-source so obviously cost effective and web development using php is so simple, thanks to cake-php. Back to the topic, if you are planning to start a website or blog or a forum and you wanted to start it with 0% investment. Then here is the best solution for you. 0Fees is offering a very good Free webhosting solution for starters with PHP and Mysql support. It provides us with 300MB diskspace and 10G bandwidth, which I think should be more than enough.

Here are some of the important features:
  • 300 MB disk space
  • 10 GB Monthly transfer
  • PHP with MySQL databases
  • 5 Add-on domains
  • 5 Sub domains
All you need to do is just register for free from here. You will also get a free domain with .co.cc extension, otherwise it would be yoursite.0fees.net. Once registered you will be provided with a pdf document which has all your login details (username, passoword, mysqlhost name etc..), not to worry much as you get these details in ur mail aswell.

How to install a script using an automatic script installer( Fantastico type installer)

Lets see how to install a script say wordpress( a famous blogging software). I will show you step by step procedure to install this blogging software. It is very essential if you are a blogging freak like me.

Step1: Login to 0fees from here with the username and password provided to you.

Step2: Now click on the Fantastico type installer which will be on the opening page(show in the image).

Step3: Choose your domain for installation and proceed.

Step4: Now choose the script which you wanna install, in our case it is WordPress 2.7 and click on Click to Install url.

Step5: Here we have to specify the destination, where we want to install our script. Default is root i.e our blog will open directly form www.sitename.0fees.net(leave with / to install to the root). If you are giving some name there for eg: /blog, then your blog will be opened from www.sitename.0fees.net/blog. It all depends on how you choose your destination.

Step6: It is almost done, we have installed the script in our server /. Now we have to setup our blog. For that open your site url in the browser. You will get to see the page requesting to create a configuration file for our blog. (See in the image) Click on Create a Configration File.







Step7: You will need to know
  1. Database name
  2. Database username
  3. Database password
  4. Database host
  5. Table prefix (if you want to run more than one WordPress in a single database).
You will be having all the above things in your mail or the pdf document which is provided to you at the start.

For Database name I would suggest you to create a database with some name. If you don't know how to create then here are the quick steps, From home page click on Databases -> mysql database -> Give database name and Create database. I will be something like this fees0_2527122_blog [username_databasename]. Now back to the configuration, as we have everything else Let's Go!.

Step8: Fill all the fields. Remember Database Hostname is not localhost it is Mysql Host name. You can find all this information in the left bar of main page. Leave the last field as it is.











Step9: If all the fields are given appropriately it will let us to proceed further.

Step10: Give your blogtitle and email. That's it!! Our installation is completed it will provide us with the user-name and password, these are the login details of your blog.

Here is an example of my blog. http://gkc123.0fees.net/ . The best part is, you can do tons of things for FREE!!.

I hope you like the tutorial.
0
Posted on Tuesday, December 16, 2008 by chaitanya.gk and filed under


While I was browsing for some programming books. I found this ftp link which has huge list of e-books on various subjects in computers. I found it very useful, so thought I should share this link to my viewers.

Here is the link:
ftp://202.96.64.144/pub/books/
0
Posted on Wednesday, December 03, 2008 by chaitanya.gk and filed under ,


You all might be wondering, how to recover a file when it is permanently deleted (shift + del) from the system. Lemme put it this way, if you clear the files from the Recycle bin in windows, then here is the tip to restore your files.

Fact: When a file is deleted from your computer, its contents aren’t immediately destroyed. Its hard drive space is made available for use, but until that space is overwritten, your old data is usually intact. Restoration by Brian Kato recovers such files on either FAT or NTFS partitions. Only 406 KB (or 200 KB for XP or 2K), it fits easily on a floppy, or runs from your hard drive. Generally, the sooner you try to restore a file, the more successful you’ll be.

Step by Step procedure to restore:
  • Download the Restoration file from here and extract it.
  • After extracting go to the location where the files got extracted and locate a folder which is something like this REST2514.
  • There double click on the Restoration MFC Application and choose the drive from where the files are been deleted. Now click on Search Deleted Files button (look at the image for more details).
  • Now choose your files and restore them.
Hope you find this tutorial helpful, do comment if you need any help.
1
Posted on Friday, November 21, 2008 by chaitanya.gk and filed under


Computers are always prone to virus attacks through many ways like when we insert USB which is virus infected or by clicking anonymous pop-ups/links..the list goes on. And there are many anti-virus software's available in the market to prevent these virus attacks, I would like to share some of my views on how to prevent virus attacks and important tips that one must remember on how to tackle virus infected systems.

How to prevent attacks?

Always remember prevention is better than cure. Following are the points to remember:
  1. Install a complete/stable version of Antivirus software, I would suggest Norton Internet Security. Remember to do atleast weekly maintance of your antivirus by updating the signatures and scanning your system.
  2. Never click on any pop-ups/ads and any links that are sent to you by anonymous people.
  3. Most Importantly never click on the spam mails..don't get excited when you see mails like
    "YOU HAVE GOT 100000$ claim it" lol..nobody will give you money for free, instead you will get virus for free. So add them to your spam list of your email to prevent it completely.
  4. If you are using Windows Operating system, keep the default Firewall always ON or install 3'rd party firewall to prevent intrusions.
  5. Don't try to download/install keygens/cracks. Most of the anti virus software's quarantine them whenever they are caught.
  6. Last but not least never forget to scan the USB or any external device when connected to your system, the hidden viruses of USB like amvo.exe etc hide in the background and attack your system when opened/double clicked.

How to remove them?
  1. Always backup your important files into DVD's or External HDD's. As long as you don't have any important data in your system..you are safe and can wage a direct attack on viruses :p.
  2. Download autoruns, procexp and other very important tools from sysinternals and keep track of your startup programs and processes that are running. If you find anything suspicious immediately kill that process and remove autorun of that process(shown in the image).
  3. Now disable windows restore and scan the system completely. If you don't find anything then try to find them by some simple windows commands, ill discuss them in the following sections.

Important Windows Commands/Tools
  • To see hidden files goto command prompt and
attrib -a
If you find anything interesting delete it.
  • Download this Kill-amvo.exe a powerfull small program written in VB to kill USB viruses like amvo.exe.
  • As I mentioned earlier download some very essential tools to keep track of the processes from sysinternals.com
Follow these simple yet powerful steps to keep viruses at bay.