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

example

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

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