Forum » Client-Side scripting » Contact Me.. Mappen Structuur.. Help!
Just An Epic Guy <3
Berichten: 629
avatar
Offline Stuur privebericht
Iemand enig idee waarom dit wel gewoon werkt in de contact map zelf.. maar niet 1map daarbuiten.. in de echte index zelf?
sinds ik alle mappen netjes in die map: contact wil hebben en niet via contact hem wil gebruiken..
het gaat om deze script?

Code | Selecteer Alles
minimaliseren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!-- Contact Form CSS files --> 
<
link type='text/css' href='css/contact.css' rel='stylesheet' media='screen' /> 


        <
div id='contact-form'
            <
input type='button' name='contact' value='contact us' class='contact demo'/> or <a href='#' class='contact'>contact us</a
        </
div



<!-- 
Load JavaScript files --> 
<
script type='text/javascript' src='js/jquery.js'></script> 
<script type='text/javascript' src='js/jquery.simplemodal.js'></script> 
<script type='text/javascript' src='js/contact.js'></script>


om je het beter te laten begrijpen:
hij werkt wel in deze mappen structuur:
uc501/contact/index.php
maar niet in/zo:
uc501/index.php

wat zou ik moeten veranderen hieraan ..want er is niet veel om aan te knutselen lol
ik denk niet dat het aan andere files zou liggen mja..
06-09-2011 01:30
Dit topic is 441 keer bekeken door 66 verschillende leden
Reacties op: "Contact Me.. Mappen Structuur.. Help!"
1 | 2 Volgende pagina
Berichten: 35
avatar
Offline Stuur privébericht
wat werkt er precies niet aan dan?
06-09-2011 15:00
Just An Epic Guy <3
Berichten: 629
avatar
Offline Stuur privébericht
nou kijk als ik de script uitprobeer in; http://milw0rm.nl/uc501/contact/index.php
dan als je op de 'contact us' drukt .. werkt de javascript contact form.. maar als ik dezelfde script gebruik in;
http://milw0rm.nl/uc501/index.php
dan werkt het niet als ik erop druk.. gwn totaal niet.. dus moet ik iets veranderen aan deze script neem ik aan.. maar wat.. sinds de meeste dingen dat ik heb uitgeprobeert niet werkt^^
06-09-2011 20:49
topmaffia.nl
Berichten: 130
avatar
Offline Stuur privébericht
zal wel in het java bestandje staan... een locatie...
effe openen en kijken wat er staat...
06-09-2011 20:54
Just An Epic Guy <3
Berichten: 629
avatar
Offline Stuur privébericht
hmm oke als je dat denkt hier heb je paar files..
contact.php:
Code | Selecteer Alles
minimaliseren
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
<?php

// User settings
$to "admin@milw0rm.nl";
$subject "Contact Form";

// Include extra form fields and/or submitter data?
// false = do not include
$extra = array(
    
"form_subject"    => true,
    
"form_cc"        => true,
    
"ip"            => true,
    
"user_agent"    => true
);

// Process
$action = isset($_POST["action"]) ? $_POST["action"] : "";
if (empty(
$action)) {
    
// Send back the contact form HTML
    
$output "<div style='display:none'>
    <div class='contact-top'></div>
    <div class='contact-content'>
        <h1 class='contact-title'>Send us a message:</h1>
        <div class='contact-loading' style='display:none'></div>
        <div class='contact-message' style='display:none'></div>
        <form action='#' style='display:none'>
            <label for='contact-name'>*Name:</label>
            <input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' />
            <label for='contact-email'>*Email:</label>
            <input type='text' id='contact-email' class='contact-input' name='email' tabindex='1002' />"
;

    if (
$extra["form_subject"]) {
        
$output .= "
            <label for='contact-subject'>Subject:</label>
            <input type='text' id='contact-subject' class='contact-input' name='subject' value='' tabindex='1003' />"
;
    }

    
$output .= "
            <label for='contact-message'>*Message:</label>
            <textarea id='contact-message' class='contact-input' name='message' cols='40' rows='4' tabindex='1004'></textarea>
            <br/>"
;

    if (
$extra["form_cc"]) {
        
$output .= "
            <label>&nbsp;</label>
            <input type='checkbox' id='contact-cc' name='cc' value='1' tabindex='1005' /> <span class='contact-cc'>Send me a copy</span>
            <br/>"
;
    }

    
$output .= "
            <label>&nbsp;</label>
            <button type='submit' class='contact-send contact-button' tabindex='1006'>Send</button>
            <button type='submit' class='contact-cancel contact-button simplemodal-close' tabindex='1007'>Cancel</button>
            <br/>
            <input type='hidden' name='token' value='" 
smcf_token($to) . "'/>
        </form>
    </div>
    <div class='contact-bottom'><b>Dont abuse this feature..</b></div>
</div>"
;

    echo 
$output;
}
else if (
$action == "send") {
    
// Send the email
    
$name = isset($_POST["name"]) ? $_POST["name"] : "";
    
$email = isset($_POST["email"]) ? $_POST["email"] : "";
    
$subject = isset($_POST["subject"]) ? $_POST["subject"] : $subject;
    
$message = isset($_POST["message"]) ? $_POST["message"] : "";
    
$cc = isset($_POST["cc"]) ? $_POST["cc"] : "";
    
$token = isset($_POST["token"]) ? $_POST["token"] : "";

    
// make sure the token matches
    
if ($token === smcf_token($to)) {
        
smcf_send($name$email$subject$message$cc);
        echo 
"Your message was successfully sent.";
    }
    else {
        echo 
"Unfortunately, your message could not be verified.";
    }
}

function 
smcf_token($s) {
    return 
md5("smcf-" $s date("WY"));
}

// Validate and send email
function smcf_send($name$email$subject$message$cc) {
    global 
$to$extra;

    
// Filter and validate fields
    
$name smcf_filter($name);
    
$subject smcf_filter($subject);
    
$email smcf_filter($email);
    if (!
smcf_validate_email($email)) {
        
$subject .= " - invalid email";
        
$message .= "nnBad email: $email";
        
$email $to;
        
$cc 0// do not CC "sender"
    
}

    
// Add additional info to the message
    
if ($extra["ip"]) {
        
$message .= "nnIP: " $_SERVER["REMOTE_ADDR"];
    }
    if (
$extra["user_agent"]) {
        
$message .= "nnUSER AGENT: " $_SERVER["HTTP_USER_AGENT"];
    }

    
// Set and wordwrap message body
    
$body "From: $namenn";
    
$body .= "Message: $message";
    
$body wordwrap($body70);

    
// Build header
    
$headers "From: $emailn";
    if (
$cc == 1) {
        
$headers .= "Cc: $emailn";
    }
    
$headers .= "X-Mailer: PHP/SimpleModalContactForm";

    
// UTF-8
    
if (function_exists('mb_encode_mimeheader')) {
        
$subject mb_encode_mimeheader($subject"UTF-8""B""n");
    }
    else {
        
// you need to enable mb_encode_mimeheader or risk 
        // getting emails that are not UTF-8 encoded
    
}
    
$headers .= "MIME-Version: 1.0n";
    
$headers .= "Content-type: text/plain; charset=utf-8n";
    
$headers .= "Content-Transfer-Encoding: quoted-printablen";

    
// Send email
    
@mail($to$subject$body$headers) or 
        die(
"Unfortunately, a server issue prevented delivery of your message.");
}

// Remove any un-safe values to prevent email injection
function smcf_filter($value) {
    
$pattern = array("/n/","/r/","/content-type:/i","/to:/i""/from:/i""/cc:/i");
    
$value preg_replace($pattern""$value);
    return 
$value;
}

// Validate email address format in case client-side validation "fails"
function smcf_validate_email($email) {
    
$at strrpos($email"@");

    
// Make sure the at (@) sybmol exists and  
    // it is not the first or last character
    
if ($at && ($at || ($at 1) == strlen($email)))
        return 
false;

    
// Make sure there aren't multiple periods together
    
if (preg_match("/(.{2,})/"$email))
        return 
false;

    
// Break up the local and domain portions
    
$local substr($email0$at);
    
$domain substr($email$at 1);


    
// Check lengths
    
$locLen strlen($local);
    
$domLen strlen($domain);
    if (
$locLen || $locLen 64 || $domLen || $domLen 255)
        return 
false;

    
// Make sure local and domain don't start with or end with a period
    
if (preg_match("/(^.|.$)/"$local) || preg_match("/(^.|.$)/"$domain))
        return 
false;

    
// Check for quoted-string addresses
    // Since almost anything is allowed in a quoted-string address,
    // we're just going to let them go through
    
if (!preg_match('/^"(.+)"$/'$local)) {
        
// It's a dot-string address...check for valid characters
        
if (!preg_match('/^[-a-zA-Z0-9!#$%*/?|^{}`~&'+=_.]*$/', $local))
            return false;
    }

    // Make sure domain contains only valid characters and at least one period
    if (!preg_match("/^[-a-zA-Z0-9.]*$/", $domain) || !strpos($domain, "."))
        return false;    

    return true;
}

exit;

?>


en de contact.js:
Code | Selecteer Alles
minimaliseren
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
jQuery(function ($) {
    var 
contact = {
        
messagenull,
        
init: function () {
            $(
'#contact-form input.contact, #contact-form a.contact').click(function (e) {
                
e.preventDefault();

                
// load the contact form using ajax
                
$.get("data/contact.php", function(data){
                    
// create a modal dialog with the data
                    
$(data).modal({
                        
closeHTML"<a href='#' title='Close' class='modal-close'>x</a>",
                        
position: ["15%",],
                        
overlayId'contact-overlay',
                        
containerId'contact-container',
                        
onOpencontact.open,
                        
onShowcontact.show,
                        
onClosecontact.close
                    
});
                });
            });
        },
        
open: function (dialog) {
            
// add padding to the buttons in firefox/mozilla
            
if ($.browser.mozilla) {
                $(
'#contact-container .contact-button').css({
                    
'padding-bottom''2px'
                
});
            }
            
// input field font size
            
if ($.browser.safari) {
                $(
'#contact-container .contact-input').css({
                    
'font-size''.9em'
                
});
            }

            
// dynamically determine height
            
var 280;
            if ($(
'#contact-subject').length) {
                
+= 26;
            }
            if ($(
'#contact-cc').length) {
                
+= 22;
            }

            var 
title = $('#contact-container .contact-title').html();
            $(
'#contact-container .contact-title').html('Loading...');
            
dialog.overlay.fadeIn(200, function () {
                
dialog.container.fadeIn(200, function () {
                    
dialog.data.fadeIn(200, function () {
                        $(
'#contact-container .contact-content').animate({
                            
heighth
                        
}, function () {
                            $(
'#contact-container .contact-title').html(title);
                            $(
'#contact-container form').fadeIn(200, function () {
                                $(
'#contact-container #contact-name').focus();

                                $(
'#contact-container .contact-cc').click(function () {
                                    var 
cc = $('#contact-container #contact-cc');
                                    
cc.is(':checked') ? cc.attr('checked''') : cc.attr('checked''checked');
                                });

                                
// fix png's for IE 6
                                
if ($.browser.msie && $.browser.version 7) {
                                    $(
'#contact-container .contact-button').each(function () {
                                        if ($(
this).css('backgroundImage').match(/^url[("']+(.*.png)[)"']+$/i)) {
                                            var src = RegExp.$1;
                                            $(this).css({
                                                backgroundImage: '
none',
                                                filter: '
progid:DXImageTransform.Microsoft.AlphaImageLoader(src="' +  src + '"sizingMethod="crop")'
                                            });
                                        }
                                    });
                                }
                            });
                        });
                    });
                });
            });
        },
        show: function (dialog) {
            $('
#contact-container .contact-send').click(function (e) {
                
e.preventDefault();
                
// validate form
                
if (contact.validate()) {
                    var 
msg = $('#contact-container .contact-message');
                    
msg.fadeOut(function () {
                        
msg.removeClass('contact-error').empty();
                    });
                    $(
'#contact-container .contact-title').html('Sending...');
                    $(
'#contact-container form').fadeOut(200);
                    $(
'#contact-container .contact-content').animate({
                        
height'80px'
                    
}, function () {
                        $(
'#contact-container .contact-loading').fadeIn(200, function () {
                            $.
ajax({
                                
url'data/contact.php',
                                
data: $('#contact-container form').serialize() + '&action=send',
                                
type'post',
                                
cachefalse,
                                
dataType'html',
                                
success: function (data) {
                                    $(
'#contact-container .contact-loading').fadeOut(200, function () {
                                        $(
'#contact-container .contact-title').html('Thank you!');
                                        
msg.html(data).fadeIn(200);
                                    });
                                },
                                
errorcontact.error
                            
});
                        });
                    });
                }
                else {
                    if ($(
'#contact-container .contact-message:visible').length 0) {
                        var 
msg = $('#contact-container .contact-message div');
                        
msg.fadeOut(200, function () {
                            
msg.empty();
                            
contact.showError();
                            
msg.fadeIn(200);
                        });
                    }
                    else {
                        $(
'#contact-container .contact-message').animate({
                            
height'30px'
                        
}, contact.showError);
                    }
                    
                }
            });
        },
        
close: function (dialog) {
            $(
'#contact-container .contact-message').fadeOut();
            $(
'#contact-container .contact-title').html('Goodbye...');
            $(
'#contact-container form').fadeOut(200);
            $(
'#contact-container .contact-content').animate({
                
height40
            
}, function () {
                
dialog.data.fadeOut(200, function () {
                    
dialog.container.fadeOut(200, function () {
                        
dialog.overlay.fadeOut(200, function () {
                            $.
modal.close();
                        });
                    });
                });
            });
        },
        
error: function (xhr) {
            
alert(xhr.statusText);
        },
        
validate: function () {
            
contact.message '';
            if (!$(
'#contact-container #contact-name').val()) {
                
contact.message += 'Name is required. ';
            }

            var 
email = $('#contact-container #contact-email').val();
            if (!
email) {
                
contact.message += 'Email is required. ';
            }
            else {
                if (!
contact.validateEmail(email)) {
                    
contact.message += 'Email is invalid. ';
                }
            }

            if (!$(
'#contact-container #contact-message').val()) {
                
contact.message += 'Message is required.';
            }

            if (
contact.message.length 0) {
                return 
false;
            }
            else {
                return 
true;
            }
        },
        
validateEmail: function (email) {
            var 
at email.lastIndexOf("@");

            
// Make sure the at (@) sybmol exists and  
            // it is not the first or last character
            
if (at || (at 1) === email.length)
                return 
false;

            
// Make sure there aren't multiple periods together
            
if (/(.{2,})/.test(email))
                return 
false;

            
// Break up the local and domain portions
            
var local email.substring(0at);
            var 
domain email.substring(at 1);

            
// Check lengths
            
if (local.length || local.length 64 || domain.length || domain.length 255)
                return 
false;

            
// Make sure local and domain don't start with or end with a period
            
if (/(^.|.$)/.test(local) || /(^.|.$)/.test(domain))
                return 
false;

            
// Check for quoted-string addresses
            // Since almost anything is allowed in a quoted-string address,
            // we're just going to let them go through
            
if (!/^"(.+)"$/.test(local)) {
                
// It's a dot-string address...check for valid characters
                
if (!/^[-a-zA-Z0-9!#$%*/?|^{}`~&'+=_.]*$/.test(local))
                    
return false;
            }

            
// Make sure domain contains only valid characters and at least one period
            
if (!/^[-a-zA-Z0-9.]*$/.test(domain) || domain.indexOf(".") === -1)
                return 
false;    

            return 
true;
        },
        
showError: function () {
            $(
'#contact-container .contact-message')
                .
html($('<div class="contact-error"></div>').append(contact.message))
                .
fadeIn(200);
        }
    };

    
contact.init();

});


en nog 2 andere jquery '.js' bestanden...
07-09-2011 00:59
Rapifia Europe
Berichten: 3716
avatar
Online Stuur privébericht
Bump op aanvraag van TS.
09-09-2011 23:33
Berichten: 370
avatar
Offline Stuur privébericht
Heeft daar volgens mij niks mee te maken.Meestals moet je dan dit van maken waar je hem in je index hebt staan of iets degelijks

../index.php

Ik weet niet of dit hier werkt maar bij meeste site werkt dat
10-09-2011 00:56
Rapifia Europe
Berichten: 3716
avatar
Online Stuur privébericht
Of er werkt iets tegen het script, zoals een jQuery UI Dialog e.d.
10-09-2011 09:59
Pim
Love Me Two Times
Berichten: 2341
avatar
Offline Stuur privébericht
Waar staat je mapje js en css?

Probeer zo eens bij beide locaties:
Code | Selecteer Alles
minimaliseren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!-- Contact Form CSS files --> 
<
link type='text/css' href='./css/contact.css' rel='stylesheet' media='screen' /> 


        <
div id='contact-form'
            <
input type='button' name='contact' value='contact us' class='contact demo'/> or <a href='#' class='contact'>contact us</a
        </
div



<!-- 
Load JavaScript files --> 
<
script type='text/javascript' src='./js/jquery.js'></script> 
<script type='text/javascript' src='./js/jquery.simplemodal.js'></script> 
<script type='text/javascript' src='./js/contact.js'></script>


Oftewel enkel bij de niet-contactmap zo:
Code | Selecteer Alles
minimaliseren
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!-- Contact Form CSS files --> 
<
link type='text/css' href='contact/css/contact.css' rel='stylesheet' media='screen' /> 


        <
div id='contact-form'
            <
input type='button' name='contact' value='contact us' class='contact demo'/> or <a href='#' class='contact'>contact us</a
        </
div



<!-- 
Load JavaScript files --> 
<
script type='text/javascript' src='contact/js/jquery.js'></script> 
<script type='text/javascript' src='contact/js/jquery.simplemodal.js'></script> 
<script type='text/javascript' src='contact/js/contact.js'></script>
10-09-2011 12:55
Just An Epic Guy <3
Berichten: 629
avatar
Offline Stuur privébericht
Quote: Pim

Waar staat je mapje js en css?

Probeer zo eens bij beide locaties:

Code | Selecteer Alles
minimaliseren
1
..


Oftewel enkel bij de niet-contactmap zo:
Code | Selecteer Alles
minimaliseren
1
..



werkt ook niet

dit zijn alle files:
contact/css/contact.css

contact/data/contact.php

contact/img/contact/loading.gif

contact/js/contact.js
contact/js/jquery.js
contact/js/jquery.simplemodal.js
-

contact/index.html ( <-- werkt wel)

-

index.php ( <-- werkt niet)

Quote: L.Groot

Of er werkt iets tegen het script, zoals een jQuery UI Dialog e.d.



de script van hierboven verzend de data toch gelijk naar die contact map enzo .. als het goed is.. en dan zou die netzo goed moeten werken als dat ik het probeer in de contact map zelf.. ik heb ook nog allemaal andere bestanden naast die index.php maar ik denk niet dat.. dat invloed erop heeft^^

ik zou eventueel iemand wel de js contact-form kunnen geven.. dat die gene het volledig kan uittesten.. idc?
10-09-2011 15:04
Berichten: 605
avatar
Offline Stuur privébericht
Ja dat kan geen slecht idee ..
12-09-2011 15:17
Reageer op: "Contact Me.. Mappen Structuur.. Help!"
1 | 2 Volgende pagina
Je kan niet reageren omdat je niet bent ingelogd. Inloggen of Aanmelden