Esempio n. 1
0
function removelink()
{
    global $settings;
    $id = checkid();
    $found = 0;
    $i = 0;
    $lines = file($settings['logfile']);
    foreach ($lines as $thisline) {
        if (strpos($thisline, $id . '%%') === 0) {
            unset($lines[$i]);
            $found = 1;
            break;
        }
        $i++;
    }
    if ($found != 1) {
        error('This ID doesn\'t exist!');
    }
    $content = implode('', $lines);
    $fp = @fopen($settings['logfile'], 'w') or error('Can\'t write to log file! Please Change the file permissions (CHMOD to 666 on UNIX machines!)');
    flock($fp, LOCK_EX);
    fputs($fp, $content);
    flock($fp, LOCK_UN);
    fclose($fp);
    if ($found != 1) {
        error('This ID doesn\'t exist!');
    }
    mainpage('Link with ID ' . $id . ' was successfully removed!');
}
Esempio n. 2
0
function page()
{
    $page = CurrentPageName();
    $content = mainpage();
    $html = "{$content}\n<script>\nLoadAjax('ruleform','{$page}?ruleform=yes');\n</script>\n";
    // rulesdatas()
    $cfg["JS"][] = "js/smtprules.js";
    $tpl = new template_users('{global_smtp_rules}', $html, 0, 0, 0, 0, $cfg);
    echo $tpl->web_page;
}
Esempio n. 3
0
function removelink($id)
{
    global $settings;
    $fp = fopen($settings['logfile'], "rb") or die("Can't open the log file ({$settings['logfile']}) for reading!");
    $content = fread($fp, filesize($settings['logfile']));
    fclose($fp);
    $content = trim(chop($content));
    $lines = explode($settings['newline'], $content);
    $found = 0;
    $fp = fopen($settings['logfile'], "wb") or die("Can't write to log file! Please Change the file permissions (CHMOD to 666 on UNIX machines!)");
    foreach ($lines as $thisline) {
        if (preg_match("/^({$id}\\%\\%)/", $thisline)) {
            $found = 1;
            continue;
        }
        $thisline .= $settings['newline'];
        fputs($fp, $thisline);
    }
    fclose($fp);
    if ($found != 1) {
        error("This ID doesn't exist!");
    }
    mainpage("Link with ID {$id} was successfully removed!");
}