<?php
$tmp_path = "";
unset($tmp_path_pre);
$tmp_path_pre[0] = $tmp_path_pre[1] = "";
$tmp_value = "";
$tmp_type = "";
$row['desk'] = stripslashes($row['desk']);
if (strpos($row['desk'], 'Тип параметра: ') === false){
	$tmp_type = "unknown";
}else{
	if (strpos($row['desk'], "</p><p") < 50){
		$tmp_type = substr($row['desk'], 29, strpos($row['desk'], "</p><p") - 29);
	}else{
		$tmp_type = substr($row['desk'], 29, strpos($row['desk'], "<br />") - 29);
	}
}
if (substr($row['word2'], 0, 4) == "all\\"){
	$tmp_path_pre = array("HKCU", "HKEY_CURRENT_USER");
	$tmp_path = substr($row['word2'], 4);
}elseif (substr($row['word2'], 0, 5) == "HKCU\\"){
	$tmp_path_pre = array("HKCU", "HKEY_CURRENT_USER");
	$tmp_path = substr($row['word2'], 5);
}elseif (substr($row['word2'], 0, 5) == "HKLM\\"){
	$tmp_path_pre = array("HKLM", "HKEY_LOCAL_MACHINE");
	$tmp_path = substr($row['word2'], 5);
}elseif (substr($row['word2'], 0, 5) == "HKCR\\"){
	$tmp_path_pre = array("HKCR", "HKEY_CLASSES_ROOT");
	$tmp_path = substr($row['word2'], 5);
}

if (stripslashes($row['name']) == "(по умолчанию)"){
}else{
	$tmp_value = stripslashes($row['name']);
}
switch($tmp_type){
	case "reg_dword": $tmp_type = "REG_DWORD";break;
	case "reg_string": $tmp_type = "REG_SZ";break;
	case "reg_binary": $tmp_type = "REG_BINARY";break;
	case "reg_expand_sz": $tmp_type = "REG_EXPAND_SZ";break;
	case "reg_multi_sz": $tmp_type = "REG_SZ";break;
	case "подраздел": $tmp_type = "path";break;
	default: $tmp_type = "unknown";
}

	
?>
<div class="black_block clr_or ssm">
<?php if ($tmp_type == "path"){ $tmp_max = 6; }else{ $tmp_max = 6; } ?>
<select class="cinline" id="pr_pn" onchange="faddon(document.getElementById('pr_pn').value, <?php echo $tmp_max; ?>);">
<?php if ($tmp_type == "path"){
	echo '<option value=1>Создание (INF-файлы)</option>';
	echo '<option value=2>Удаление (INF-файлы)</option>';
	echo '<option value=3>Создание (REG-файлы)</option>';
	echo '<option value=4>Удаление (REG-файлы)</option>';
	echo '<option value=5>Создание куста (WSH)</option>';
	echo '<option value=6>Различные команды</option>';
}else{
	echo '<option value=1>Редактирование (WSH, VBscript)</option>';
	echo '<option value=2>Чтение (WSH, VBscript)</option>';
	echo '<option value=3>Удаление (WSH, VBscript)</option>';
	echo '<option value=4>Удаление (INF-файлы)</option>';
	echo '<option value=5>Удаление (REG-файлы)</option>';
	echo '<option value=6>Различные команды</option>';
}
?>
</select>
&nbsp;<?php if (file_exists("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/script.tar.gz")){echo "<a class='a_black2' href='./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/script.tar.gz'>Скачать все сценарии</a>";}else{echo "Сценарии с использованием данной записи";} ?>
</div>
<?php 
if ($tmp_type <> "path") {
	$tmp_path_my = editreg(1, $tmp_path_pre[0] . "\\" . $tmp_path . "\\" . $tmp_value, $tmp_type);
	$tmp_path_my .= readreg(2, $tmp_path_pre[0] . "\\" . $tmp_path . "\\" . $tmp_value);
	$tmp_path_my .= delreg(3, $tmp_path_pre[0] . "\\" . $tmp_path . "\\" . $tmp_value, $tmp_value);
	echo $tmp_path_my;	
	 ?>
<textarea id="reg_func_4" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
[version]
Signature="$CHICAGO$"

[DefaultInstall]
DelReg=Key_del

[Key_del]
<?php echo $tmp_path_pre[0]; ?>,"<?php echo $tmp_path; ?>", "<?php echo $tmp_value; ?>"</textarea>
<textarea id="reg_func_5" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
REGEDIT4

[<?php echo $tmp_path_pre[1]; ?>\<?php echo $tmp_path; ?>]
"<?php echo $tmp_value; ?>"=-
</textarea>
<textarea id="reg_func_6" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
Удалить: reg delete "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" <?php if ($tmp_value == ""){ echo "/ve";}else{echo '/v "' . $tmp_value . '"';} ?> /f
Прочитать: cmd /k reg query "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" <?php if ($tmp_value == ""){ echo "/ve";}else{echo '/v "' . $tmp_value . '"';} ?>

Редактировать: reg add "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" <?php if ($tmp_value == ""){ echo "/ve";}else{echo '/v "' . $tmp_value . '"';} ?> /t <?php echo $tmp_type; ?> /d [ваше_значение]
Поиск: reg query <?php echo $tmp_path_pre[0]; ?> /f <?php echo '"' . $tmp_value . '"'; ?> /t <?php echo $tmp_type; ?> /s
</textarea>
<?php }else{ ?>
<textarea id="reg_func_1" class="cwidth bl_w2 ssm" style="display:block;" rows="7">
[version]
Signature="$CHICAGO$"

[DefaultInstall]
AddReg=Key_add

[Key_add]
<?php echo $tmp_path_pre[0]; ?>, "<?php echo $tmp_path; ?>",,0x00000010,0</textarea>
<textarea id="reg_func_2" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
[version]
Signature="$CHICAGO$"

[DefaultInstall]
DelReg=Key_del

[Key_del]
<?php echo $tmp_path_pre[0]; ?>,"<?php echo $tmp_path; ?>"</textarea>
<textarea id="reg_func_3" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
REGEDIT4

[<?php echo $tmp_path_pre[1]; ?>\<?php echo $tmp_path; ?>]
</textarea>
<textarea id="reg_func_4" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
REGEDIT4

[-<?php echo $tmp_path_pre[1]; ?>\<?php echo $tmp_path; ?>]
</textarea>
<textarea id="reg_func_5" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
Set wsh1 = WScript.CreateObject("WScript.Shell")
tmp = inputbox("Введите имя создаваемого файла куста и путь к нему", "Редактирование - onestyle.com.ua", "c:\myHIVE.hiv")
if VarType(tmp) <> 0 then
wsh1.run "reg save " + chr(34) + "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" + chr(34) + " " + chr(34) + tmp + chr(34), False
end if</textarea>
<textarea id="reg_func_6" class="cwidth bl_w2 ssm" style="display:none;" rows="7">
Удалить: reg delete "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" /f
Создать: reg add "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>"
Содержимое: reg query "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>"
Поиск: reg query "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" /f "искомое_слово" /t "тип" /s
Создать куст: reg save "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" "имя_файла"
Создать REG-файл: reg export "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" "имя_файла"
Сравнить: reg compare "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" "вторая_ветвь" /s
Копировать: reg copy "<?php echo $tmp_path_pre[0]; ?>\<?php echo $tmp_path; ?>" "куда_копировать" /s /f</textarea>
<?php
}
?>