function addparent($d)
{
    $ardata = explode(";", $d);
    $nom = $ardata[8];
    $prenom = utf8_encode($ardata[9]);
    $prenom2 = utf8_encode($ardata[10]);
    $dn = reversedate($ardata[11]);
    $obs = $ardata[12];
    $obs2 = $ardata[13];
    $email = $ardata[14];
    $tel = $ardata[15];
    $fax = $ardata[16];
    $codeprenom = str_replace('-', '', $prenom);
    $codenom = str_replace('-', '', $nom);
    $clientcode = code($dn, $codenom, $codeprenom);
    print $prenom;
    $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
    $mysqli->set_charset("utf8");
    $query = "INSERT INTO `" . DB . "`.`clients` (`clientcode`, `clientstatus`," . " `clientcivilite`, `clientnom`, `clientprenom`, `clientprenom2`, `clientdatenaissance`," . " `clientemail`, `clienttelephone`,`clientfax`,`obs`)" . " VALUES ('" . $clientcode . "', '1', 'MR', '" . $nom . "', '" . $prenom . "', '" . $prenom2 . "', '" . $dn . "'," . "'" . $email . "','" . $tel . "','" . $fax . "','" . $obs . " " . $obs2 . "')";
    $mysqli->query($query);
    $lastid = $mysqli->insert_id;
    //use it to insert the details.
    $mysqli->close();
    print $query;
    return $lastid;
}
function add($d)
{
    $ardata = explode(";", $d);
    $arbp = explode(" ", $ardata[6]);
    $arprenom = explode(" ", $ardata[1]);
    $nom = $ardata[0];
    if (strpos($nom, "pse") > 0) {
        $arnom = explode(" ", $ardata[0]);
        $nom = $arnom[0];
        $nommarriage = $arnom[2];
    }
    $prenom = utf8_encode($arprenom[0]);
    $prenom2 = utf8_encode($arprenom[1]);
    $gender = $ardata[2];
    $dn = reversedate($ardata[3]);
    $lieun = $ardata[4];
    $obs = $ardata[5];
    $bp = $arbp[1];
    $cp = $ardata[7];
    $codeprenom = str_replace('-', '', $prenom);
    $codenom = str_replace('-', '', $nom);
    $clientcode = code($dn, $codenom, $codeprenom);
    if (!exist($clientcode)) {
        $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
        $mysqli->set_charset("utf8");
        $query = "INSERT INTO `" . DB . "`.`clients` (`clientcode`, `clientstatus`," . " `clientcivilite`, `clientnom`, `clientnommarital`, `clientprenom`, `clientprenom2`, `clientdatenaissance`, `clientlieunaissance`," . " `clientbp`, `clientcp`,`obs`)" . " VALUES ('" . $clientcode . "', '1', '{$gender}', '" . $nom . "', '" . $nommarriage . "', '" . $prenom . "', '" . $prenom2 . "', '" . $dn . "', '" . $lieun . "'," . "'" . $bp . "','" . $cp . "','" . $obs . "')";
        $mysqli->query($query);
        $mysqli->close();
        print $query;
    }
}
Beispiel #3
0
function send_review($date, $title, $text, $reviewer, $email, $score, $cover, $url, $url_title, $hits, $id, $asb_question, $asb_reponse)
{
    global $admin, $user, $NPDS_Prefix;
    include 'header.php';
    $date = reversedate($date);
    $title = stripslashes(FixQuotes(strip_tags($title)));
    $text = stripslashes(Fixquotes(urldecode(removeHack($text))));
    if (!$user and !$admin) {
        //anti_spambot
        if (!R_spambot($asb_question, $asb_reponse, $text)) {
            Ecr_Log('security', 'Review Anti-Spam : title=' . $title, '');
            redirect_url("index.php");
            die;
        }
    }
    echo '
   <h2>' . translate("Write a Review") . '</h2>
   <br /><p class="lead text-danger">' . translate("Thanks for submitting this review") . '';
    if ($id != 0) {
        echo " " . translate("modification") . "";
    } else {
        echo ", {$reviewer}";
    }
    echo '<br /><br />';
    if ($admin && $id == 0) {
        sql_query("INSERT INTO " . $NPDS_Prefix . "reviews VALUES (NULL, '{$date}', '{$title}', '{$text}', '{$reviewer}', '{$email}', '{$score}', '{$cover}', '{$url}', '{$url_title}', '1')");
        echo translate("It is now available in the reviews database.");
    } else {
        if ($admin && $id != 0) {
            sql_query("UPDATE " . $NPDS_Prefix . "reviews SET date='{$date}', title='{$title}', text='{$text}', reviewer='{$reviewer}', email='{$email}', score='{$score}', cover='{$cover}', url='{$url}', url_title='{$url_title}', hits='{$hits}' WHERE id='{$id}'");
            echo translate("It is now available in the reviews database.");
        } else {
            sql_query("INSERT INTO " . $NPDS_Prefix . "reviews_add VALUES (NULL, '{$date}', '{$title}', '{$text}', '{$reviewer}', '{$email}', '{$score}', '{$url}', '{$url_title}')");
            echo translate("The editors will look at your submission. It should be available soon!");
        }
    }
    echo '</p><a class="btn btn-default" role="button" href="reviews.php" title="' . translate("Back to Reviews Index") . '"><i class="fa fa-lg fa-undo"></i>
</a>';
    include "footer.php";
}
function get_all($sql_db, $sql_df)
{
    $mysqli = new mysqli(DBSERVER, DBUSER, DBPWD, DB);
    $query = "SELECT DISTINCT * " . "FROM `paiements` " . "WHERE `paiements`.`date_paiement` " . "BETWEEN '{$sql_db}' AND '{$sql_df}'";
    $output = '';
    $result = $mysqli->query($query);
    while ($row = $result->fetch_array(MYSQLI_ASSOC)) {
        $result_array[] = $row;
    }
    $mysqli->close();
    $total = 0;
    foreach ($result_array as $value) {
        switch ($value["type"]) {
            case "CANTINE":
                $numrol = get_rol($value["idfacture"], 'factures_cantine');
                $redevable = get_enfants($value["idfacture"]);
                break;
            case "AMARRAGE":
                $numrol = get_rol($value["idfacture"], 'factures_amarrage');
                $redevable = get_client($value["idfacture"], 'factures_amarrage');
                break;
            case "PLACE ET ETAL":
                $numrol = get_rol($value["idfacture"], 'factures_etal');
                $redevable = get_mandataire($value["idfacture"], 'factures_etal');
                break;
        }
        $year = substr($value["date_paiement"], 0, 4);
        if ($value["mode"] == 'anl') {
            $value["montantcfp"] = 0;
        }
        $output .= '<Row ss:Height="12.8952">';
        $output .= '<Cell><Data ss:Type="String">' . $value["idpaiement"] . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . reversedate($value["date_paiement"]) . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . htmlentities($redevable, ENT_QUOTES, "UTF-8") . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">-</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $year . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $value["type"] . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $value["payeur"] . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $value["montantcfp"] . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $value["mode"] . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $value["numero_cheque"] . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . htmlentities($value["obs"], ENT_QUOTES, "UTF-8") . '</Data></Cell>';
        $output .= '<Cell><Data ss:Type="String">' . $numrol . '</Data></Cell>';
        $output .= '</Row>';
        $total += $value["montantcfp"];
    }
    //print_r($result_array);
    return array($output, $total);
}