phpecard-v20

Gesponsorde koppelingen

PHP script bestanden

  1. phpecard-v20

« Lees de omschrijving en reacties

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
<?php
/***************************************************************************
 *  functions.php                                   script-name: phpECard  *
 *  ---------------------------------------------------------------------  *
 *  version                  : 2.0                                         *
 *  script suport page       : http://quick-xs.net/phpecard                *
 *  author email             : [email protected]                        *
 *                                                                         *
 ***************************************************************************
 *                                                                         *
 *  THIS SCRIPT IS INCOMPLETE. Download @ http://quick-xs.net/phpecard     *
 *                                                                         *
 ***************************************************************************/

// First lets perform som 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.','."\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;

            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']."\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;

            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');
        }

    }

}


?>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.