22 September 2010

How to send emails from localhost using php

Today through this article, I will describe How to send email using PHP from localhost

Most common function that you might be aware of is mail(), but it doesn't work on localhost, but using PHPMAILER you can send email from localhost even provided you have xampp or any other server installed on your machine

First of all, we will create a very simple form that includes a simple email and message field, you can use following code

<form method="post" action="sendmail.php">
  Email: <input name="email" id="email" type="text" /><br />
  Message:<br />
  <textarea name="message" id="message" rows="15" cols="40"></textarea><br />
  <input type="submit" value="Submit" />
</form>


19 September 2010

Virus Attack!!!!!!

Few weeks ago,One of my friend named Deepika , Pc was infected with virus and she found very difficult to remove it ,so after lot of efforts she was successful.
I asked her to write the whole story about this incident with the hope that other may learn from this

So here the the whole story goes

Deepika "From last 6 months I was using windows 7. It was all going on a smooth track until one day virus attacked my system.
The first time I realized that my sys was infected was when I saw shortcuts of the folders in my pen-drive. These were the shortcuts of the folders copied by me in my pen drive. And the folder became hidden folders as operating system files or folders.
Then after a while whenever I tried to access the dialog boxes; like the one asking the user for the destination to save the word document, etc; it appeared for a short while say just one sec and then suddenly it disappeared. It happened for almost all the dialog boxes even the one which I used in my java project. I was really frustrated with that.
So I decided to scan my system and my pen drive using the antivirus installed on my system (avg). But to the limit even the avg startup dialog box and other dialog boxes behaved in the similar way.
Then I tried opening some of the windows important tools like task manager, registry editor, command prompt but the same response as by the dialog boxes. After some time, I started receiving the message that my task manager and registry editor have been disabled by the administrator ; though I was logged in as administrator only and there was no other account on my system else for the administrator one.
Then I tried for online scan. But that bad virus attacked my browsers also. Whenever I did anything that is not related to virus or antivirus (like Facebook etc.), it worked fine. But as soon as I tried opening a site related to virus (like I typed “antivirus” in Google or similar) it closed my browser window.
Next I tried to uninstall avg and install some other antivirus but was not able to uninstall avg. I clicked on uninstall button but the operating system gave me no response. So on your advice, Manish, I restarted my system in safe mode, uninstalled avg, installed the latest version of avg and started scanning the whole system. It took almost 5-6 hours to scan the system. At the end of scan, avg didn’t display any message except the scan was completed successfully. No message about safe scanning or malicious items detected was displayed. This was the limit. I mean 5-6 hours looking at your system and hoping to see the silver line, but you even couldn’t see the cloud.
Then I removed my HDD and inserted into my brother’s system and started scanning it. I scanned it using avg, malware bytes and then finally repaired with tune up utilities. It again took 6-7 hours for the complete system scan. Avg then detected 1500 virus, malware detected 1569 problems in registry and some malicious items and the similar result was for tune up utilities. Huh it was all done.
I reinserted my HDD in my CPU and started my windows. It was ok. Virus has corrupted most of the applications like the browsers (Mozilla, opera), antivirus (avg) and others. Windows was having startup problem which it automatically fixed while starting up. So I uninstalled all the corrupted applications and reinstalled them. Along with this I also installed the latest version of avg, malware byte on my windows. One fact is that if you install two antiviruses on your system, your system will become slow. This is so because both the antiviruses are running in the background simultaneously. But installing avg and malware byte together will not make system slow. Reason being that the malware does not run in the background as an ever running process. Instead you explicitly need to run malware scan. So better install both.
And now my system is running fine with God’s Grace. I neither had to delete all partitions and repartition my HDD and nor had I lost my data and song which were my biggest fear in the whole incident.
Thank You God and then thanks to my bro and you."

credit:-Deepika Bansal ,cse

Thank you very much for your contribution

10 September 2010

how to create a blinking text in Internet explorer

you must have seen blinking text in some website normally we use <blink> tag for this purpose
but it does not work in internet explorer

For this we have to write a simple java script which is as follow
<html>
<head>
<script type="text/javascript">
function doBlink()
{
var blink = document.all.tags("blink")
var length=blink.length;
for (var i=0;i<length;i++)
blink[i].style.visibility = blink[i].style.visibility == "" ? "hidden":""
}
function startBlink()
{
if (document.all)
setInterval("doBlink()",500)
}
window.onload = startBlink;
</script>

</head>
<body>
<blink>Blink</blink></body>
<html>

TRY this .It will work :)

08 September 2010

How to create a array of buttons in java

Few days ago one of my friend named Mohit from Bihar faced a problem in java, in which he wants to create a array of button and change its size
So here is the code for creating a array of buttons in java

import java.applet.*;
import java.awt.*;
import javax.swing.*;
<applet CODE="kk.java" HEIGHT=300 WIDTH=400 > < /APPLET >
public class kk extends JApplet
{
JButton b[]=new JButton[20];
public void init ()
{
for(int i=0;i<20;i++)
{
setLayout(new FlowLayout());
b[i]=new JButton("click");
add(b[i]);
}
}
public void paint(Graphics g)
{
for(int j=0;j<20;j++)
{
b[j].setSize(4,90);
}
}
}




If you face any difficulty in understanding this code then post your query here