Title: Archive.php malicious hack
Last modified: August 21, 2016

---

# Archive.php malicious hack

 *  [mirko_okrim](https://wordpress.org/support/users/mirko_okrim/)
 * (@mirko_okrim)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/archivephp-malicious-hack/)
 * Hi!
 * I think a I do have a serious problem with my archive.php file.
 * The common code that follows:
 *     ```
       <?php get_header() ?>
       	<div id="contentwrap">
       		<?php if(have_posts()): ?>
       		<?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
       		<?php /* If this is a category archive */ if (is_category()) { ?>
       		<h2 class="pagetitle">Archive for the '<?php single_cat_title(); ?>' Category</h2>
       		<?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
       		<h2 class="pagetitle">Posts Tagged With '<?php single_tag_title(); ?>'</h2>
       		<?php /* If this is a daily archive */ } elseif (is_day()) { ?>
       		<h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
       		<?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
       		<h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
       		<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
       		<h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
       		<?php /* If this is an author archive */ } elseif (is_author()) { ?>
       		<h2 class="pagetitle">Author Archive</h2>
       		<?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
       		<h2 class="pagetitle">Blog Archives</h2>
       		<?php } ?>
       		<?php while (have_posts()) : the_post();
               $c++; // increment the counter
                if( $c % 2 != 0) {
             	   $extra_class = 'leftpost';
                  } else {
                  $extra_class = 'rightpost';
                  }
               ?>
       			<div <?php post_class($extra_class) ?> id="post-<?php the_ID(); ?>">
                        <span class="time"><?php the_time('F d, Y'); ?></span>
       				<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
   
       				<div class="entry">
                       <?php if ( function_exists( 'get_the_image' ) ) {
                   get_the_image( array( 'custom_key' => array( 'post_thumbnail' ), 'default_size' => 'full', 'image_class' => 'aligncenter', 'width' => '319', 'height' => '150' ) ); }
                   ?>
       					<?php the_content(''); ?>
       				</div>
   
                       <div class="meta">
                        <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »', 'comm'); ?>
                        <a class="more-link" href="<?php the_permalink() ?>#more">Continue Reading</a>
                       </div>
       			</div>
   
                 <?php if(++$counter % 2 == 0) : ?>
                 <div class="clearp"></div>
                 <?php endif; ?>
   
       		<?php endwhile; ?>
   
               <?php
                   include('includes/wp-pagenavi.php');
                   if(function_exists('wp_pagenavi')) { wp_pagenavi(); }
               ?>
   
       	<?php endif; ?>
       </div>
       <?php get_sidebar(); ?>
       <?php get_footer(); ?>
       ```
   
 * is basically turned into this:
 * _[Code moderated. Please do not post hack code blocks in the forums. Please use
   the [pastebin](http://wordpress.pastebin.com/)]_
 * Would you be so kind to help me?

Viewing 1 replies (of 1 total)

 *  [esmi](https://wordpress.org/support/users/esmi/)
 * (@esmi)
 * [12 years, 4 months ago](https://wordpress.org/support/topic/archivephp-malicious-hack/#post-4580342)
 * You need to start working your way through these resources:
    [http://codex.wordpress.org/FAQ_My_site_was_hacked](http://codex.wordpress.org/FAQ_My_site_was_hacked)
   [http://wordpress.org/support/topic/268083#post-1065779](http://wordpress.org/support/topic/268083#post-1065779)
   [http://smackdown.blogsblogsblogs.com/2008/06/24/how-to-completely-clean-your-hacked-wordpress-installation/](http://smackdown.blogsblogsblogs.com/2008/06/24/how-to-completely-clean-your-hacked-wordpress-installation/)
   [http://ottopress.com/2009/hacked-wordpress-backdoors/](http://ottopress.com/2009/hacked-wordpress-backdoors/)
 * Anything less will probably result in the hacker walking straight back into your
   site again.
 * Additional Resources:
    [Hardening WordPress](http://codex.wordpress.org/Hardening_WordPress)
   [http://sitecheck.sucuri.net/scanner/](http://sitecheck.sucuri.net/scanner/) 
   [http://www.unmaskparasites.com/](http://www.unmaskparasites.com/) [http://blog.sucuri.net/](http://blog.sucuri.net/)

Viewing 1 replies (of 1 total)

The topic ‘Archive.php malicious hack’ is closed to new replies.

## Tags

 * [archive.php](https://wordpress.org/support/topic-tag/archive-php/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [esmi](https://wordpress.org/support/users/esmi/)
 * Last activity: [12 years, 4 months ago](https://wordpress.org/support/topic/archivephp-malicious-hack/#post-4580342)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
