login  Naam:   Wachtwoord: 
Registreer je!
 Scripts:

Scripts > PHP > Contact formulieren > phpECard v2.0

phpECard v2.0

Auteur: phpECard - 28 september 2005 - 17:34 - Gekeurd door: Maarten - Hits: 5313 - Aantal punten: 2.25 (2 stemmen)




phpECard is een script waarmee je je eigen e-card systeem op je website kunt installeren, het script is tevens mekkelijk te includen in uw eigen site-layout!!

Ik kan hier onmogelijk het hele script posten omdat het ut meerdere bestanden en images bestaat maar ik heb phpECard-v2.0.zip als bijlage toegevoegd. Je kunt ook naar http://www.quick-xs.net/phpecard surfen om de laatste versie te downloaden...

Mogelijkheden:
- Stap-voor-stap installatie handleiding
- Eigen afbeeldingen toevoegen
- Meertalige ondersteuning
- Includen of direct aanroepen
- Controle op input-velden
- htmlspecialchars(); in bericht
- Stylesheet gebruiken
- Basis stijl-opties
- Forum-support

Op http://www.quick-xs.net/phpecard kun je altijd de laatste versie downloaden en krijg je suport van de maker(s) van het script en van andere gebruikers.

Code:
  1. <?php
  2. /***************************************************************************
  3.  * functions.php script-name: phpECard *
  4.  * --------------------------------------------------------------------- *
  5.  * version : 2.0 *
  6.  * script suport page : http://quick-xs.net/phpecard *
  7.  * author email : phpecard@quickxs.net *
  8.  * *
  9.  ***************************************************************************
  10.  * *
  11.  * The complete functionality of the script is defined in this file. *
  12.  * ANYTHING YOU EDIT HERE CAN PREVENT THE SCRIPT FROM WORKING *
  13.  * *
  14.  ***************************************************************************/
  15.  
  16. // First lets perform some required actions
  17.  
  18. // Function to make links in gallery
  19. function makelink($image_name)
  20. {
  21. global $language;
  22.  
  23. global $PHP_SELF;
  24.  
  25. global $preset_vars;
  26.  
  27. if (file_exists($include_path.'lang_'.$language.'.php'))
  28. {
  29. $language_preset = 'language='.$language.'&';
  30. }
  31.  
  32. return $PHP_SELF.'?'.$preset_vars.$language_preset.'card='.$image_name;
  33. }
  34.  
  35.  
  36. // Check language, else get default language file [TRYOUT]
  37. if (file_exists($include_path.'lang_'.$language.'.php'))
  38. {
  39. include($include_path.'lang_'.$language.'.php');
  40. }
  41. else
  42. {
  43. include($include_path.'lang_'.$default_language.'.php');
  44. }
  45.  
  46.  
  47. // Make sure that $action always is "compose" if not "send"
  48. if ($action != 'send')
  49. {
  50. $action = 'compose';
  51. }
  52.  
  53.  
  54. // function to test email-syntax, used later on
  55. function IsEmail($mail)
  56. {
  57. return ereg("[A-Za-z0-9_-]+([\.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([\.]{1}[A-Za-z0-9-]+)+", $mail);
  58. }
  59.  
  60.  
  61. // check to see weither an id is defined
  62. if ((IsSet($id)) && ($id != ''))
  63. {
  64. // Check to see if id-datafile is present
  65. if(file_exists($include_path.'userdata/'.$id.'.php'))
  66. {
  67. // Include the datafile and send confirmation back to sender if wanted
  68. include($include_path.'userdata/'.$id.'.php');
  69.  
  70. if ($notify_sender == 'on')
  71. {
  72. $comeback_url = 'http://'.$_SERVER['SERVER_NAME'].$PHP_SELF;
  73.  
  74. $notify_mail_sender = $lang['dear'].' '.$sender_name.','."\n\n".$recipient_name.' ('.$recipient_email.')'.$lang['recipient_has_seen']."\n\n".$lang['please_come_back']."\n".$comeback_url."\n\n".$lang['regards']."\n\n$service_name (".$admin_email.')'.$add;
  75.  
  76. mail($sender_email,$recipient_name.$lang['notify_sender_subject'],$notify_mail_sender,"From: $service_name<$admin_email>");
  77.  
  78. $CRD_datafile =
  79. '<?php
  80. $notify_sender = "off";
  81. $subject = "'.htmlspecialchars($subject).'";
  82. $sender_name = "'.htmlspecialchars($sender_name).'";
  83. $sender_email = "'.$sender_email.'";
  84. $recipient_name = "'.htmlspecialchars($recipient_name).'";
  85. $recipient_email = "'.$recipient_email.'";
  86. $date = "'.$date.'";
  87. $time = "'.$time.'";
  88. $card = "'.$card.'";
  89. $msg = "'.htmlspecialchars(stripslashes($msg)).'";
  90. $index_url = "'.$index_url.'";
  91. ?>';
  92.  
  93. fwrite(fopen($include_path.'userdata/'.$id.'.php',"w"),$CRD_datafile);
  94. }
  95.  
  96. $card_info = $lang['card_to'].' <u>'.$recipient_name.'</u> - '.$lang['sent_at'].' '.$date.', '.$lang['at'].' '.$time.$lang['hour'];
  97.  
  98. $template = 'view';
  99.  
  100. include($include_path.'template.php');
  101. }
  102.  
  103. // else id is not present
  104. else
  105. {
  106. $template = 'id_error';
  107.  
  108. include($include_path.'template.php');
  109. }
  110.  
  111. }
  112.  
  113. // So if no id is defined... lets see weither to send or to compose?
  114. else
  115. {
  116. if ($action == 'send')
  117. {
  118. // Check the variables for IsSet & syntaxis:
  119. if ($subject == '')
  120. {
  121. $error1 = $lang['enter_subject'].'<br><br>';
  122. }
  123.  
  124. if (($msg == '') or ($msg == $lang['type_msg']))
  125. {
  126. $error2 = $lang['enter_msg'].'<br><br>';
  127. }
  128.  
  129. if (($sender_name == '') or ($sender_name == $lang['name_here']))
  130. {
  131. $error3 = $lang['enter_sender_name'].'<br><br>';
  132. }
  133.  
  134. if ((!IsEmail($sender_email)) or ($sender_email == ''))
  135. {
  136. $error4 = $lang['enter_sender_email'].'<br><br>';
  137. }
  138.  
  139. if ($recipient_name == '')
  140. {
  141. $error5 = $lang['enter_recipient_name'].'<br><br>';
  142. }
  143.  
  144. if ((!IsEmail($recipient_email)) or ($recipient_email == ''))
  145. {
  146. $error6 = $lang['enter_recipient_email'].'<br><br>';
  147. }
  148.  
  149. $error = $error1.$error2.$error3.$error4.$error5.$error6;
  150.  
  151. if ($error == '')
  152. {
  153. // So the form is submitted and there are no errors
  154. // ... now we can save the data and email the recipient
  155.  
  156. $teller = fread(fopen($include_path.'userdata/teller.txt',"r"),4096) + 1;
  157.  
  158. fwrite(fopen($include_path.'userdata/teller.txt',"w+"),$teller);
  159.  
  160. $id = 'CRD'.date("ymdHi").$teller;
  161.  
  162. $CRD_datafile =
  163. '<?php
  164. $notify_sender = "'.$notify_sender.'";
  165. $subject = "'.htmlspecialchars($subject).'";
  166. $sender_name = "'.htmlspecialchars($sender_name).'";
  167. $sender_email = "'.$sender_email.'";
  168. $recipient_name = "'.htmlspecialchars($recipient_name).'";
  169. $recipient_email = "'.$recipient_email.'";
  170. $date = "'.date("d-m-Y").'";
  171. $time = "'.date("H:i").'";
  172. $card = "'.$card.'";
  173. $msg = "'.htmlspecialchars(stripslashes($msg)).'";
  174. $index_url = "http://'.$_SERVER['SERVER_NAME'].$PHP_SELF.'";
  175. ?>';
  176.  
  177. fwrite(fopen($include_path.'userdata/'.$id.'.php',"w+"),$CRD_datafile);
  178.  
  179. $notify_mail_recipient = $lang['dear_recipient']."\n\n".$lang['sender_has_sent']."\n\n". $lang['get_card_here'] ."\n".'http://'.$_SERVER['SERVER_NAME'].$PHP_SELF.'?id='.$id."\n\n". $lang['time_limit']."\n\n". $lang['regards'] ."\n\n$service_name (".$admin_email.')'.$add;
  180.  
  181. mail($recipient_email,$lang['notify_recipient_subject'],$notify_mail_recipient, "From: E-Card service<$admin_email>");
  182.  
  183. if ($notify_sender == 'off')
  184. {
  185. $lang['card_viewed_confirm'] = '';
  186. }
  187.  
  188. $template = 'sent';
  189.  
  190. include($include_path.'template.php');
  191. }
  192.  
  193. // Else if no sending is wanted or if there are errors ...
  194. elseif ($error != '')
  195. {
  196. $action = 'compose';
  197. }
  198.  
  199. }
  200.  
  201. if ($action == 'compose')
  202. {
  203. if ((!IsSet($card)) or ($card == ''))
  204. {
  205. // Show gallery
  206. include($include_path.'_gallery.php');
  207. }
  208.  
  209. else
  210. {
  211. // Check input fields for IsSet, if not assign defaults
  212. if ((!IsSet($msg)) or ($msg == ''))
  213. {
  214. $msg_echo = $lang['type_msg'];
  215. }
  216.  
  217. else
  218. {
  219. $msg_echo = $msg;
  220. }
  221.  
  222. if ((!IsSet($sender_email)) or ($sender_email == ''))
  223. {
  224. $sender_email_echo = $lang['email_here'];
  225. }
  226.  
  227. else
  228. {
  229. $sender_email_echo = $sender_email;
  230. }
  231.  
  232. if ((!IsSet($sender_name)) or ($sender_name == ''))
  233. {
  234. $sender_name_echo = $lang['name_here'];
  235. }
  236.  
  237. else
  238. {
  239. $sender_name_echo = $sender_name;
  240. }
  241.  
  242. // Include compose-template
  243.  
  244. $template = 'compose';
  245.  
  246. include($include_path.'template.php');
  247. }
  248.  
  249. }
  250.  
  251. }
  252.  
  253. ?>
Download code! Download code (.txt)

 Bekijk een voorbeeld van dit script!
 Stemmen
Niet ingelogd.

 Reacties
Post een reactie
Lees de reacties (2)
© 2002-2024 Sitemasters.be - Regels - Laadtijd: 0.041s