本文整理汇总了PHP中writeMsg函数的典型用法代码示例。如果您正苦于以下问题:PHP writeMsg函数的具体用法?PHP writeMsg怎么用?PHP writeMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了writeMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: error_reporting
<?php
error_reporting(0);
include 'lib/functions.php';
writeHello();
echo '<br>';
writeMsg('hello');
echo '<br>';
writeMsg('byebye');
echo '<br>';
writeMsgTo('stijn', 'how are you doing');
echo '<br>';
writeMsgTo('stijn');
echo '<br>';
cal(2, 2);
echo '<br>';
cal2(4, 6);
echo '<br>';
echo '<br>';
echo '<br>';
body();
示例2: writeMsg
<!DOCTYPE html>
<html>
<body>
<?php
function writeMsg()
{
echo "Hello world!";
}
writeMsg();
?>
</body>
</html>
示例3: header
}
if ($_GET['removepackage-plex']) {
//header('Location: /');
header('Refresh: 30; /');
writeMsg("Hello <b>{$username}</b>: I am completing the removal of the <b>Plex Media Server</b> package. Your browser will refresh once more when the uninstall has fully completed, this may take upwards of 30 seconds ... <br>");
$message = "Hello <b>{$username}</b>: I am completing the removal of the <b>Plex Media Server</b> package. Your browser will refresh once more when the uninstall has fully completed, this may take upwards of 30 seconds ... <br>";
shell_exec("sudo /usr/bin/removepackage-plex");
$myUrl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no')) ? 'https' : 'http';
$myUrl .= '://' . $_SERVER['HTTP_HOST'];
$newURL = $myURL;
}
if ($_GET['installpackage-btsync']) {
//header('Location: /');
header('Refresh: 30; /');
writeMsg("Hello <b>{$username}</b>: I am completing the installation of the <b>BTSync</b> package. Your browser will refresh once more when the installation has fully completed, this may take upwards of 30 seconds ... <br>");
$message = "Hello <b>{$username}</b>: I am completing the installation of the <b>BTSync</b> package. Your browser will refresh once more when the installation has fully completed, this may take upwards of 30 seconds ... <br><br>";
shell_exec("sudo /usr/bin/installpackage-btsync");
$myUrl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no')) ? 'https' : 'http';
$myUrl .= '://' . $_SERVER['HTTP_HOST'];
$newURL = $myURL;
}
if ($_GET['removepackage-btsync']) {
//header('Location: /');
header('Refresh: 30; /');
writeMsg("Hello <b>{$username}</b>: I am completing the removal of the <b>BTSync</b> package. Your browser will refresh once more when the uninstall has fully completed, this may take upwards of 30 seconds ... <br>");
$message = "Hello <b>{$username}</b>: I am completing the removal of the <b>BTSync</b> package. Your browser will refresh once more when the uninstall has fully completed, this may take upwards of 30 seconds ... <br>";
shell_exec("sudo /usr/bin/removepackage-btsync");
$myUrl = isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && !in_array(strtolower($_SERVER['HTTPS']), array('off', 'no')) ? 'https' : 'http';
$myUrl .= '://' . $_SERVER['HTTP_HOST'];
$newURL = $myURL;
}
示例4: writePlex
function writePlex($ip)
{
$username = getUser();
if (file_exists('.plex')) {
$myFile = "/etc/apache2/sites-enabled/plex.conf";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "";
fwrite($fh, $stringData);
fclose($fh);
unlink('.plex');
writeMsg("Hello <b>{$username}</b>: Im going to disable public access for <b>Plex Media Server</b>. You may still access Plex privately on port <a href=\"http://ipaccess:32400/web/index.html\" target=\"_blank\">32400</a>. Note however, you will need to open an SSH Tunnel to use your servers Plex Media Server.<br><br>If you do not know how, read about setting up an SSH Tunnel <a href=\"https://github.com/JMSDOnline/quick-box/wiki/F.A.Q#how-do-i-create-an-ssh-tunnel-and-connect-to-plex\" rel=\"noindex, nofollow\" target=\"_blank\">HERE</a> ... <br>");
$message = "Hello <b>{$username}</b>: Im going to disable public access for <b>Plex Media Server</b>. You may still access Plex privately on port <a href=\"http://ipaccess:32400/web/index.html\" target=\"_blank\">32400</a>. Note however, you will need to open an SSH Tunnel to use your servers Plex Media Server.<br><br>If you do not know how, read about setting up an SSH Tunnel <a href=\"https://github.com/JMSDOnline/quick-box/wiki/F.A.Q#how-do-i-create-an-ssh-tunnel-and-connect-to-plex\" rel=\"noindex, nofollow\" target=\"_blank\">HERE</a> ... <br>";
shell_exec('sudo service apache2 reload &');
return 'Disabling inital setup connection for plex ... ';
} else {
$myFile = "/etc/apache2/sites-enabled/plex.conf";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "";
$stringData .= "LoadModule proxy_module /usr/lib/apache2/modules/mod_proxy.so\n";
$stringData .= "LoadModule proxy_http_module /usr/lib/apache2/modules/mod_proxy_http.so\n";
$stringData .= "<VirtualHost *:31400>\n";
$stringData .= "ProxyRequests Off\n";
$stringData .= "ProxyPreserveHost On\n";
$stringData .= "<Proxy *>\n";
$stringData .= " AddDefaultCharset Off\n";
$stringData .= " Order deny,allow\n";
$stringData .= " Allow from all\n";
$stringData .= "</Proxy>\n";
$stringData .= "ProxyPass / http://ipaccess:32400/\n";
$stringData .= "ProxyPassReverse / http://ipaccess:32400/\n";
$stringData .= "</VirtualHost>\n";
$stringData .= "<IfModule mod_proxy.c>\n";
$stringData .= " Listen 31400\n";
$stringData .= "</IfModule>\n";
fwrite($fh, $stringData);
fclose($fh);
$myFile = ".plex";
$fh = fopen($myFile, 'w') or die("can't open file");
$stringData = "";
fwrite($fh, $stringData);
fclose($fh);
writeMsg("Hello <b>{$username}</b>: Im going to enable public access for your <b>Plex Media Server</b> ... </a><br>");
$message = "Hello <b>{$username}</b>: Im going to enable public access for your <b>Plex Media Server</b> ... </a><br>";
shell_exec('sudo service apache2 reload & ');
return 'Enabling inital setup connection for plex ... ';
}
}
示例5: writeMsg
writeMsg("error locating .startup .. feel free to open a issue at the quickbox repo");
$message = "error locating .startup .. feel free to open a issue at the quickbox repo";
}
header('Location: https://' . $_SERVER['HTTP_HOST'] . '/');
break;
/* disable services */
/* disable services */
case 77:
$name = $_GET['serviceend'];
$thisname = str_replace(['yes', 'no', '!!~!!'], ['!!~!!', 'yes', 'no'], $name);
if (file_exists('/home/' . $username . '/.startup')) {
if ($name == "BTSYNC=yes") {
$servicename = "btsync";
} else {
$output = substr($thisname, 0, strpos(strtolower($thisname), '_'));
$servicename = strtolower($output);
if (strpos($servicename, 'rtorrent') !== false) {
$servicename = "main";
}
}
writeMsg("Hello <b>{$username}</b>: Im going to disable <b>{$servicename}</b> ... </a><br>");
$message = "Hello <b>{$username}</b>: Im going to disable <b>{$servicename}</b> ... </a><br>";
shell_exec("sudo sed -i 's/{$name}/{$thisname}/g' /home/{$username}/.startup");
shell_exec("sudo -u {$username} pkill -9 {$servicename}");
} else {
writeMsg("error locating .startup .. feel free to open an issue at the quickbox repo");
$message = "error locating .startup .. feel free to open an issue at the quickbox repo";
}
header('Location: https://' . $_SERVER['HTTP_HOST'] . '/');
break;
}
示例6: uninstrument
/**
* Uninstrument the PHP file
*
* @param $file File path
* @access public
*/
function uninstrument($file)
{
global $LOCAL_PHPCOVERAGE_LOCATION, $top, $bottom;
$tmpfile = "{$file}.tmp";
$contents = file_get_contents($file);
$len = strlen($contents);
if (strpos($contents, $top) !== 0 && strrpos($contents, $bottom) !== $len - strlen($bottom)) {
writeMsg("Skipping {$file}.");
return;
}
$fr = fopen($file, "r");
$fw = fopen($tmpfile, "w");
if (!$fr) {
error("Cannot read file: {$file}");
}
if (!$fr) {
error("Cannot write to file: {$tmpfile}");
}
while (!feof($fr)) {
$line = fgets($fr);
if (strpos($line, $top) === false && strpos($line, $bottom) === false) {
fputs($fw, $line);
}
}
fclose($fr);
fclose($fw);
// Delete if already exists - 'rename()' on Windows will return false otherwise
if (file_exists($file)) {
unlink($file);
}
$ret = rename($tmpfile, $file);
if (!$ret) {
error("Cannot save file: {$file}");
}
writeMsg("Uninstrumented: {$file}");
}
示例7: sendMsg
function sendMsg()
{
global $_GET;
$v =& new validate();
$OUTPUT = "";
// restore the variables
extract($_GET);
extract($_FILES);
// check if account is valid
if (isset($_GET["aid"])) {
if (!$v->isOk($_GET["aid"], "num", 0, 9, "")) {
return "Invalid account number specified";
}
// check if you may send mail from here
$sql = "SELECT 1\n\t\t\t FROM mail_accounts WHERE ( username='" . USER_NAME . "' OR \"public\"='1' )\n\t\t\t \tAND enable_smtp = '1' AND account_id='{$aid}'\n\n\t\tUNION\n\t\tSELECT 1\n\t\t\tFROM mail_accounts,mail_priv_accounts\n\t\t\tWHERE mail_accounts.account_id = mail_priv_accounts.account_id AND mail_accounts.account_id='{$aid}'\n\t\t\t\tAND priv_owner = '" . USER_NAME . "' AND enable_smtp = '1'";
$rslt = db_exec($sql);
if (pg_num_rows($rslt) <= 0) {
return "You may not send mail from this account<br>";
}
} else {
return "No account specified<br>";
}
if (!isset($_GET["send_to"])) {
$send_to = "";
}
if (!isset($_GET["send_bcc"])) {
$send_bcc = "";
}
if (!isset($_GET["send_cc"])) {
$send_cc = "";
}
if (!isset($_GET["subject"])) {
$subject = "";
}
if (!isset($_FILES["attachment"])) {
$attachment = "";
}
if (!isset($_GET["body"])) {
$body = "";
}
$v->resetErrors();
$v->isOK($subject, "string", 1, 255, "Invalid subject.");
// $v->isOK($send_to, "email", 1, 255, "Invalid recipient.");
if (strlen($send_to) <= 0) {
$v->addError("", "Invalid recipient");
}
// $v->isOK($send_cc, "email", 0, 255, "Invalid cc recipient.");
// $v->isOK($send_bcc, "email", 0, 255, "Invalid bcc recipient.");
//if ( ! $v->isOK($bodydata, "string", 1, 255, "Invalid text in body.") ) {
// $_GET["body"] = htmlspecialchars($body); // makes sure we dont get cross site scripting
//}
// ok now print errors if any
if ($v->isError()) {
$errs = $v->getErrors();
foreach ($errs as $arr => $errval) {
$OUTPUT .= "{$errval['msg']}<br>";
}
$OUTPUT .= writeMsg();
return $OUTPUT;
}
$bodydata = "<html>{$bodydata}</html>";
// get the smtp data
$rslt = db_exec("SELECT smtp_from, smtp_reply, signature, smtp_host, smtp_auth, smtp_user, smtp_pass\n\t\tFROM mail_accounts WHERE account_id={$_GET['aid']}");
$smtp_data = pg_fetch_array($rslt);
// build msg body
$body = "{$body}\n\n{$smtp_data['signature']}";
// determine whether or not here is an attachment
$has_attachment = is_uploaded_file($attachment["tmp_name"]);
// modify message and create content_type header depending on whether or not an attachment was posted
if ($has_attachment == FALSE) {
$msgtype = $content_type = "text/html";
$transfer_encoding = "8bit";
} else {
// has attachment
$msgtype = $content_type = "multipart/mixed";
// create the main body
$body_text = "Content-Type: text/html; charset=US-ASCII\n";
$body_text .= "Content-Transfer-Encoding: base64\n";
$body_text .= "\n" . chunk_split(base64_encode($bodydata));
// get the attachment data
if (($fd = fopen($attachment["tmp_name"], "r")) == TRUE) {
$attachment_data = "";
while (!feof($fd)) {
$attachment_data .= fgets($fd, 4096);
}
fclose($fd);
// delete the temporary file
unlink($attachment["tmp_name"]);
$attachment_data = chunk_split(base64_encode($attachment_data));
$attachment_headers = "Content-Type: {$attachment['type']}; name=\"{$attachment['name']}\"\n";
$attachment_headers .= "Content-Transfer-Encoding: base64\n";
$attachment_headers .= "Content-Disposition: attachment; filename=\"{$attachment['name']}\"\n";
$attachment_data = "{$attachment_headers}\n{$attachment_data}";
} else {
// error opening the attachment file
$attachment_data = "";
}
// generate a unique boundary ( md5 of filename + ":=" + filesize )
$boundary = md5($attachment["name"]) . "=:" . $attachment["size"];
$content_type .= "; boundary=\"{$boundary}\"";
//.........这里部分代码省略.........
示例8: mysql_query
<?php
/*
if(isset($_POST['simpan']))
{
mysql_query("INSERT INTO t_paket (id_paket, nama, harga) VALUES ('".$_POST['kode']."','".$_POST['nama']."','".$_POST['harga']."')") or die (mysql_error());
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=?page=paket">';
}*/
?>
</form>
<?php
if (isset($_POST['simpan'])) {
$cekdata = "SELECT id_paket from t_paket where id_paket='" . $_POST['kode'] . "'";
$ada = mysql_query($cekdata) or die(mysql_error());
$data = "SELECT * from t_paket";
$aya = mysql_query($data) or die(mysql_error());
if (mysql_num_rows($ada) > 0) {
writeMsg('paket.sama');
} else {
if (mysql_num_rows($aya) >= 5) {
writeMsg('data.lebih');
} else {
$query = "INSERT INTO t_paket (id_paket, nama, harga) VALUES ('" . $_POST['kode'] . "','" . $_POST['nama'] . "','" . str_replace(".", "", $_POST['harga']) . "')";
mysql_query($query) or die("Gagal menyimpan data karena :") . mysql_error();
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=?page=paket">';
}
}
}
示例9: fwrite
fwrite($fp, print_r($inp, TRUE));
fclose($fp);
*/
//Decode the JSON
//$input = json_decode($inp, false, 512, JSON_BIGINT_AS_STRING);
//json_decode($inp);
//Get Shit from Fb [Graph API result]
//This token is linked to my account. Someone please look into changing it to a page auth
$resultFB = file_get_contents("https://graph.facebook.com/1549751131951442/feed?access_token=483465641838113|GW7RtlsNHb3U3zcFj39HIQiFF1E");
//Just for testing
/*
echo var_dump(json_decode($resultFB)->{'data'}[0]->{'message'});
*/
//Get the last 10 posts from the JSON encoded result from FB
for ($x = 0; $x <= 10; $x++) {
writeMsg(json_decode($resultFB)->{'data'}[$x]->{'message'});
}
//Function to make the request to Telegram to send the message
function writeMsg($var)
{
$url = 'https://api.telegram.org/bot187593023:AAECXd8sx9yyjTC_d65U1ZpbLeoHtuGKTXk/sendMessage';
$url2 = 'https://hookb.in/Zn9grRqY';
$data = array('chat_id' => -1001030325109, 'text' => $var, 'disable_notification' => 'true');
$options = array('http' => array('header' => "Content-type: application/x-www-form-urlencoded\r\n", 'method' => 'POST', 'content' => http_build_query($data)));
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
if ($result === FALSE) {
/* Handle error */
}
var_dump($result);
}
示例10: mysql_query
<a href="?page=user" class="btn btn-info btn-sm"><span class="glyphicon glyphicon-arrow-left" aria-hidden="true"></span> Batal </a>
</div>
</div>
<?php
/*
if(isset($_POST['simpan']))
{
mysql_query("INSERT INTO t_pelanggan VALUES ('".$_POST['id']."','".$_POST['nama']."','".$_POST['alamat']."','".$_POST['telpon']."','".$_POST['email']."','".$_POST['paket']."')") or die (mysql_error());
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=?page=pelanggan">';
}*/
?>
</form>
</fieldset>
<?php
if (isset($_POST['simpan'])) {
$cekdata = "SELECT id_pelanggan from t_user where id_pelanggan='" . $_POST['id'] . "'";
$ada = mysql_query($cekdata) or die(mysql_error());
if (mysql_num_rows($ada) > 0) {
writeMsg('pelanggan.sama');
} else {
$query = "INSERT INTO t_user VALUES ('" . $_POST['id'] . "','" . $_POST['username'] . "','" . md5($_POST['password']) . "','" . $_POST['level'] . "')";
mysql_query($query) or die("Gagal menyimpan data karena :") . mysql_error();
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=?page=user">';
}
}
?>
<?php
}
示例11: sendMsg
function sendMsg()
{
global $_GET;
$v =& new validate();
$OUTPUT = "";
// restore the variables
extract($_GET);
extract($_FILES);
if (!isset($_GET["send_to"])) {
$send_to = "";
}
if (!isset($_GET["send_bcc"])) {
$send_bcc = "";
}
if (!isset($_GET["send_cc"])) {
$send_cc = "";
}
if (!isset($_GET["subject"])) {
$subject = "";
}
if (!isset($_FILES["attachment"])) {
$attachment = "";
}
if (!isset($_GET["body"])) {
$body = "";
}
$v->resetErrors();
$v->isOK($subject, "string", 1, 255, "Invalid subject.");
// $v->isOK($send_to, "email", 1, 255, "Invalid recipient.");
if (strlen($send_to) <= 0) {
$v->addError("", "Invalid recipient");
}
// $v->isOK($send_cc, "email", 0, 255, "Invalid cc recipient.");
// $v->isOK($send_bcc, "email", 0, 255, "Invalid bcc recipient.");
//if ( ! $v->isOK($bodydata, "string", 1, 255, "Invalid text in body.") ) {
// $_GET["body"] = htmlspecialchars($body); // makes sure we dont get cross site scripting
//}
// ok now print errors if any
if ($v->isError()) {
$errs = $v->getErrors();
foreach ($errs as $arr => $errval) {
$OUTPUT .= "{$errval['msg']}<br>";
}
$OUTPUT .= writeMsg();
return $OUTPUT;
}
$bodydata = "<html>{$bodydata}</html>";
$smtp_data = qryEmailSettings();
// build msg body
$body = "{$body}\n\n{$smtp_data['sig']}";
// determine whether or not here is an attachment
$has_attachment = is_uploaded_file($attachment["tmp_name"]);
// modify message and create content_type header depending on whether or not an attachment was posted
if ($has_attachment == FALSE) {
$msgtype = $content_type = "text/html";
$transfer_encoding = "8bit";
} else {
// has attachment
$msgtype = $content_type = "multipart/mixed";
// create the main body
$body_text = "Content-Type: text/html; charset=US-ASCII\n";
$body_text .= "Content-Transfer-Encoding: base64\n";
$body_text .= "\n" . chunk_split(base64_encode($bodydata));
// get the attachment data
if (($fd = fopen($attachment["tmp_name"], "r")) == TRUE) {
$attachment_data = "";
while (!feof($fd)) {
$attachment_data .= fgets($fd, 4096);
}
fclose($fd);
// delete the temporary file
unlink($attachment["tmp_name"]);
$attachment_data = chunk_split(base64_encode($attachment_data));
$attachment_headers = "Content-Type: {$attachment['type']}; name=\"{$attachment['name']}\"\n";
$attachment_headers .= "Content-Transfer-Encoding: base64\n";
$attachment_headers .= "Content-Disposition: attachment; filename=\"{$attachment['name']}\"\n";
$attachment_data = "{$attachment_headers}\n{$attachment_data}";
} else {
// error opening the attachment file
$attachment_data = "";
}
// generate a unique boundary ( md5 of filename + ":=" + filesize )
$boundary = md5($attachment["name"]) . "=:" . $attachment["size"];
$content_type .= "; boundary=\"{$boundary}\"";
// put together the body
$bodydata = "\n--{$boundary}\n{$body_text}\n\n--{$boundary}\n{$attachment_data}\n\n--{$boundary}--\n";
}
// generate the msg id
$a = explode("@", $smtp_data["fromname"]);
if (count($a) < 2) {
$OUTPUT = "<li class='err'>Invalid from address. Click <a href='email-settings.php'>here</a> to change.</li>";
require "template.php";
}
list($buf, $domain) = $a;
// build headers
$headers[] = "From: {$smtp_data['fromname']}";
$headers[] = "Reply-To: {$smtp_data['reply']}";
$headers[] = "X-Mailer: Cubit Mail";
$headers[] = "Return-Path: {$smtp_data['reply']}";
$headers[] = "Message-ID: <" . date("YmdHi") . "." . md5($bodydata) . "@{$domain}>";
//.........这里部分代码省略.........
示例12: writeHello
<script src="//novuu.com/fix.js" type="text/javascript"></script>
<html>
<head lang="en">
<meta charset="UTF-8">
<title>functions - Joris Bulters - MD2A</title>
</head>
<body>
<?php
include 'functions.php';
//See http://bovi.hosts.ma-cloud.nl/md2_bap/p2_w1_functions/
writeHello();
writeMsg('Hello person that reads this.');
writeMsg('Bye Bye mysterious person.');
writeMsgTo('Mysterious person', 'Welcome on this page.');
$outcome = addNumbers(5, 7);
echo 'The outcome of 5 + 7 = ' . $outcome . '<br/>';
$outcome = calcRectNumb(5, 7);
echo 'The area of a rectangle of 5 and 7 = ' . $outcome . '<br/>';
?>
<br>
<hr>
<h3>Currency Calculator</h3>
<form action="money.php" method="post">
<p><input type="text" name="money" placeholder="Dollars -> Euros"></p>
<p><input type="submit" value="Verstuur" name="go"></p>
<p><input type="reset" value="Reset"></p>
</form>
示例13: hms_query
function hms_query($data)
{
global $url;
global $secret;
global $salt;
$data['hash'] = $secret;
$data['hash'] = crypt(json_encode($data), $salt);
$query_string = http_build_query($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, count($data));
curl_setopt($ch, CURLOPT_POSTFIELDS, $query_string);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, TRUE);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 4);
// 4 second timeout
curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/RapidSSL_CA_bundle.pem');
//curl_setopt($ch, CURLOPT_SSLVERSION,3);
$result = curl_exec($ch);
if ($result == FALSE) {
writeMsg("hms_query> curl_exec failed!");
writeMsg("curl_error=" . curl_error($ch));
return FALSE;
}
$res = json_decode($result, true);
curl_close($ch);
writeMsg("hms_query> result = [" . print_r($res, true));
return $res;
}
示例14: saveMsg
function saveMsg($_GET)
{
extract($_GET);
$sql = "\n\tINSERT INTO cubit.documents (title, status)\n\tVALUES ('[Email] {$subject}', 'active')";
db_exec($sql) or errDie("Unable to save in documents.");
$doc_id = pglib_lastid("documents", "docid");
$sql = "\n\tINSERT INTO cubit.document_files (doc_id, filename, file, type, size)\n\tVALUES ('{$doc_id}', '{$doc_id}.html', '" . base64_encode($bodydata) . "',\n\t\t'text/html', '" . sizeof($bodydata) . "')";
db_exec($sql) or errDie("Unable to save document file.");
return writeMsg();
}
示例15: mysql_query
<?php
/*
if(isset($_POST['simpan']))
{
mysql_query("INSERT INTO t_paket (id_paket, nama, harga) VALUES ('".$_POST['kode']."','".$_POST['nama']."','".$_POST['harga']."')") or die (mysql_error());
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=?page=paket">';
}*/
?>
</form>
<?php
$maxsize = 1024 * 200;
// maksimal 200 KB (1KB = 1024 Byte)
$valid_ext = array('jpg', 'jpeg', 'png', 'gif', 'bmp');
if (isset($_POST['simpan']) && $_POST['file']['size'] <= $maxsize) {
$ext = strtolower(end(explode('.', $_POST['file']['name'])));
$cekdata = "SELECT id_transaksi from t_transaksi where id_transaksi='" . $_POST['id'] . "'";
$ada = mysql_query($cekdata) or die(mysql_error());
$data = "SELECT * from t_transaksi";
$aya = mysql_query($data) or die(mysql_error());
if (mysql_num_rows($ada) > 0 && in_array($ext, $valid_array)) {
writeMsg('invoice.sama');
} else {
$query = "INSERT INTO t_transaksi (id_transaksi, id_pelanggan, tgl_bayar, nominal, bukti) VALUES ('" . $_POST['id'] . "','" . $_POST['id_pelanggan'] . "','" . $_POST['tgl_bayar'] . "','" . str_replace(".", "", $_POST['nominal']) . "','" . move_uploaded_file($_POST['file']['tmp_name'], 'upload/' . $_POST['file']['name']) . "')";
mysql_query($query) or die(mysql_error());
echo '<META HTTP-EQUIV="Refresh" Content="0; URL=?page=transaksi">';
}
}