예제 #1
0
<?php

include "../../url/url.php";
$query = "SELECT * FROM " . $module_name;
$Q->query($DB, $query);
$count = $Q->numrows();
$r = getmaxid("id", $module_name);
$r--;
$fnew = split("\n", $fnew);
if (trim($fnew[0]) != "") {
    for ($i = count($fnew) - 1; $i >= 0; $i--) {
        $name = $fnew[$i];
        $name = trim(ereg_replace("\"", "&quot;", $name));
        $r++;
        $ddate = date("Y-m-d H:i:s", time() - $i);
        $query = "INSERT INTO " . $module_name . " VALUES({$r},{$parent},'','" . $fields[17] . "','{$adminlanguage}','{$ddate}','{$name}','','','','','','','','','','','','','','','','','', '', '')";
        //		echo $query."<br>";
        if ($name != "") {
            $Q->query($DB, $query);
        }
    }
}
//get_htaccess();
echo "<script language=JavaScript>top.mainleft.location.reload(true);</script>";
include "_view.php";
예제 #2
0
function showRegistrationForm($id, $aname, $rid, $letter_template, $error_message, $successful_message, $email_error_message)
{
    global $module_filepath, $auth, $DB, $Q, $REQUEST_URI, $module_name, $pt_l, $pt_action, $AllowToSend, $AllowToSendText, $HTTP_HOST;
    $filename = $module_filepath . "/_t/_items/" . $letter_template . ".tpl";
    if (file_exists($filename)) {
        $f = file($filename);
        $letter_template = join("", $f);
    } else {
        return "File " . $letter_template . ".tpl not found.";
    }
    $query = "select * from " . $module_name . " where id=" . $id;
    $Q->query($DB, $query);
    $info = $Q->getrow();
    $text = prepare_text($info);
    $lang = $info[lang];
    if ($AllowToSend) {
        //        echo $AllowToSendText;
        $email = strip_tags($AllowToSendText);
        $email = ereg_replace("mail", "", $email);
        $email = trim(ereg_replace("^[^]+", "", $email));
        $email = trim(ereg_replace("^[^a-zA-Z0-9]+", "", $email));
        $email = ereg_replace("(^[a-zA-Z0-9\\-\\.@_]+)[^a-zA-Z0-9\\-\\.@_]+.*", "\\1", $email);
        //	echo $email;
        if (!is_email($email)) {
            return "<font color=#FF0000>" . $email_error_message . "</font>";
        }
        $query = "select * from " . $module_name . " where rid=" . $rid . " and name='" . $email . "'";
        $Q->query($DB, $query);
        $count = $Q->numrows();
        //echo $query;
        if ($count) {
            $text = "<font color=#FF0000>" . $error_message . "</font>";
        } else {
            $r = getmaxid("id", $module_name);
            $ddate = convdate(date("d-m-Y H:i:s", time()));
            $password = substr(strtoupper(md5(rand())), 1, 5);
            $query = "INSERT INTO " . $module_name . " VALUES({$r}," . $rid . ",'','" . $aname . "','" . $lang . "','" . $ddate . "','" . $email . "','" . $password . "','" . $AllowToSendText . "','','','','','','','','','','','')";
            $Q->query($DB, $query);
            //		echo $query;
            $text = $successful_message;
            $sitename = ereg_replace("www\\.", "", $HTTP_HOST);
            $letter_template = ereg_replace("\\[name\\]", $email, $letter_template);
            $letter_template = ereg_replace("\\[anons\\]", $password, $letter_template);
            //		echo $letter_template;
            mail($email, $sitename, "Content-Type:text/html;\nContent-Transfer-Encoding: 8bit\n\n" . $letter_template . "\n\n", "Content-Type:multipart/mixed; charset=Windows-1251;");
        }
    }
    return $text;
}