Version: 2
Type: Full Script
Category: Other
License: Other
Description: The posted doc is only the functions.php file from the script but it shows most of the functionality’s.
‘phpECard’ is a script with wich you can set up your own personal
e-card gallery. To do so you must follow the installation-guide
and read the configuration-info to learn how to make your own
pictures compatible with ‘phpECard’.
I hope you enjoy this script! Maybe you are able to modify this
script with cool features?
Please post them at: http://quick-xs.net/phpecard
<?php /*************************************************************************** * functions.php script-name: phpECard * * --------------------------------------------------------------------- * * version : 2.0 * * script suport page : http://quick-xs.net/phpecard * * author email : [email protected] * * * *************************************************************************** * * * The complete functionality of the script is defined in this file. * * ANYTHING YOU EDIT HERE CAN PREVENT THE SCRIPT FROM WORKING * * * ***************************************************************************/ // First lets perform some required actions // Function to make links in gallery function makelink($image_name) { global $language; global $PHP_SELF; global $preset_vars; if (file_exists($include_path.'lang_'.$language.'.php')) { $language_preset = 'language='.$language.'&'; } return $PHP_SELF.'?'.$preset_vars.$language_preset.'card='.$image_name; } // Check language, else get default language file [TRYOUT] if (file_exists($include_path.'lang_'.$language.'.php')) { include($include_path.'lang_'.$language.'.php'); } else { include($include_path.'lang_'.$default_language.'.php'); } // Make sure that $action always is "compose" if not "send" if ($action != 'send') { $action = 'compose'; } // function to test email-syntax, used later on function IsEmail($mail) { return ereg("[A-Za-z0-9_-]+([.]{1}[A-Za-z0-9_-]+)*@[A-Za-z0-9-]+([.]{1}[A-Za-z0-9-]+)+", $mail); } // check to see weither an id is defined if ((IsSet($id)) && ($id != '')) { // Check to see if id-datafile is present if(file_exists($include_path.'userdata/'.$id.'.php')) { // Include the datafile and send confirmation back to sender if wanted include($include_path.'userdata/'.$id.'.php'); if ($notify_sender == 'on') { $comeback_url = 'http://'.$_SERVER['SERVER_NAME'].$PHP_SELF; $notify_mail_sender = $lang['dear'].' '.$sender_name.','."nn".$recipient_name.' ('.$recipient_email.')'.$lang['recipient_has_seen']."nn".$lang['please_come_back']."n".$comeback_url."nn".$lang['regards']."nn$service_name (".$admin_email.')'.$add; mail($sender_email,$recipient_name.$lang['notify_sender_subject'],$notify_mail_sender,"From: $service_name<$admin_email>"); $CRD_datafile = '<?php $notify_sender = "off"; $subject = "'.htmlspecialchars($subject).'"; $sender_name = "'.htmlspecialchars($sender_name).'"; $sender_email = "'.$sender_email.'"; $recipient_name = "'.htmlspecialchars($recipient_name).'"; $recipient_email = "'.$recipient_email.'"; $date = "'.$date.'"; $time = "'.$time.'"; $card = "'.$card.'"; $msg = "'.htmlspecialchars(stripslashes($msg)).'"; $index_url = "'.$index_url.'"; ?>'; fwrite(fopen($include_path.'userdata/'.$id.'.php',"w"),$CRD_datafile); } $card_info = $lang['card_to'].' <u>'.$recipient_name.'</u> - '.$lang['sent_at'].' '.$date.', '.$lang['at'].' '.$time.$lang['hour']; $template = 'view'; include($include_path.'template.php'); } // else id is not present else { $template = 'id_error'; include($include_path.'template.php'); } } // So if no id is defined... lets see weither to send or to compose? else { if ($action == 'send') { // Check the variables for IsSet & syntaxis: if ($subject == '') { $error1 = $lang['enter_subject'].'<br><br>'; } if (($msg == '') or ($msg == $lang['type_msg'])) { $error2 = $lang['enter_msg'].'<br><br>'; } if (($sender_name == '') or ($sender_name == $lang['name_here'])) { $error3 = $lang['enter_sender_name'].'<br><br>'; } if ((!IsEmail($sender_email)) or ($sender_email == '')) { $error4 = $lang['enter_sender_email'].'<br><br>'; } if ($recipient_name == '') { $error5 = $lang['enter_recipient_name'].'<br><br>'; } if ((!IsEmail($recipient_email)) or ($recipient_email == '')) { $error6 = $lang['enter_recipient_email'].'<br><br>'; } $error = $error1.$error2.$error3.$error4.$error5.$error6; if ($error == '') { // So the form is submitted and there are no errors // ... now we can save the data and email the recipient $teller = fread(fopen($include_path.'userdata/teller.txt',"r"),4096) + 1; fwrite(fopen($include_path.'userdata/teller.txt',"w+"),$teller); $id = 'CRD'.date("ymdHi").$teller; $CRD_datafile = '<?php $notify_sender = "'.$notify_sender.'"; $subject = "'.htmlspecialchars($subject).'"; $sender_name = "'.htmlspecialchars($sender_name).'"; $sender_email = "'.$sender_email.'"; $recipient_name = "'.htmlspecialchars($recipient_name).'"; $recipient_email = "'.$recipient_email.'"; $date = "'.date("d-m-Y").'"; $time = "'.date("H:i").'"; $card = "'.$card.'"; $msg = "'.htmlspecialchars(stripslashes($msg)).'"; $index_url = "http://'.$_SERVER['SERVER_NAME'].$PHP_SELF.'"; ?>'; fwrite(fopen($include_path.'userdata/'.$id.'.php',"w+"),$CRD_datafile); $notify_mail_recipient = $lang['dear_recipient']."nn".$lang['sender_has_sent']."nn". $lang['get_card_here'] ."n".'http://'.$_SERVER['SERVER_NAME'].$PHP_SELF.'?id='.$id."nn". $lang['time_limit']."nn". $lang['regards'] ."nn$service_name (".$admin_email.')'.$add; mail($recipient_email,$lang['notify_recipient_subject'],$notify_mail_recipient, "From: E-Card service<$admin_email>"); if ($notify_sender == 'off') { $lang['card_viewed_confirm'] = ''; } $template = 'sent'; include($include_path.'template.php'); } // Else if no sending is wanted or if there are errors ... elseif ($error != '') { $action = 'compose'; } } if ($action == 'compose') { if ((!IsSet($card)) or ($card == '')) { // Show gallery include($include_path.'_gallery.php'); } else { // Check input fields for IsSet, if not assign defaults if ((!IsSet($msg)) or ($msg == '')) { $msg_echo = $lang['type_msg']; } else { $msg_echo = $msg; } if ((!IsSet($sender_email)) or ($sender_email == '')) { $sender_email_echo = $lang['email_here']; } else { $sender_email_echo = $sender_email; } if ((!IsSet($sender_name)) or ($sender_name == '')) { $sender_name_echo = $lang['name_here']; } else { $sender_name_echo = $sender_name; } // Include compose-template $template = 'compose'; include($include_path.'template.php'); } } } ?>