Esempio n. 1
0
<?php

include "controller/function.php";
if (isset($_POST["go"])) {
    if ($_POST["go"] == "arrmail") {
        DB::truncate("mailer");
        $handle = fopen($_FILES['csv']['tmp_name'], "r");
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) {
            $arrInsert = array("email" => $data[0]);
            DB::insert(DB::insertSql("mailer", $arrInsert), $arrInsert);
        }
        fclose($handle);
        header("Location: " . $_SERVER['REQUEST_URI']);
    } else {
        include "classes/class.phpmailer.php";
        $mailers = DB::select("mailer");
        foreach ($mailers as $mailer) {
            $mail = new PHPMailer();
            $mail->CharSet = 'utf-8';
            $mail->From = $_POST['email'];
            // от кого
            $mail->FromName = $_POST['name'];
            // от кого
            $mail->AddAddress($mailer['email']);
            // кому - адрес, Имя
            $mail->IsHTML(true);
            // выставляем формат письма HTML
            $mail->Subject = $_POST['subject'];
            // тема письма
            if ($_FILES['file']) {
                $mail->AddAttachment($_FILES['file']['tmp_name'], $_FILES['file']['name']);
Esempio n. 2
0
File: DB.php Progetto: clancats/core
 /**
  * DB::truncate tests
  *
  * @dataProvider people_provider_bulk
  */
 public function test_truncate($people)
 {
     DB::run('delete from people');
     DB::insert('people', $people)->run();
     $this->assertTrue(DB::count('people') > 0);
     DB::truncate('people');
     $this->assertTrue(DB::count('people') === 0);
 }
Esempio n. 3
0
<?php

require_once '../config/config.php';
$database = new DB();
if (!$login->getUserActive()) {
    header("location:/index.html");
}
// <br>devolucion
// <br>devoluciondet
// <br>factura
// <br>facturadet
// <br>movimiento
// <br>Cliente - resetear saldo y total_ultimo a 0
//Truncate a single table, no output display
// $truncate = $database->truncate( array('your_table') );
//Truncate multiple tables, display number of tables truncated
$cuantos = $database->truncate(array('devolucion', 'devoluciondet', 'factura', 'facturadet', 'movimiento'));
//Fields and values to update
$update = array('total_ultimo' => '0', 'saldo' => '0');
//Add the WHERE clauses
$where_clause = array('1' => '1');
$updated = $database->update('cliente', $update, $where_clause, 1);
// $query = "UPDATE cliente set saldo=0,total_ultimo=0";
// $results = $database->get_results( $query );
$location = "Location: /index.php?data=mantenimiento&op=db&err=1&ts={$cuantos}";
header($location);
Esempio n. 4
0
 /**
  * Truncates the table, this will wipe all data and reset any auto-increment counters.
  *
  * @return  void.
  */
 public function truncate()
 {
     // Truncate the table.
     DB::truncate($this->name)->execute($this->database);
 }