Greeting
[ class tree: Greeting ] [ index: Greeting ] [ all elements ]

Source for file example_3.php

Documentation is available at example_3.php

  1. <?php 
  2. /**
  3.  * File contain example with Flash as html
  4.  *
  5.  * @package     Greeting
  6.  * @version     1.1
  7.  * @copyright     Copyright (C)2006 Todor Iliev <todor.iliev@viplord.com> . All rights reserved.
  8.  * @license     http://www.gnu.org/copyleft/gpl.html GNU Public License
  9.  * @filesource
  10.  */
  11.  
  12. /**
  13.  *     LICENSE
  14.  *     This program is free software; you can redistribute it and/or
  15.  *     modify it under the terms of the GNU General Public License (GPL)
  16.  *     as published by the Free Software Foundation; either version 2
  17.  *     of the License, or (at your option) any later version.
  18.  *    This program is distributed in the hope that it will be useful,
  19.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  20.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21.  *    GNU General Public License for more details.
  22.  *    To read the license please visit http://www.gnu.org/copyleft/gpl.html
  23.  *    ----------------------------------------------------------------------
  24.  *    Original Author of file:
  25.  *    Purpose of file:
  26.  *    ----------------------------------------------------------------------
  27.  *     Tested with IE 6,IE 7, Netscape 7, Opera 9, Firefox 2.0
  28.  *     This is free software. Use at your own risk.
  29.  */
  30.  
  31. $safe_op    =    (!empty($_REQUEST['op'])) $_REQUEST['op''' ;
  32.         
  33. if(!empty($safe_op)) {
  34.     $color         =     array('red','blue','green','white','gray','purple','black','yellow');
  35.     $font        =    array('Arial','Balthazar','Chicago','Garamond','Georgia','Times New Roman','Victorian LET','Rage Italic LET');
  36.     $size        =    array('xx-small','x-small','small','medium','large','x-large','xx-large');
  37.     $style        =    array('bold','italic','underline');
  38.     $position    =    array('left','center','right');
  39.     $gc            =    array('1.png','2.png','3.png','4.swf');    
  40.     
  41. }    
  42.             
  43. ?>
  44. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  45. <html xmlns="http://www.w3.org/1999/xhtml">
  46. <head>
  47. <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  48. <title>Greeting cards</title>
  49. <link href="css/mainstyle.css" rel="stylesheet" type="text/css" />
  50. </head>
  51.  
  52. <body>
  53. <?php if(strcmp($safe_op,'send'== 0?>
  54. <?php 
  55.       require('class.php4.greeting.php');
  56. //    require('class.php5.greeting.php');      
  57.     
  58.       /**
  59.        * Greeting cards url path
  60.        * @var string 
  61.        */
  62.       $gc_url_path    =    '[Your Images URL_PATH]';
  63.       
  64.       /**
  65.        * Initialize variables
  66.        */
  67.       settype($_POST['color'],'integer');
  68.       settype($_POST['text_color'],'integer');
  69.       settype($_POST['font'],'integer');
  70.       settype($_POST['size'],'string');
  71.       settype($_POST['style'],'integer');
  72.       settype($_POST['position'],'integer');
  73.       settype($_POST['text'],'string');
  74.       settype($_POST['op'],'string');
  75.       settype($_POST['gc'],'integer');
  76.       settype($_POST['from_name'],'string');
  77.       settype($_POST['from_mail'],'string');
  78.       settype($_POST['to_mail'],'string');
  79.       
  80.       /**
  81.        * Random file name
  82.        * @var string 
  83.        */
  84.       $random_file_name md5(time());
  85.  
  86.       /**
  87.        * Add text in creeting card
  88.        * @var string 
  89.        */
  90.       $add_txt 'You have greeting on this address [URL path]/'  's_greeting/' $random_file_name '.html';
  91.       
  92.       /**
  93.        * Mail subject
  94.        * @var string 
  95.        */
  96.       $subject 'Greeting card from ' $_POST['from_name'];
  97.       
  98.       /**
  99.        * Create greeting object
  100.        * @var object 
  101.        */
  102.       $greeting new Greeting($gc_url_path $gc[$_POST['gc']])
  103.       
  104.       /**
  105.        * Initialize greeting object attributes
  106.        */
  107.       
  108.       /**
  109.        * Background color
  110.        * @var string 
  111.        */
  112.       $greeting->mBg                =    (!empty($_POST['color'])) $color[$_POST['color']] $color[3];
  113.       
  114.       /**
  115.        * Text color
  116.        * @var string 
  117.        */
  118.       $greeting->mTextColor         =     (!empty($_POST['text_color'])) $color[$_POST['text_color']] $color[6];
  119.       
  120.       /**
  121.        * Text font
  122.        * @var string 
  123.        */
  124.       $greeting->mTextFont        =    (!empty($_POST['font'])) $font[$_POST['font']] $font[0];
  125.       
  126.       /**
  127.        * Text size
  128.        * @var mixed 
  129.        */
  130.       $greeting->mTextSize        =    (!empty($_POST['size'])) $size[$_POST['size']] $size[0];
  131.       
  132.       /**
  133.        * Text style
  134.        * @var string 
  135.        */
  136.       $greeting->mTextStyle        =    (!empty($_POST['style'])) $style[$_POST['style']] $style[0];
  137.       
  138.       /**
  139.        * Text position
  140.        * @var string 
  141.        */
  142.       $greeting->mTextPos            =    (!empty($_POST['position'])) $position[$_POST['position']] $position[0];
  143.       
  144.       /**
  145.        * Greeting text
  146.        * @var mixed 
  147.        */
  148.       $greeting->mText            =    htmlspecialchars($_POST['text']);
  149.       
  150.       /**
  151.        * Sender name
  152.        * @var string 
  153.        */
  154.       $greeting->mSendFromName    =    $_POST['from_name'];
  155.       
  156.       /**
  157.        * Sender mail address
  158.        * @var string 
  159.        */
  160.       $greeting->mSendFromMail    =    $_POST['from_mail'];
  161.       
  162.       /**
  163.        * Addressee
  164.        * @var string 
  165.        */
  166.       $greeting->mSendToMail        =    $_POST['to_mail'];
  167.       
  168.       /**
  169.        * Mail subject
  170.        * @var mixed 
  171.        */
  172.       $greeting->mSubject            =    $subject;
  173.       
  174.       /**
  175.        * Type on greeting card (html or text)
  176.        * @var string 
  177.        */
  178.       $greeting->mType            =    'flash';
  179.     
  180.       // Create greeting file
  181.      if (!$handle fopen('s_greeting/' $random_file_name '.html',"a")) {
  182.           echo "Cannot open file ('s_greeting/' . $random_file_name . '.html')";
  183.         exit;
  184.        }
  185.                
  186.        if (fwrite($handle$greeting->GetCard()) === FALSE{
  187.         echo "Cannot write to file ('s_greeting/' . $random_file_name . '.html')";
  188.         exit;
  189.     }
  190.        fclose($handle);
  191.    
  192.        // Send mail to recipient
  193.        /**
  194.        * Add text in greeting card
  195.        * @var mixed 
  196.        */
  197.       $greeting->mAddTxt            =    $add_txt;
  198.     
  199.       if(empty($greeting->mError)) {
  200.           
  201.           if($greeting->SendCard(=== true{
  202.             echo 'Your greeting card sended successful.';
  203.             else {
  204.                 $greeting->ShowErrors();
  205.             }//    if($greeting->SendCard() === true) {
  206.         
  207.           else {
  208.             $greeting->ShowErrors();
  209.         }//    if(empty($greeting->mError)) {
  210.         
  211.     
  212. ?>
  213.  
  214. <?php elseif(strcmp($safe_op,'options'== 0?>
  215. <form id="gc_form" name="gc_form" method="post" action="<?php echo $_SERVER['PHP_SELF'?>">
  216.   <table width="100%" border="0" cellspacing="0" cellpadding="0">
  217.     <tr>
  218.       <td colspan="4"><h3>Background color </h3></td>
  219.     </tr>
  220.     <tr>
  221.       <td id="red"><input name="color" type="radio" value="0" accesskey="r" tabindex="1" id="rb1" />
  222.       <label for="rb1">Red</label></td>
  223.       <td id="blue"><input name="color" type="radio" value="1" accesskey="u" tabindex="2" id="rb2" />
  224.       <label for="rb2">Blue</label></td>
  225.       <td id="green"><input name="color" type="radio" value="2" accesskey="g" tabindex="3" id="rb3" />
  226.       <label for="rb3">Green</label></td>
  227.       <td id="white"><input name="color" type="radio" value="3" accesskey="w" tabindex="4" id="rb4" />
  228.       <label for="rb4">White</label></td>
  229.     </tr>
  230.     <tr>
  231.       <td id="gray"><input name="color" type="radio" value="4" accesskey="y" tabindex="5" id="rb5" />
  232.       <label for="rb5">Gray</label></td>
  233.       <td id="purple"><input name="color" type="radio" value="5" accesskey="p" tabindex="6" id="rb6"/>
  234.       <label for="rb6">Purple</label></td>
  235.       <td id="black"><input name="color" type="radio" value="6" accesskey="b" tabindex="7" id="rb7" />
  236.       <label for="rb7">Black</label></td>
  237.       <td id="yellow"><input name="color" type="radio" value="7" accesskey="y" tabindex="8" id="rb8" />
  238.       <label for="rb8">Yellow</label></td>
  239.     </tr>
  240.     <tr>
  241.       <td colspan="4"><h3>Text color </h3></td>
  242.     </tr>
  243.     <tr>
  244.       <td id="red"><input name="text_color" type="radio" value="0" accesskey="r" tabindex="1" id="rb9" />
  245.           <label for="rb9">Red</label></td>
  246.       <td id="blue"><input name="text_color" type="radio" value="1" accesskey="u" tabindex="2" id="rb10" />
  247.           <label for="rb10">Blue</label></td>
  248.       <td id="green"><input name="text_color" type="radio" value="2" accesskey="g" tabindex="3" id="rb11" />
  249.           <label for="rb11">Green</label></td>
  250.       <td id="white"><input name="text_color" type="radio" value="3" accesskey="w" tabindex="4" id="rb12" />
  251.           <label for="rb12">White</label></td>
  252.     </tr>
  253.     <tr>
  254.       <td id="gray"><input name="text_color" type="radio" value="4" accesskey="y" tabindex="5" id="rb13" />
  255.           <label for="rb13">Gray</label></td>
  256.       <td id="purple"><input name="text_color" type="radio" value="5" accesskey="p" tabindex="6" id="rb14"/>
  257.           <label for="rb14">Purple</label></td>
  258.       <td id="black"><input name="text_color" type="radio" value="6" accesskey="b" tabindex="7" id="rb15" />
  259.           <label for="rb15">Black</label></td>
  260.       <td id="yellow"><input name="text_color" type="radio" value="7" accesskey="y" tabindex="8" id="rb16" />
  261.           <label for="rb16">Yellow</label></td>
  262.     </tr>
  263.     
  264.     <tr>
  265.       <td colspan="4"><h3>Text font </h3></td>
  266.     </tr>
  267.     <tr>
  268.       <td id="f1"><input name="font" type="radio" value="0" accesskey="a" tabindex="9" id="rb17" />
  269.       <label for="rb17">Arial</label></td>
  270.       <td id="f2"><input name="font" type="radio" value="1" accesskey="z" tabindex="10" id="rb18" />
  271.       <label for="rb18">Balthazar</label></td>
  272.       <td id="f3"><input name="font" type="radio" value="2" accesskey="c" tabindex="11" id="rb19" />
  273.       <label for="rb19">Chicago</label></td>
  274.       <td id="f4"><input name="font" type="radio" value="3" accesskey="m" tabindex="12" id="rb20" />
  275.       <label for="rb20">Garamond</label></td>
  276.     </tr>
  277.     <tr>
  278.       <td id="f5"><input name="font" type="radio" value="4" accesskey="i" tabindex="13" id="rb21" />
  279.       <label for="rb21">Georgia</label></td>
  280.       <td id="f6"><input name="font" type="radio" value="5" accesskey="t" tabindex="14" id="rb22" />
  281.       <label for="rb22">Times New Roman</label></td>
  282.       <td id="f7"><input name="font" type="radio" value="6" accesskey="v" tabindex="15" id="rb23" />
  283.       <label for="rb23">Victorian LET</label></td>
  284.       <td id="f8"><input name="font" type="radio" value="7" accesskey="e" tabindex="16" id="rb24" />
  285.       <label for="rb24">Rage Italic LET</label></td>
  286.     </tr>
  287.     <tr>
  288.       <td colspan="4"><h3>Text size </h3></td>
  289.     </tr>
  290.     <tr>
  291.       <td id="s1"><input name="size" type="radio" value="0" accesskey="1" tabindex="17" id="rb25" />
  292.       <label for="rb25">xx-small</label></td>
  293.       <td id="s2"><input name="size" type="radio" value="1" accesskey="2" tabindex="18" id="rb26" />
  294.       <label for="rb26">x-small</label></td>
  295.       <td id="s3"><input name="size" type="radio" value="2" accesskey="3" tabindex="19" id="rb27" />
  296.       <label for="rb27">small</label></td>
  297.       <td id="s4"><input name="size" type="radio" value="3" accesskey="4" tabindex="20" id="rb28" />
  298.       <label for="rb28">medium</label></td>
  299.     </tr>
  300.     <tr>
  301.       <td id="s5"><input name="size" type="radio" value="4" accesskey="5" tabindex="21" id="rb29" />
  302.       <label for="rb29">large</label></td>
  303.       <td id="s6"><input name="size" type="radio" value="5" accesskey="6" tabindex="22" id="rb30" />
  304.       <label for="rb30">x-large</label></td>
  305.       <td id="s7"><input name="size" type="radio" value="6" accesskey="7" tabindex="23" id="rb31" />
  306.       <label for="rb31">xx-large</label></td>
  307.       <td>&nbsp;</td>
  308.     </tr>
  309.     <tr>
  310.       <td colspan="4"><h3>Text style </h3></td>
  311.     </tr>
  312.     <tr>
  313.       <td id="st1"><input name="style" type="radio" value="0" accesskey="d" tabindex="24" id="rb32" />
  314.       <label for="rb32">Bold</label></td>
  315.       <td id="st2"><input name="style" type="radio" value="1" accesskey="t" tabindex="25" id="rb33" />
  316.       <label for="rb33">italic</label></td>
  317.       <td id="st3"><input name="style" type="radio" value="2" accesskey="n" tabindex="26" id="rb34" />
  318.       <label for="rb34">underline</label></td>
  319.       <td>&nbsp;</td>
  320.     </tr>
  321.     <tr>
  322.       <td colspan="4"><h3>Text position </h3></td>
  323.     </tr>
  324.     <tr>
  325.       <td id="p1"><input name="position" type="radio" value="2" accesskey="f" tabindex="26" id="rb35" />
  326.       <label for="rb35">left</label></td>
  327.       <td id="p2">&nbsp;</td>
  328.       <td><input name="position" type="radio" value="1" accesskey="c" tabindex="27" id="rb36" />
  329.           <label for="rb36">center</label></td>
  330.       <td><input name="position" type="radio" value="0" accesskey="h" tabindex="28" id="rb37" />
  331.           <label for="rb37">right</label></td>
  332.     </tr>
  333.     <tr>
  334.       <td colspan="4"><h3>Text</h3></td>
  335.     </tr>
  336.     <tr>
  337.       <td colspan="4" class="p"><label for="text" class="hide">Text</label>
  338.       <textarea name="text" cols="64" rows="10" id="text" accesskey="x" tabindex="29"></textarea>
  339.       <input name="op" type="hidden" id="op" value="send" />
  340.       <input name="gc" type="hidden" id="gc" value="<?php echo $_GET['gc']?>" /></td>
  341.     </tr>
  342.     <tr>
  343.       <td colspan="4" class="p"><label for="from"></label>
  344.         <label for="from_name">Your name</label>
  345.       <input type="text" name="from_name" id="from_name" />        
  346.       <label for="label">&nbsp;</label>
  347.       <label for="from_mail">Your mail</label>
  348.       <input type="text" name="from_mail" id="from_mail" /></td>
  349.     </tr>
  350.     <tr>
  351.       <td colspan="4" class="p"><label for="to_mail">To mail</label>
  352.       <input type="text" name="to_mail" id="to_mail" /></td>
  353.     </tr>
  354.     <tr>
  355.       <td colspan="4" class="p"><label for="Submit" class="hide">Send greeting card</label>
  356.       <input type="submit" name="Submit" value="Send greeting card" accesskey="s" tabindex="30" id="Submit" /></td>
  357.     </tr>
  358.   </table>
  359. </form>
  360.  
  361. <?php else?>
  362. <p align="center"><a href="<?php echo $_SERVER['PHP_SELF''?op=options&gc=3'?>"><img src="images/small_4.jpg" alt="Flash card 4" width="128" height="96" border="0" /></p>
  363. <p>
  364.   <?php endif?>
  365. </p>
  366. </body>
  367. </html>

Documentation generated on Mon, 18 Dec 2006 00:26:21 +0200 by phpDocumentor 1.3.1