Autorius Tema: Js email form on coords  (Skaityti 271 kartai)

marvel

  • HEROJUS
  • Žinutės: 530
  • Karma: +7/-2
  • Wade can fly

  • Aktyvumas per 30d.
    100%
Re: Js email form on coords
« Atsakyti #15 : Kovo 02, 2010, 07:46:31 »
<?php


/*
 * SimpleModal Contact Form
 * http://www.ericmmartin.com/projects/simplemodal/
 * http://code.google.com/p/simplemodal/
 *
 * Copyright (c) 2009 Eric Martin - http://ericmmartin.com
 *
 * Licensed under the MIT license:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Revision: $Id: contact-dist.php 204 2009-06-09 22:43:28Z emartin24 $
 *
 */

// User settings
$to "wyg4nt4s@creature.lt";


// 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'>Siųsti man žinutę:</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'>*Vardas:</label>
<input type='text' id='contact-name' class='contact-input' name='name' tabindex='1001' />
<label for='contact-email'>*E-mail:</label>
<input type='text' value='wyg4nt4s@creature.lt'
                onblur='on_blur(this.id,'wyg4nt4s@creature.lt')' id='contact-email' class='contact-input' name='email' tabindex='1002' />"
;

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

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

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

$output .= "
<label> </label>
<button type='submit' class='contact-send contact-button' tabindex='1006'>Siųsti</button>
<button type='reset' class='contact-cancel contact-button' tabindex='1007'>Atstatyti</button>
<br/>
<input type='hidden' name='token' value='" 
smcf_token($to) . "'/>
</form>
</div>
<div class='contact-bottom'></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 "<p>Jūsų žinutė sėkmingai išsiųsta.</p>";
}
else {
echo "<p>Gali būtų, kad jūsų žinutė nebus patvirtinta.</p>";
}
}

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 .= " - Neteisingas E-mail";
$message .= "\n\nBad email: $email";
$email $to;
$cc 0// do not CC "sender"
}

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

// Set and wordwrap message body
$body "Iš: $name\n\n";
$body .= "Žinutė: $message";
$body wordwrap($body70);

// Build header
$headers "Iš: $email\n";
if ($cc == 1) {
$headers .= "Cc: $email\n";
}
$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.0\n";
$headers .= "Content-type: text/plain; charset=utf-8\n";
$headers .= "Content-Transfer-Encoding: quoted-printable\n";

// 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;

?>

CIa contact.php

marvel

  • HEROJUS
  • Žinutės: 530
  • Karma: +7/-2
  • Wade can fly

  • Aktyvumas per 30d.
    100%
Re: Js email form on coords
« Atsakyti #16 : Kovo 03, 2010, 09:05:58 »
Tai niekas nezinot ?? blyn tai kaip daryt  yra dvi problemos del ko neweikia, del to kad index.php  failas ir kad yra uzdeta ant koordinaciu. Gal kaip nors su iframe imanoma nukreipt, nu kaip nors nu :)

primatas

  • Administratorius
  • HEROJUS
  • Žinutės: 1945
  • Karma: +66/-5

  • Aktyvumas per 30d.
    100%
Re: Js email form on coords
« Atsakyti #17 : Kovo 04, 2010, 09:40:38 »
tavo ta forma labai jau savotiska, tu ja krauni kazkaip per js, kiek supratau, o joje viskas padaryta display none ir dar tas display:none sudeliotas labai jau atmestinai ir nelabai logiskai, tiesa pasakius. ka tu nori tiksliai padaryti? kam tas exit; ant galo? zodziu keistas man tas kodas, nesuprantu ko tu is jo nori tiksliai, kaip ji iskvieti, is kur, per ka.
Jūsų draugas, kolega ir puslapio administratorius,

Primatas.

p.s. klausimus rašykit i forumus, ne pm
Jums patinka manualai.lt projektas?
serveriai.lt 30% nuolaida!

marvel

  • HEROJUS
  • Žinutės: 530
  • Karma: +7/-2
  • Wade can fly

  • Aktyvumas per 30d.
    100%
Re: Js email form on coords
« Atsakyti #18 : Kovo 04, 2010, 11:50:35 »
TAigi as noriu kad uzejus ant tos koorinates man ismestu ta email forma tokia kaip jusu tam saite wrt  tai vat ko as noriu bet issiaiskinau dvi problemas del kuriu neveikia tai ir klausiu kaip man daryt :)

primatas

  • Administratorius
  • HEROJUS
  • Žinutės: 1945
  • Karma: +66/-5

  • Aktyvumas per 30d.
    100%
Re: Js email form on coords
« Atsakyti #19 : Kovo 04, 2010, 10:04:28 »
wrt saite yra div'as jame yra ta forma visada, jos css'as rya display:none; per js ir css jos pozicija yra tiesiai per viduri, z-index: didenis uz kitu elementu zindex'a. zooodziu nesiulau daryt kaip wrt, geriau parisiusk koki jquery plugina, kuris daro iframe'us shadowbox'e arba lightbox'e ir tuo pasinaudok ;]
Jūsų draugas, kolega ir puslapio administratorius,

Primatas.

p.s. klausimus rašykit i forumus, ne pm
Jums patinka manualai.lt projektas?
serveriai.lt 30% nuolaida!