Spam Text Inserted in my WordPress website

Found the spam code

fetch as google in webmaster tools

I had a problem with a Spam code inserted on my website, when i check the code i didn’t find anything but i see it when i use google crawl index ( from my Google webmaster )

How to solve that

You  have first to change the password of the FTP access and the admin access for WordPress, that is so important , then scan your PC with a good antivirus ( if you are using windows ) .

After that you have to check your plugin ( in my case that was the problem ), i installed many plugins that got that spammy code in it, so i removed them .

To check that there is no problem with your text of the website, you can check your website with google crawl index ( image on left )

and then after submitting the website, you will find a link for a success , press on it you will redirected to the indexed page

This is very useful to see your website as google see it .

Final thought

I have to explain the spam text inserted in my website, the spam text was like the following message and i removed it by removing the plugin infected ( this is the case happened with me ) , if that could help any one somehow.

spammy code for casino website

Adding a SMTP mailer to your form

May be you had a situation that you wanted to send a mail from your form using SMTP not the regular mail() function, in my case i had to use smtp to send mails as my emails delay getting mail from the regular mail() function and sometimes the mail doesn’t reach the receipt

I used PHPMailer to do that, it’s easy to setup and solve this problem .

Firstly you have to upload the folder to your host and create a file with any name ( in my case called mail.php ) and insert the following code in it .

you have to include the path to PHPMailerAutoload.php path in the script

require 'path/to/PHPMailerAutoload.php';
$mail = new PHPMailer;

$mail->isSMTP(); // Set mailer to use SMTP
 $mail->Host = 'hostname'; // Specify main and backup server
 $mail->Port = 465; // your port
 $mail->SMTPAuth = true; // Enable SMTP authentication
 $mail->Username = ''; // SMTP username
 $mail->Password = 'password here'; // SMTP password
 $mail->SMTPSecure = 'ssl'; // Enable encryption, 'ssl' also accepted

$mail->From = '';
 $mail->FromName = 'Name';
 $mail->addAddress('', ''); // Add a recipient
 //$mail->addAddress(''); // Name is optional
 $mail->addReplyTo('', 'Information'); // reply to

$mail->WordWrap = 50; // Set word wrap to 50 characters
 //$mail->addAttachment('/var/tmp/file.tar.gz'); // Add attachments
 //$mail->addAttachment('/tmp/image.jpg', 'new.jpg'); // Optional name
 $mail->isHTML(true); // Set email format to HTML

$mail->Subject = 'Subject';
 $mail->Body = "Body content here";
 $mail->AltBody = 'This is the body in plain text for non-HTML mail clients';

if(!$mail->send()) {
 echo 'Message could not be sent.';
 echo 'Mailer Error: ' . $mail->ErrorInfo;

echo 'Message has been sent';


Make the redirects from http:// to www

When you try to add a new account to webmaster tool, you may face a problem that Google treat a non www link different than (www) .

so you have to do one of the following :

  1. Add the both links ( that is not a good idea for doing that )
  2. Add a code to redirect to ( http://) to (http://www) , and we can do that in .htaccess 

# Redirect www to non-ww
#RewriteCond %{HTTP_HOST} ^www\.(.*) [NC]
#RewriteRule ^(.*)$ <a href="http://%251/$1">http://%1/$1</a> [R=301,L]
<span style="line-height: 1.5em;"><ifmodule mod_rewrite.c></span>
RewriteEngine On
# Redirect non-www to www
RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule ^(.*)$ <a href="http://www.%25%7bHTTP_HOST%7d/$1">http://www.%{HTTP_HOST}/$1</a> [R=301,L]

Background Image across browsers ?

you may look for the following link :

Updated : 

I tried the jquery plugin and it worked fine with all browsers


Table based design in HTML

If you have table based design that needed to be edited to be div based, you have to change remove all the table, tr, td from the page
to do that and the fatest way for that you have to use regualar expressions

I used notepad++ ( find and replace ) :

to remove all the tables divs (<table[^>]*>) and replace with (nothing) and do that with the ( tr ) and ( td ) , also you have to change the styling for the html again .

to know more about regular expressions in notepad++ , refer to the following links :