<?php
####################################################################################
##                                      WARNING!                                  ##
##                                                                                ##
##             This script is copyrighted to Free Monthly Websites.               ##
##               Duplication, selling, or transferring of this script             ##
##              is a violation of the copyright and purchase agreement.           ##
##                   Please read the Terms and Conditions here:                   ##
##   https://freemonthlywebsites2.com/legal/Copyright_Terms_and_Conditions.pdf    ##
##      Any violation of these terms will be dealt with serious legal action!     ##
##                                                                                ##
####################################################################################
error_reporting(0);
ini_set('display_errors','off');
      session_start();

       if($_SESSION['logged_in']!=true)
	     {
			header("location:index.php?flag=2");
			exit;
	     }

	   $filename="settings/theme_settings.txt";
		
		if($handle = @fopen($filename, 'r')) 
		  {
			 $contents = fread($handle, filesize($filename));
             fclose($handle);
		     $argument_arr=explode("#_1_#",$contents);
			 $theme_arr=explode("#_1_#",$contents);
		  }
		  
		$new_theme = $_GET['theme'];  
		if ($new_theme)
		{
			$filename="settings/theme_settings.txt";
			
			
			if ($new_theme == "custom-theme")
				$content .= "#_1_#";
			else
				$content .= $new_theme;
			
			if(file_exists($filename))
			{
				//Do nothing;
			}
			else
			{
				copy("blank.txt",$filename);
				chmod($filename, 0750);
			}
		
		
			if(is_writable($filename))
			{
				if(!$handle = fopen($filename, 'w'))
				{
					echo "Cannot open file ($filename)";
					exit;
				}
				if(fwrite($handle, $content) === FALSE)
				{
					echo "Cannot write to file ($filename)";
					exit;
				}
				fclose($handle);
				header("location:theme_settings.php?flag=1");
				exit;
			} else
			{
				echo "The file $filename is not writable";
			}
		
		}
		  
?>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Language" content="en-gb">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Admin Control Panel</title>
<link href="css/admin_style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
#help_theme { display:none; }
-->
</style>
<script type="text/javascript">
function mm_showHide(id)
{
    a=document.getElementById(id);
    if(a.style.display != 'none' && a.style.display != 'block') a.style.display='none';
    if(a.style.display == 'block') {
        a.style.display='none';
    }
    else {
        a.style.display='block';
    }
    return false;
}
</script>
</head>
<body>
<table width="914" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF">
  <tr>
    <td height="160" colspan="3" align="center" valign="middle" class="header">
	</td>
  </tr>
  <tr>
    <td colspan="3" align="center" valign="top" class="main_mid"><table width="888" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td width="3" height="5" class="table_topl">&nbsp;</td>
        <td width="220" height="5" class="table_top">&nbsp;</td>
        <td width="5" class="table_topr">&nbsp;</td>
        <td width="1" rowspan="3">&nbsp;</td>
        <td width="3" class="table_topl">&nbsp;</td>
        <td width="645" class="table_top">&nbsp;</td>
        <td width="5" height="5" class="table_topr">&nbsp;</td>
      </tr>
      <tr>
        <td width="3" class="table_left">&nbsp;</td>
        <td width="220" align="center" valign="top"><table width="215" border="0" align="left" cellpadding="0" cellspacing="0">
          <tr>
            <td width="215" height="80" colspan="2" align="center" valign="middle" class="admin_button"><a href="../" target="_blank"><strong>View Your Website</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="welcome.php"><strong>Home</strong></a></td>
            </tr>
          <tr>
            <td height="60" colspan="2" align="center" valign="middle"><img src="images/bulletaro_dn.gif" width="13" height="9" hspace="10"><span class="style1">Standard Settings</span><img src="images/bulletaro_dn.gif" width="13" height="9" hspace="10"></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="admin_settings.php"><strong>Admin Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="personal_settings.php"><strong>Personal Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="website_settings.php"><strong>Basic Website Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="seo_settings.php"><strong>S.E.O Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="theme_settings.php"><strong>Theme Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="advert_settings.php"><strong>Advert Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="affiliate_settings.php"><strong>Affiliate Settings</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="optin_settings.php"><strong>Optin Form Settings</strong></a></td>
          </tr>
          <tr>
            <td height="60" colspan="2" align="center" valign="middle"><img src="images/bulletaro_dn.gif" width="13" height="9" hspace="10"><span class="style1">Article Settings</span><img src="images/bulletaro_dn.gif" width="13" height="9" hspace="10"></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="add_content_pages.php"><strong>Add/Remove Article Pages</strong></a></td>
          </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="edit_content_pages.php"><strong>Edit Article Pages</strong></a></td>
          </tr>
          <tr>
            <td height="60" colspan="2" align="center" valign="middle"><img src="images/bulletaro_dn.gif" width="13" height="9" hspace="10"><span class="style1">Other</span><img src="images/bulletaro_dn.gif" width="13" height="9" hspace="10"></td>
          </tr>

          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="https://freemonthlywebsites2.com/legal/Copyright_Terms_and_Conditions.pdf" target="_blank"><strong>Terms and Conditions</strong></a></td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="center" valign="middle">&nbsp;</td>
            </tr>
          <tr>
            <td height="45" colspan="2" align="center" valign="middle" class="admin_button"><a href="logout.php"><strong>Logout</strong></a></td>
          </tr>
          <tr>
            <td height="30" colspan="2" align="center" valign="middle">&nbsp;</td>
          </tr>
        </table>
        <td width="5" class="table_right">&nbsp;</td>
        <td width="3" class="table_left">&nbsp;</td>
        <td width="645" align="center" valign="top"><table width="645" border="0" align="center" cellpadding="0" cellspacing="0">

            <tr>
              <td height="50" colspan="2" align="center" valign="middle" class="title1">Website Theme Settings </td>
            </tr>
            <?php
		if($_REQUEST['flag']==1)
		  {
?>
            <tr>
              <td height="50" colspan="2" align="center" valign="middle" class="title1">&gt;&gt; <span class="style3">Theme saved successfully</span> &lt;&lt;</td>
            </tr>
            <?php
		}
?>
            
            <tr>
              <td height="50" colspan="2" align="left" valign="middle" class="main2"><br>
                      <a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank"><img src="images/logo_sm.jpg" width="80" height="80" hspace="20" border="0" align="left"></a>If you would like a <span class="style1"><a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank" class="style3"><u>Unique Custom Theme</u></a></span> creating to your own specifications and<br>
                adding
                to your control panel,
                then click <a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank"><u>here</u></a> for more details of a <strong>Very Special Discount</strong> we<br>
                have arranged for you!<br>
                <br>
                <br></td>
            </tr>
            <tr>
              <td width="300" height="50" align="right" valign="middle" class="main2">Choose a Website Theme: </td>
              <td width="345" height="50" align="left" valign="middle" class="main2"><p>

              <a href="#" onClick="mm_showHide('help_theme');return false;"><img src="images/help.gif" width="21" height="21" hspace="8" border="0" align="top"></a></p></td>
            </tr>
            <tr>
              <td colspan="2" align="center" valign="middle" class="main2"><div class="userhelp_cell" id="help_theme">
                  <p><br>
                    Choose a custom theme from the list below by simply clicking on the image of your required theme.</p>
                  <p>This will change the entire look of your website, without affecting any of your settings.</p>
                <p>This is excellent for giving your website a more 'individual' look and feel.<br>
                  Feel free to experiment with the themes, to find a great look for your website. </p>
                <p>We highly recommend you get a custom theme designed that is totally unique.</p>
                <p>We have negotiated a very special deal where you can get your own 'custom' design created for you. <br>
                  <a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank"><u>Click here</u></a> to see exactly what you get.<br>
                      <br>
                      <br>
                    </p>
                </div></td>
            </tr>
            
            <tr>
              <td colspan="2" align="center" valign="middle" class="main2">
                <table width="600" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td height="40" colspan="3" align="center" valign="middle" class="main1red"><span class="style5"><strong>Your Current Theme:</strong></span></td>
                  </tr>
                  <tr>
                    <td colspan="3" align="center" valign="middle"><img src="../themes/theme-<?php echo $theme_arr['0']; ?>/images/thumb.jpg" align="top"><br></td>
                    </tr>
                    
                    <tr>
                      <td height="40" colspan="2" align="center" valign="middle" class="main1red"><hr align="center" width="400" size="2" noshade></td>
                    </tr>
                    <tr>
                    <td height="40" align="center" valign="middle" class="main1red"><strong>
                      <?php if($theme_arr['0']=='theme1') echo "You Are Currently Using This Theme:"; ?>
                      <br>
                      <span class="title1">Theme 1</span> </strong></td>
                    <td height="40" align="center" valign="middle" class="main1red"><strong>
                      <?php if($theme_arr['0']=='theme2') echo "You Are Currently Using This Theme:"; ?>
                      <br>
                      <span class="title1">Theme 2</span> </strong></td>
                    </tr>
                  <tr>
                    <td width="300" align="center" valign="middle"><label> <a href="theme_settings.php?theme=theme1&flag=1"><img src="../themes/theme-theme1/images/thumb.jpg" border="0"></a> </label></td>
                    <td width="300" align="center" valign="middle"><label> <a href="theme_settings.php?theme=theme2&flag=1"><img src="../themes/theme-theme2/images/thumb.jpg" border="0"></a> </label></td>
                    </tr>
                    
                    <tr>
                      <td height="40" align="center" valign="middle" class="main1red"><strong>
                        <?php if($theme_arr['0']=='theme3') echo "You Are Currently Using This Theme:"; ?>
                        <br>
                        <span class="title1">Theme 3</span> </strong></td>
                      <td height="40" align="center" valign="middle" class="main1red"><strong>
                        <?php if($theme_arr['0']=='theme4') echo "You Are Currently Using This Theme:"; ?>
                        <br>
                        <span class="title1">Theme 4</span> </strong></td>
                    </tr>
                    <tr>
                      <td width="300" align="center" valign="middle"><label> <a href="theme_settings.php?theme=theme3&flag=1"><img src="../themes/theme-theme3/images/thumb.jpg" border="0"></a> </label></td>
                      <td width="300" align="center" valign="middle"><label> <a href="theme_settings.php?theme=theme4&flag=1"><img src="../themes/theme-theme4/images/thumb.jpg" border="0"></a> </label></td>
                    </tr>
                    
                    <tr>
                    <td height="40" align="center" valign="middle" class="main1red"><strong>
                      <?php if($theme_arr['0']=='theme5') echo "You Are Currently Using This Theme:"; ?>
                      <br>
                      <span class="title1">Theme 5</span> </strong></td>
                    <td height="40" align="center" valign="middle" class="main1red"><strong>
                      <?php if($theme_arr['0']=='theme6') echo "You Are Currently Using This Theme:"; ?>
                      <br>
                      <span class="title1">Theme 6</span> </strong></td>
                    </tr>
                  <tr>
                    <td width="300" align="center" valign="middle"><label> <a href="theme_settings.php?theme=theme5&flag=1"><img src="../themes/theme-theme5/images/thumb.jpg" border="0"></a> </label></td>
                    <td width="300" align="center" valign="middle"><label> <a href="theme_settings.php?theme=theme6&flag=1"><img src="../themes/theme-theme6/images/thumb.jpg" border="0"></a> </label></td>
                    </tr>
                    
                  <tr>
                    <td height="40" colspan="2" align="center" valign="middle" class="main1red"><hr align="center" width="400" size="2" noshade></td>
                    </tr>
                  <tr>
                    <td height="50" colspan="2" align="center" valign="bottom" class="main1red"><strong>
                      <?php if($theme_arr['0']=='custom') echo "You Are Currently Using This Theme:"; ?><br><span class="title1">Your Own Custom Theme</span> </strong></td>
                    </tr>
                  <tr>
                    <td colspan="2" align="center" valign="middle"><label>
					<a href="theme_settings.php?theme=custom&flag=1"><img src="images/custom-theme.gif" border="0"></a>
      <br>
                                        </label></td>
                    </tr>
					    
                  <tr>
                    <td height="60" align="center" valign="middle">&nbsp;</td>
                    <td height="60" align="center" valign="middle">&nbsp;</td>
                  </tr>
                </table>
                <label></label></td>
            </tr>
            <tr>
              <td colspan="2" align="center" valign="middle" class="main2"></td>
            </tr>
            
            
            <tr>
              <td height="50" colspan="2" align="left" valign="middle" class="main2"><br>
                  <a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank"><img src="images/logo_sm.jpg" width="80" height="80" hspace="20" border="0" align="left"></a>If you would like a <span class="style1"><a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank" class="style3"><u>Unique Custom Theme</u></a></span> creating to your own specifications and<br>
                adding
                to your control panel,
                then click <a href="https://freemonthlywebsites2.com/custom_theme.html" target="_blank"><u>here</u></a> for more details of a <strong>Very Special Discount</strong> we<br>
                have arranged for you!<br>
                <br>
                <br></td>
            </tr>
            <tr>
              <td height="50" colspan="2" align="center" valign="middle" class="main2">&nbsp;</td>
            </tr>
       
        </table></td>
        <td width="5" class="table_right">&nbsp;</td>
      </tr>
      <tr>
        <td width="3" height="6" class="table_botl">&nbsp;</td>
        <td width="220" height="6" class="table_bot">&nbsp;</td>
        <td width="5" class="table_botr">&nbsp;</td>
        <td width="3" class="table_botl">&nbsp;</td>
        <td width="645" class="table_bot">&nbsp;</td>
        <td width="5" height="6" class="table_botr">&nbsp;</td>
      </tr>
    </table></td>
  </tr> 
  <tr>
    <td height="60" colspan="3" align="center" valign="middle" class="footer">    </td>
  </tr>
  <tr class="footer_bg">
    <td width="8" height="30">&nbsp;</td>
    <td width="898" height="30"><table width="898" border="0" align="center" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" valign="middle" class="copyright">Copyright &copy; <a href="https://freemonthlywebsites2.com" target="_blank">Free Monthly Websites 2.0</a>. All Rights Reserved.</td>
      </tr>
      <tr>
        <td align="center" valign="middle" class="powered">Powered By: <a href="https://freemonthlywebsites2.com" target="_blank">Free Monthly Websites 2.0</a></td>
      </tr>
    </table></td>
    <td width="8" height="30">&nbsp;</td>
  </tr>
</table>
</body>
</html>