<?
########## Confixx(R) 3.0 Professional ############
####### Copyright SWsoft, Inc. 2004-2005 ##########
#### http://www.sw-soft.com - info@sw-soft.com ####

if(!defined('CONFIXX'))
{
	return;
}

if($save)
{
	if($new_skin_name)
	{
		$new_skin_name = str_replace("'", "\\'", $new_skin_name);
		$skin = $skin * 1;
		//echo "select count(*) from custom_skins where id = $skin and anbieter='$PHP_AUTH_USER' and owner_type='reseller'";
		$id = db_query("select count(*) as c from custom_skins where id = $skin and anbieter='$PHP_AUTH_USER' and owner_type='reseller'");
		$w = db_fetch_array($id);
		if($w["c"])
		{
			//echo "select count(*) as c from custom_skins where name = '$skinname' and owner_type='reseller' and anbieter='$PHP_AUTH_USER'";
			$id = db_query("select count(*) as c from custom_skins where name = '$new_skin_name' and owner_type='reseller' and anbieter='$PHP_AUTH_USER'");
			$wer = db_fetch_array($id);
			if(!$wer["c"])
			{
				db_query("update custom_skins set name='$new_skin_name' where id = $skin");
			}
			else
			{
				$alerts[] = ltext("sk_skin_exists");
			}	
	
		}
		else 
		{
			$alerts[] = ltext('sk_invalid_skin');	
		}
	}
	else
	{
		$alerts[] = ltext("sk_empty_skinname");
		//include $thisdir . "/skins_inc/create.php";
	
	}
}
	

if(!sizeof($alerts) && $save)
{
	include $thisdir . "/skins_inc/change.php";	
	print_footer();
	exit();
}

print_header();

?>

<table class="tblbgcolor" align="left" border="1" cellpadding="3" cellspacing="0" bordercolorlight="#CCCCCC" bordercolordark="#FFFFFF">
<tr>
    <TD> 
      <form action="skins.php" method="post">
      <input type="hidden" name="save" value="1">
      <input type="hidden" name="action" value="newname">
      <input type="hidden" name="skin" value="<? echo $skin; ?>">
              <div align="right">
                <? echo ltext("sk_new_name"); ?>
                </div>
            </td>
            <td> 
              <input type="text" name="new_skin_name" size="12" maxlength="12" style="width: 100%">
            </td>
          </tr>
          <tr > 
            <td>&nbsp; </td>
            <td>
	    
	    <table cellpadding="0" cellspacing="0" border="0">
	    <tr>
	    <td><input type=image border=0 src="<?=$strSkinName?>/pics/buttons/bt_img_left.gif"></td>
	    <td background="<?=$strSkinName?>/pics/buttons/bt_img_middle.jpg"><a href="javascript:doChange()"  class="button-1"><? echo ltext("sk_change_name"); ?></a></td>
	    <td><input type=image border=0 src="<?=$strSkinName?>/pics/buttons/bt_changepass.gif"></td>
	    </tr>
	    </table></a>
            </td>
          </tr>
        </table>
      </form>
    </TD>
  </TR>
  </TBODY> 
</TABLE>
