SX2
Новичок
Дата регистрации:
27.07.2012 02:51:09
Сообщений: 15
if ($config['repa_on']=="yes" {
$repa = $member_id['repa']>=$module_config['repa'];
}else{
$repa = !$member_id['repa']>=$module_config['repa'];
}
if($member_id['news_num']>=$module_config['news']
AND
$repa
AND
$member_id['comm_num']>=$module_config['coments']
AND
$member_id['user_group']==$module_config['group_id']) {
$db->query( "UPDATE LOW_PRIORITY " . USERPREFIX . "_users SET user_group={$module_config['group_id_new']} WHERE user_id='{$member_id['user_id']}'" );
Подскажите как прописать это в моем коде !
Admin
Администратор
Дата регистрации:
27.05.2010 21:23:42
Сообщений: 3063
if (strcmp($config['repa_on'], "yes" == 0)
SX2
Новичок
Дата регистрации:
27.07.2012 02:51:09
Сообщений: 15
Михаил подскажите как прописать действие кнопок ?
<?php
if( ! defined( 'DATALIFEENGINE' ) ) { die( "Hacking attempt!" ); }
require_once ENGINE_DIR . '/classes/parse.class.php';
$parse = new ParseFilter( );
$parse->safe_mode = true;
if ($member_id['user_group'] != 1) { msg("error", $lang['addnews_denied'], $lang['db_denied']); }
function opentable() {
echo <<<HTML
<table width="100%">
<tr>
<td width="4"><img src="engine/skins/images/tl_lo.gif" width="4" height="4" border="0"></td>
<td background="engine/skins/images/tl_oo.gif"><img src="engine/skins/images/tl_oo.gif" width="1" height="4" border="0"></td>
<td width="6"><img src="engine/skins/images/tl_ro.gif" width="6" height="4" border="0"></td>
</tr>
<tr>
<td background="engine/skins/images/tl_lb.gif"><img src="engine/skins/images/tl_lb.gif" width="4" height="1" border="0"></td>
<td style="padding:5px;" bgcolor="#FFFFFF">
HTML;
}
function closetable() {
echo <<<HTML
</td>
<td background="engine/skins/images/tl_rb.gif"><img src="engine/skins/images/tl_rb.gif" width="6" height="1" border="0"></td>
</tr>
<tr>
<td><img src="engine/skins/images/tl_lu.gif" width="4" height="6" border="0"></td>
<td background="engine/skins/images/tl_ub.gif"><img src="engine/skins/images/tl_ub.gif" width="1" height="6" border="0"></td>
<td><img src="engine/skins/images/tl_ru.gif" width="6" height="6" border="0"></td>
</tr>
</table>
HTML;
}
function tableheader($value) {
echo <<<HTML
<table width="100%">
<tr>
<td bgcolor="#EFEFEF" height="29" style="padding-left:10px;"><div class="navigation">{$value}</div></td>
</tr>
</table>
HTML;
unterline();
}
function unterline() {
echo <<<HTML
<div class="unterline"></div>
HTML;
}
$size = "70%";
if(!$action OR $action == "" OR $action == "main" {
echoheader("",""
$body = "<div style=\"padding-top:5px;padding-bottom:2px;\"><table width=\"100%\"><tr>
<td width=\"4\"><img src=\"engine/skins/images/tl_lo.gif\" width=\"4\" height=\"4\" border=\"0\"></td>
<td background=\"engine/skins/images/tl_oo.gif\">
<img src=\"engine/skins/images/tl_oo.gif\" width=\"1\" height=\"4\" border=\"0\"></td>
<td width=\"6\"><img src=\"engine/skins/images/tl_ro.gif\" width=\"6\" height=\"4\" border=\"0\"></td>
</tr><tr><td background=\"engine/skins/images/tl_lb.gif\">
<img src=\"engine/skins/images/tl_lb.gif\" width=\"4\" height=\"1\" border=\"0\"></td>
<td style=\"padding:5px;\" bgcolor=\"#FFFFFF\"><table width=\"100%\"><tr>
<td bgcolor=\"#EFEFEF\" height=\"29\" style=\"padding-left:10px;\">
<div class=\"navigation\">\"TEST\"</div></td>
</tr></table><div class=\"unterline\"></div><table width=\"100%\"><tr><td>";
$body .= "<form method=\"POST\" action=\"\" name=\"additem\" id=\"additem\"\">
<table width=\"100%\">
<tr><td valign=\"middle\" width=\"{$size}\" style=\"padding-left:3%;\">
<strong>Узнать ID пользователя</strong>
</td><td valign=\"middle\" align=\"left\">
<form action=\"\" method=\"post\">
<input class=\"inputs inputs150\" name=\"username\" type=\"text\" value=\"Введите логин\" />
<input type=\"submit\" class=\"btn btn-success\" style=\"width:100px;\" name=\"submit\" value=\"Поиск\">
<input name=\"doaction\" type=\"hidden\" value=\"searchuserid\" />
</form>
</td></tr>
<tr><td height=7 colspan=2></td></tr>";
if ( $_POST['submit'] and $_POST['doaction'] == "searchuserid" ) {
$username = trim( $db->safesql( htmlspecialchars( $parse->process( $_POST['username'] ) ) ) );
$check = $db->super_query( "SELECT COUNT(*) as count FROM " . USERPREFIX . "_users WHERE name = '$username'" );
if( $check['count'] ) {
$row = $db->super_query( "SELECT user_id FROM " . USERPREFIX . "_users WHERE name = '{$username}'" );
$body .= "<tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=2></td></tr>
<tr><td height=7 colspan=2></td></tr>
<tr><td valign=\"middle\" width=\"{$size}\" style=\"padding-left:3%;\">
<strong>ID пользователя {$username}: {$row['user_id']}</strong><br />
</td></tr>
<tr><td height=7 colspan=2></td></tr>";
} else {
$body .= "<tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=2></td></tr>
<tr><td height=7 colspan=2></td></tr>
<tr><td valign=\"middle\" width=\"{$size}\" style=\"padding-left:3%;\">
<strong>Вы неверно ввели логин пользователя!</strong><br />
</td></tr>
<tr><td height=7 colspan=2></td></tr>";
}
}
$body .= "<tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=2></td></tr>
<tr><td height=7 colspan=2></td></tr>
<tr><td width=\"{$size}\" style=\"padding-left:3%;\">
<strong>Включить модуль?</strong><br />
Позволяет глобально включить или отключить работу модуля
</td><td align=\"left\"><select name=\"module_on\">
<option value=\"yes\"> Да </option>
<option value=\"no\"> Нет </option>
</select>{$checked['text']['module_on']}
</td></tr>
<tr><td height=7 colspan=2></td></tr>
<tr><td background=\"engine/skins/images/mline.gif\" height=1 colspan=2></td></tr>
<tr><td height=7 colspan=2></td></tr>
<tr><td colspan=\"2\"><div class=\"hr_line\"></div></td></tr>
<tr><td width=\"140\" style=\"padding-left:5px;\">
</td><td style=\"padding-left:5px;\">
</td></tr></table>
<input type=\"hidden\" name=\"action\" value=\"1\">
<div style=\"padding-left:5px; text-align:center;\">
<input class=\"btn btn-success\" type=\"submit\" value=\" Сохранить \"> <br /><br /></div>
</div></div></td></form>";
$body .="</td></tr></table></td><td background=\"engine/skins/images/tl_rb.gif\">
<img src=\"engine/skins/images/tl_rb.gif\" width=\"6\" height=\"1\" border=\"0\"></td></tr><tr>
<td><img src=\"engine/skins/images/tl_lu.gif\" width=\"4\" height=\"6\" border=\"0\">
</td><td background=\"engine/skins/images/tl_ub.gif\">
<img src=\"engine/skins/images/tl_ub.gif\" width=\"1\" height=\"6\" border=\"0\"></td><td>
<img src=\"engine/skins/images/tl_ru.gif\" width=\"6\" height=\"6\" border=\"0\"></td></tr></table></div>";
echo $body;
echofooter();
}
//************************************************************************//
// Запись настроек модуля //
//************************************************************************//
if($action == "1"{
clear_cache();
///////////////////////////////
$keys_num = count($_POST);
$keys = array_keys($_POST);
$config = "<?php \n\n//Pm configurations options\n\n\$pm_config = array(\n\n'version' => \"v.3.0\",\n\n";
for($i = 0; $i <= $keys_num; $i ++){
$key = $keys[$i];
$key_result = ($_POST[$key]);
if ($keys[$i]==id){
$config .= "'".$keys[$i]."' => array(".$key_result.",\n\n";
} elseif ($key!='action' and $key!=''){
if ($keys[$i]==id) continue;
$config .= "'".$keys[$i]."' => \"".$key_result."\",\n\n";
}}
$config .= "\n?>";
$conf_file = ROOT_DIR.'/engine/data/test_config.php';
$fp = fopen($conf_file, "w+"
$save = fwrite($fp, $config);
fclose($fp);
if ($save){
msg( "Info!", "Модуль \"test\"", "<font color=\"#009900\"><b>Настройки успешно сохранены!</b></font><br /><br /><a href=\"$PHP_SELF?mod=test\">Вернуться на главную страницу модуля</a> или <a href=\"$PHP_SELF?mod=test\">Вернутся назад</a>"
}else{
msg("error", 'Настройки не сохранены', "(найдены ошибки!!!)", "$PHP_SELF?mod=test&action=options"
}
echofooter();
closetable();
}
?>
Получается когда использую форму поиска при нажатии на кнопку происходит сохранение так как и при нажатии на кнопку сохранить как бы конфликт
submit