public function __construct() { $ini = new ini_file(); $ini->setFileName('./include/config/account.ini'); $ini->load(); //$ini->printini(); echo'<br />'; $this->_login = $ini->getElementValue('user', 'login'); $this->_passwort = $ini->getElementValue('user', 'pass'); }
public function __construct() { $config_db = new ini_file(); $config_db->setFileName(CONFIG); $file = $config_db->loadFile(); $this->_db = $file['config_db']['default_db']; $this->_dir = $file['config_db']['localhost']; $this->_login = $file['config_db']['login']; $this->_pass = $file['config_db']['passwort']; $this->charset = $file['config_db']['charset']; //konfiguracja $baza = @mysql_connect($this->_dir, $this->_login, $this->_pass); if ($baza === false) { die('Nie można było nawiązac połączenia' . ' z powodu blendu:' . mysql_error()); } mysql_query('SET NAMES "' . $this->_charset . '"'); $ok = @mysql_select_db($this->_db); if ($ok === false) { die('Nie można było nawiązac połączenia' . ' z powodu blendu:' . mysql_error()); } }
public function __construct() { $dbcfg = new ini_file(); $dbcfg->setFileName(CONFIG); $dbcfg->load(); $server = $dbcfg->getElementValue('db-config', 'server'); $login = $dbcfg->getElementValue('db-config', 'login'); $passwort = $dbcfg->getElementValue('db-config', 'paswort'); $default_db = $dbcfg->getElementValue('db-config', 'db_name'); //połączenie z bazą $this->mysqli = new mysqli($server, $login, $passwort, $default_db); if (mysqli_connect_errno()) { echo "Nie udało się nawiązać połączenia z bazą danych, komunikat:" . mysqli_connect_error(); exit; } $this->mysqli->set_charset("utf8"); }
unset($lng_edit[$name_module][$key]); } } if (!count($lng_edit[$name_module])) { unset($lng_edit[$name_module]); } ini_file::save_file($language, $lng_edit); header('Location: index.php?act=languages&mod=phrases&language=' . $language . '&module=' . $name_module . '&symbol=' . $symbol . '&start=' . $start . '&do=massdel'); exit; } else { if (!$_POST['delch']) { header('Location: index.php?act=languages&mod=phrases&language=' . $language . '&module=' . $name_module . '&symbol=' . $symbol . '&start=' . $start); exit; } foreach ($_POST['delch'] as $key) { $mass_dell[] = ini_file::key_filter($key); } $_SESSION['mass_dell'] = $mass_dell; echo '<div class="phdr"><b>' . $lng_list[$language] . '</b>: <a href="index.php?act=languages&mod=phrases&language=' . $language . '&module=' . $name_module . '&symbol=' . $symbol . '"><b>' . $panel_lng['phrases'] . '</b></a> | ' . $panel_lng['reset'] . '</div>' . '<div class="rmenu"><p>' . $panel_lng['phrase_resets'] . '</p>' . '<p><form name="form" action="?act=languages&mod=massdel_phrase&language=' . $language . '&module=' . $name_module . '&symbol=' . $symbol . '&start=' . $start . '&yes" method="POST">' . '<input type="submit" name="submit" value="' . $lng['continue'] . '"/> ' . '</form></p>' . '</div>' . '<div class="phdr"><a href="?act=languages&mod=phrases&language=' . $language . '&module=' . $name_module . '&start=' . $start . '"><b>' . $lng['back'] . '</b></a></div>' . '<p><a href="index.php">' . $lng['admin_panel'] . '</a></p>'; } break; default: /* ----------------------------------------------------------------- Выводим список доступных языков ----------------------------------------------------------------- */ echo '<div class="phdr"><a href="index.php"><b>' . $lng['admin_panel'] . '</b></a> | ' . $lng['language_default'] . '</div>'; if ($do == 'error') { echo '<div class="rmenu"><b>' . $panel_lng['error'] . '!</b></div>'; }
function sendMail() { $checkbox_value = 0; $cfg = new ini_file(); $cfg->setFileName('./include/config/account.ini'); $cfg->load(); $user_mail = $cfg->getElementValue('user', 'mail'); $p = new ProgressBar(); $mail = new PHPMailer(); $mail->IsSMTP(); //$mail->SMTPDebug= 2; //konfiguracja serwera $mail->PluginDir = "phpmailer/"; $mail->Mailer = "smtp"; $mail->Host = $cfg->getElementValue('server-config', 'Host'); $mail->SMTPSecure = $cfg->getElementValue('server-config', 'SMTPSecure'); $mail->Port = $cfg->getElementValue('server-config', 'Port'); // $mail->SMTPKeepAlive = true; $mail->SMTPAuth = true; $mail->Username = $cfg->getElementValue('server-config', 'Login'); $mail->Password = $cfg->getElementValue('server-config', 'Passwort'); //koniec połączenia //baza danych $mydb = new Db(); $qwery = "SELECT `id`, `email` FROM mail_data Where sended=" . $checkbox_value; $request = $mydb->getMysqli()->query($qwery); if ($request === false) { die('Nie można było odebrać danych do bazy' . ' z powodu blendu:' . $mydb->getMysqli()->error); } if ($request->num_rows == 0) { echo 'Brak danych w bazie'; exit(1); } $i = 0; $size = $request->num_rows; $p->render(); while ($row = $request->fetch_assoc()) { $id = $row['id']; $address = $row['email']; $token = md5(time()); $mail->SetLanguage("pl", "phpmailer/language/"); $mail->CharSet = "UTF-8"; $mail->ContentType = "text/html"; $mail->isHTML(true); $html = new HtmlParser("./mailform/form1 - Kopia.html"); $mail->From = $user_mail; $mail->FromName = $cfg->getElementValue('user', 'FromName'); $mail->Subject = "Tytuł wiadomości"; $mail->msgHTML($html->getHtml()); $mail->AddAddress($address); try { if ($mail->Send()) { $p->setProgress($i * 100 / $size); } else { throw new Exception("E-mail nie mógł zostać wysłany, przyczyna : {$mail->ErrorInfo}"); } } catch (Exeption $e) { var_dump($e); exit; } $i++; } echo 'wysłano mail: '; $p->setProgress(100); //echo $html->getHtml(); $mail->SmtpClose(); //zamykamy połączeie }