Skip to content

Instantly share code, notes, and snippets.

@insidenothing
Created October 19, 2010 13:59
Show Gist options
  • Save insidenothing/634235 to your computer and use it in GitHub Desktop.
Save insidenothing/634235 to your computer and use it in GitHub Desktop.
main doc / pdf code
<?
ini_set('error_reporting',E_ERROR | E_WARNING | E_PARSE);
ini_set('display_errors','On');
include 'dptc.log.php';
mysql_connect();
mysql_select_db('intranet');
function addNote($id,$note){
$q1 = "SELECT notes FROM schedule_items WHERE schedule_id = '$id'";
$r1 = @mysql_query ($q1) or die(mysql_error());
$d1 = mysql_fetch_array($r1, MYSQL_ASSOC);
$notes = "<li>".date('g:iA n/j/y').' '.$_COOKIE[userdata][name].': '.$note."</li>".$d1[notes];
if ($_COOKIE[userdata][name]){
$user = $_COOKIE[userdata][name];
}else{
$user = 'Server A.I.';
}
error_log("[".date('g:iA n/j/y').'] ['.$user.'] ['.$id.'] ['.$note."]\n", 3, '/logs/notes.log');
$notes = addslashes($notes);
$q1 = "UPDATE schedule_items set notes='$notes' WHERE schedule_id = '$id'";
$r1 = @mysql_query ($q1) or die(mysql_error());
}
function docAD($id){
$r=@mysql_query("select LiveAdHTML from schedule_items where schedule_id = '$id'");
$d=mysql_fetch_array($r,MYSQL_ASSOC);
$myFile = "/data/auction/adMaster/$id.html";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $d[LiveAdHTML].instructions());
fclose($fh);
$error = system('python DocumentConverter.py /data/auction/adMaster/'.$id.'.html /data/auction/adMaster/'.$id.'.doc',$result);
header('Location: http://hwestauctions.com/adDownload/'.$id.'.doc');
}
function pdfAD($id){
$r=@mysql_query("select LiveAdHTML from schedule_items where schedule_id = '$id'");
$d=mysql_fetch_array($r,MYSQL_ASSOC);
$myFile = "/data/auction/adMaster/$id.html";
$fh = fopen($myFile, 'w') or die("can't open file");
fwrite($fh, $d[LiveAdHTML].instructions());
fclose($fh);
$error = system('python DocumentConverter.py /data/auction/adMaster/'.$id.'.html /data/auction/adMaster/'.$id.'.pdf',$result);
header('Location: http://hwestauctions.com/adDownload/'.$id.'.pdf');
}
if($_GET['doc']){
docAD($_GET[id]);
}
if($_GET['pdf']){
pdfAD($_GET[id]);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment