set_charset("utf8"); $res = mysqli_query($connection,"select count(1) as c from tron_licence where name = '$name' and lastname = '$lastname' and street='$street' and zip='$zip' and city='$city' and email='$email'"); $row = mysqli_fetch_assoc($res); if($row['c'] == 0) return false; else return true; } function init($name, $lastname, $street, $zip, $city, $country, $email, $paypal) { $this->name = $name; $this->lastname = $lastname; $this->street = $street; $this->zip = $zip; $this->city = $city; $this->country = $country; $this->email = $email; $this->paypal = $paypal; } function create() { $connection = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE); $connection->set_charset("utf8"); $qry = "insert into tron_licence (name, lastname, street, zip, city, country, email, paypal, create_date) values ('$this->name','$this->lastname','$this->street','$this->zip', '$this->city','$this->country','$this->email','$this->paypal', now())"; $res = mysqli_query($connection,$qry); $id = mysql_insert_id(); $this->id = $id; $id = md5($id); $this->licence = substr($id,0,4)."-".substr($id,4,4)."-".substr($id,8,4)."-".substr($id,12,4)."-".substr($id,16,4)."-".substr($id,20,4)."-".substr($id,24,4)."-".substr($id,28,4); mysqli_query($connection,"update tron_licence set licence = '$this->licence' where id = $this->id"); $booking = new Booking(); $booking->addBooking(LICENCE_PRICE, 7, 2, "TRON-CNC Lizenz ".$this->lastname); } function createLicenceSheet() { define('FPDF_FONTPATH', ROOT.'libs/fpdf/font/'); $pdf= new fpdi(); $pagecount = $pdf->setSourceFile(ROOT."rsc/template.pdf"); $tplidx = $pdf->ImportPage(1); $pdf->addPage(); $pdf->useTemplate($tplidx); $pdf->SetFont('Courier','B',18); $pdf->SetXY(60,83); $pdf->Cell(80,10,$this->licence,0,1,'C'); $pdf->SetFont('Courier','B',14); $pdf->SetXY(40,120); $pdf->Cell(80,10," Name: ".$this->name." ". $this->lastname,0,1,'L'); $pdf->SetXY(40,130); $pdf->Cell(80,10,"Address: ".$this->street,0,1,'L'); $pdf->SetXY(40,140); $pdf->Cell(80,10," City: ".$this->zip." ".$this->city,0,1,'L'); $pdf->SetXY(40,150); $pdf->Cell(80,10,"Country: ".$this->country,0,1,'L'); $pdf->SetXY(40,160); $pdf->Cell(80,10," Email: ".$this->email,0,1,'L'); $pdf->SetXY(40,170); $pdf->Cell(80,10," Date: ".date("d.m.Y"),0,1,'L'); $pdf->SetXY(40,190); $this->filename = ROOT."licences/".sprintf("%04d", $this->id).".pdf"; $pdf->output($this->filename,"F"); $pdf->closeParsers(); // echo "Creating :".$this->filename; } function load($id) { $connection = new mysqli(MYSQL_HOST, MYSQL_USER, MYSQL_PASS, MYSQL_DATABASE); $connection->set_charset("utf8"); $res = mysqli_query($connection,"select * from tron_licence where id = $id"); $row =mysqli_fetch_assoc($res); $this->name = $row['name']; $this->lastname = $row['lastname']; $this->street = $row['street']; $this->zip = $row['zip']; $this->city = $row['city']; $this->country = $row['country']; $this->email = $row['email']; $this->paypal = $row['paypal']; $this->licence = $row['licence']; $this->id = $id; $this->filename = ROOT."licences/".sprintf("%04d", $this->id).".pdf"; } function setEmail($em) { $this->email = $em; } function sendLicence() { $datei = ROOT."rsc/licence.txt"; $zeiger = fopen($datei, "r+"); $body = fread($zeiger, filesize($datei)); $body = str_replace("{NAME}", $this->name." ".$this->lastname, $body); $body = str_replace("{LICENCE}", $this->licence, $body); $mail = new htmlMimeMail(); $mail->setSMTPParams(MAIL_SERVER, 25, null, MAIL_AUTH, MAIL_USER, MAIL_PASS); $mail->setReturnPath("Jens@jensn.de"); $mail->setFrom("Jens Niemeyer "); $mail->setSubject("TRON-CNC Lizenz"); $mail->setText( $body); $datei = ROOT."rsc/TRON-CLASSIC.zip"; $zeiger = fopen($datei, "rb"); $rawdata = fread($zeiger, filesize($datei)); $mail->addAttachment($rawdata, "TRON-CLASSIC.zip", 'application/zip', 'base64'); fclose($zeiger); $datei = ROOT."rsc/TRON-PLUS.zip"; $zeiger = fopen($datei, "rb"); $rawdata = fread($zeiger, filesize($datei)); $mail->addAttachment($rawdata, "TRON-PLUS.zip", 'application/zip', 'base64'); fclose($zeiger); $datei = $this->filename; $zeiger = fopen($this->filename, "rb"); $rawdata = fread($zeiger, filesize($datei)); $mail->addAttachment($rawdata, "Lizenz_TRON.Pdf", 'application/pdf', 'base64'); fclose($zeiger); echo $mail->send(array( $this->email ), 'mail'); // echo "Sending EMail to: ".$this->email; } } ?>set_charset("utf8"); $this->Smarty(); $this->template_dir = SMARTY_DIR.'templates/'; $this->compile_dir = SMARTY_DIR.'templates_c/'; $this->config_dir = SMARTY_DIR.'configs/'; $this->cache_dir = SMARTY_DIR.'cache/'; array_push($this->plugins_dir , ROOT . "libs/smarty/plugins/"); $this->assign("title", "CNC Fräse, Portalfräse, Bauanleitung, DIY Router, Fräser, Modellbau Fräse, Bauplan, CNC Fräsen"); $page = $_SERVER['PHP_SELF']; $page = basename($page); if($page=='page.php') $page = $_REQUEST['page']; mysqli_query($connection,"insert into tron_counter (page, datum) values ('$page', now())"); $res = mysqli_query($connection,"select count(1) as c from tron_counter"); $row =mysqli_fetch_assoc($res); $this->assign("PAGECOUNTER", $row['c']); $this->assign("language", LANGUAGE); $current = array( $page => $page, "slideshow.php" => "bilder", "baubericht" => "bilder", "contact.php" => "contact", "newsletter.php" => "news", "guestbook.php" => "guestbook" ); $this->assign("current_id", $current[$page]); $this->assign("page", $page); //echo "page:$page"; } } ?>