2010-04-04, 05:25:31
My messages are not sent
wrong?
Code:
<?php
////////////////////////////////////////////////////////
// Simple Contact v1.1 for GetSimple 2.X
// Plugin created by internet54 - http://internet54.com/
// Author: David Guerra - david@internet54.com
// Last Edited on March 9th, 2010
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
// EDITABLE OPTIONS
// Your email address
$sc_to = 'bes64@mail.ru';
// Create 3 questions
$q1 = 'áûþöøтõ 4 + 8?';
$q2 = 'áтþûøцð àþÑÂÑÂøø?';
$q3 = 'Üы öøòõü ýð ÃœðрÑÂõ?';
// The answers relative to the questions
$a1 = '12';
$a2 = 'ÃœþÑÂúòð';
$a3 = 'ýõт';
// DO NOT EDIT PAST THIS LINE
////////////////////////////////////////////////////////
# get correct id for plugin
$thisfile = basename(__FILE__, ".php");
# register plugin
register_plugin(
$thisfile, # ID of plugin, should be filename minus php
'Simple Contact', # Title of plugin
'1.1', # Version of plugin
'internet54', # Author of plugin
'http://internet54.com', # Author URL
'This plugin will install a simple contact form into your website.', # Plugin Description
'plugins', # Page type of plugin
'sc_options' # Function that displays content
);
# Creates a menu option on the Admin/Theme sidebar
//add_action('admin-menu','createSideMenu',array($thisfile,'Plugin Gal'));
add_action('plugins-sidebar', 'createSideMenu', array($thisfile, 'ÚþýтðúтýðѠфþрüð'));
/////////////////////////////////////////
// Captcha maker thanks to Brian Nowell for the input
$question_array = array($q1 => $a1, $q2 => $a2, $q3 => $a3);
$qindex = array_rand($question_array);
$sc_captcha_question = $qindex;
$sc_captcha = $question_array[$qindex];
// Show options in plugin page
function sc_options() {
print "<h2>Úðú ÑÂþ÷ôðть фþрüу Ѡúðÿтчõù?</h2>
<p>áþ÷ôðùтõ ÑÂтрðýøцу \"Úþýтðúты\".<br />
<p>Ã’ÑÂтðòьтõ ýøöõ, òышõ øûø òüõÑÂтþ тõúÑÂтð òþт ÑÂтþт úþô: <strong><? if (function_exists('sc_show')) { sc_show(); } ?></strong><br />
Ø òÑÂõ? Ø òÑÂõ...</p>";
}
// PHP mail function
function sc_mail () {
global $successmsg;
global $sc_captcha;
global $sc_to;
$error = 0;
if( isset($_POST['sc_submitted']) ) {
$sc_email = $_POST['sc_email'];
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*" ."@"."([a-z0-9]+([\.-][a-z0-9]+)*)+"."\\.[a-z]{2,}"."$",$sc_email )){
$successmsg = "<div style=\"color:red; text-align:center;\">Invalid email address entered.</div>";
$error = 1;
}
if ( empty($_POST['sc_name']) || empty($_POST['sc_email']) || empty($_POST['sc_subject']) || empty($_POST['sc_message'])) {
$successmsg = "<div style=\"color:red; text-align:center;\">Please fill out all fields.</div>";
$error = 1;
}
if ($_POST['sc_captcha'] != $sc_captcha) {
$successmsg = "<div style=\"color:red; text-align:center;\">Captcha answer incorrect.</div>";
$error = 1;
}
if ($error != 1){
$from = "From: " .$_POST['sc_email'];
$message = "Name: ".$_POST['sc_name'];
$message = $message."\n". "E-mail: ".$_POST['sc_email'];
$message = $message."\n". "Message: ".$_POST['sc_message'];
mail($sc_to, $_POST['sc_subject'], $message, $from);
$successmsg = "<div style=\"color:red; text-align:center;\">Thank you... The form was successfully sent.</div>";
//Clear values
$_POST = array();
}
} else {
$successmsg = "";
}
}
// Form Display
function sc_form () {
global $successmsg;
global $sc_captcha_question;
print '<div id="sc-container">';
print $successmsg;
echo '<form action="" method="post" class="contactform">
<div><b>ØüÑÂ:</b> <input class="text" type="text" value="" name="sc_name" /></div>
<div><b>E-mail:</b> <input class="text" type="text" value="" name="sc_email" /></div>
<div><b>âõüð:</b> <input class="text" type="text" value="" name="sc_subject" /></div>
<div><b>Ã’þÿрþÑÂ:</b> <select name="qwest"><option selected="selected">2222</option><option>333</option></select></div>
<div><b>áþþñщõýøõ:</b> <textarea class="text" name="sc_message" ></textarea></div>
<div><b>Úðÿтчð:</b> '.$sc_captcha_question.'<br /> <input class="text" type="text" value="" name="sc_captcha" /></div>
<div><input type="submit" value="Þтÿрðòøть" id="contact-submit" name="contact-submit" /></div>
<input type="hidden" value="true" name="sc_submitted" />
</form>
</div>';
}
// Run the plugin in the theme
function sc_show() {
global $thisfile;
add_action('content-top', 'sc_mail', array($thisfile, 'Simple Contact'));
add_action('content-bottom', 'sc_form', array($thisfile, 'Simple Contact'));
}
?>
wrong?