<?php
function REG_105_1($num, $str1, $str2){
$scr = 'Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchScopes\parad0x-'. $_GET['p'] . '-' . $_GET['u'] . ']
"DisplayName"="' . $str1 . '"
"URL"="' . $str2 . '"
"Codepage"=dword:000004e3';
$tmp_path = '<textarea id="reg_func_' . $num . '" class="cwidth bl_w2 ssm" style="display:';
if ($num == 1){$tmp_path .= "block";}else{$tmp_path .= "none";}
$tmp_path .= ';" rows="7">' . $scr . '</textarea>';
if (is_dir("./img/bd/scr/" . $_GET['p'])){}else{mkdir("./img/bd/scr/" . $_GET['p']);}
if (is_dir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'])){}else{mkdir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u']);}
if (file_exists("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/script.tar.gz")){}else{
	$fp = fopen("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/" . $num . ".reg", "w");
	fwrite($fp, $scr);
	fclose($fp);
}

return $tmp_path;
}

function REG_105_2($num, $str){
$scr = 'Public Sub ra(p, v, t)
    On Error resume next
    wsh1.RegWrite p, v, t
End Sub
Set wsh1 = WScript.CreateObject("WScript.Shell")
tmp = inputbox("Введите имя псевдонима", "Редактирование параметра - onestyle.com.ua", "")
if VarType(tmp) <> 0 then
ra "HKCU\Software\Microsoft\Internet Explorer\SearchUrl\" + tmp + "\", "' . $str . '", "REG_SZ"
ra "HKCU\Software\Microsoft\Internet Explorer\SearchUrl\" + tmp + "\ ", "+", "REG_SZ"
ra "HKCU\Software\Microsoft\Internet Explorer\SearchUrl\" + tmp + "\+", "%2B", "REG_SZ"
ra "HKCU\Software\Microsoft\Internet Explorer\SearchUrl\" + tmp + "\&", "%26", "REG_SZ"
ra "HKCU\Software\Microsoft\Internet Explorer\SearchUrl\" + tmp + "\%", "%25", "REG_SZ"
end if';
$tmp_path = '<textarea id="reg_func_' . $num . '" class="cwidth bl_w2 ssm" style="display:';
if ($num == 1){$tmp_path .= "block";}else{$tmp_path .= "none";}
$tmp_path .= ';" rows="7">
' . $scr . '</textarea>';
if (is_dir("./img/bd/scr/" . $_GET['p'])){}else{mkdir("./img/bd/scr/" . $_GET['p']);}
if (is_dir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'])){}else{mkdir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u']);}
if (file_exists("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/script.tar.gz")){}else{
	$fp = fopen("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/" . $num . ".vbs", "w");
	fwrite($fp, $scr);
	fclose($fp);
}

return $tmp_path;
}

function REG_105_3($num, $str){
$scr = 'Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\SearchUrl\\'. $_GET['u'] . ']
@="' . $str . '"
"%"="%25"
"&"="%26"
"+"="%2B"
" "="+"';
$tmp_path = '<textarea id="reg_func_' . $num . '" class="cwidth bl_w2 ssm" style="display:';
if ($num == 1){$tmp_path .= "block";}else{$tmp_path .= "none";}
$tmp_path .= ';" rows="7">' . $scr . '</textarea>';
if (is_dir("./img/bd/scr/" . $_GET['p'])){}else{mkdir("./img/bd/scr/" . $_GET['p']);}
if (is_dir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'])){}else{mkdir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u']);}
if (file_exists("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/script.tar.gz")){}else{
	$fp = fopen("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/" . $num . ".reg", "w");
	fwrite($fp, $scr);
	fclose($fp);
}

return $tmp_path;
}
?>
<div class="black_block clr_or ssm">
<?php $tmp_max = 3; ?>
<select class="cinline" id="pr_pn" onchange="faddon(document.getElementById('pr_pn').value, <?php echo $tmp_max; ?>);">
<?php
$tmp_max = 0;
$tmp_path = $tmp_value = "";
if(mysql_num_rows(mysql_query("select p_tag, word_id from tblTag_105 where p_tag=8 and word_id= " . $_GET['u']))){
	$tmp_max++;
	$tmp_value .= '<option value=' . $tmp_max . '>Добавить в поле поиска IE (REG)</option>';
	$tmp_path .= REG_105_1($tmp_max, $row['name'], $row['word2']);
	$tmp_max++;
	$tmp_value .= '<option value=' . $tmp_max . '>Создать псевдоним IE (WSH)</option>';
	$tmp_path .= REG_105_2($tmp_max, str_replace("{searchTerms}", "%s", $row['word2']));
	$tmp_max++;
	$tmp_value .= '<option value=' . $tmp_max . '>Создать псевдоним IE (REG)</option>';
	$tmp_path .= REG_105_3($tmp_max, str_replace("{searchTerms}", "%s", $row['word2']));
}elseif(mysql_num_rows(mysql_query("select p_tag, word_id from tblTag_105 where p_tag=12 and word_id= " . $_GET['u']))){
	$tmp_max++;
	$tmp_value .= '<option value=' . $tmp_max . '>Различные задачи</option>';
	$tmp_path .= '<div id="reg_func_' . $tmp_max . '" class="cwidth bl_w2 ssm" style="display:';
	if ($tmp_max == 1){$tmp_path .= "block";}else{$tmp_path .= "none";}
	$tmp_path .= ';">' . "<input size='100%;' value=\"" . $row['name'] . "\"><br />" . '</div>';
}else{
	$tmp_max++;
	$tmp_value .= '<option value=' . $tmp_max . '>Добавить в избранное</option>';
	$tmp_path .= '<div id="reg_func_' . $tmp_max . '" class="cwidth bl_w2 ssm" style="display:';
	if ($tmp_max == 1){$tmp_path .= "block";}else{$tmp_path .= "none";}
	$tmp_path .= ';">' . "<a title='Добавить данную страницу в закладки' href='javascript:addbkmark(\"" . $row['word2'] . "\", \"" . $row['name'] . "\");'>В избранное (IE, Firefox)</a><br />" . '<a title="' . $row['name'] . '" href="' . $row['word2'] . '" rel="sidebar">В избранное (Opera, Firefox)</a>' . '</div>';
}


echo $tmp_value;
?>
</select>
&nbsp;<?php if (is_dir("./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'])){echo "<a class='a_black2' href='./img/bd/scr/" . $_GET['p'] . "/" . $_GET['u'] . "/script.tar.gz'>Скачать все сценарии</a>";}else{echo "Сценарии с использованием данной записи";} ?>
</div>

<?php 
echo $tmp_path;
?>