PDA

View Full Version : Problem with my contact script.


Fronix
07-07-2008, 03:42 PM
Hey well i have a contact script thats working kinda good but i want 1 thing to change that i dont know how to do. What i want is that you can choose who to email to check http://www.rtgaming.se/viewpage.php?page_id=7
Where is says " Vem vill du prata med? Skriv Fronix eller LiiPoD^:*" under that you can choose Liipod or Fronix i want to make it so if you choose fronix you mail me and if you choose Liipod you mail Liipod.

My Contact.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ansök Formulär</title></head>
<body>
<form method="post" action="http://www.rtgamin.se/Scipts/contactscript/sendeail.php">
<p>
<!-- DO NOT change ANY of the php sections -->
<?php
$ipi = getenv("REMOTE_ADDR");
$httprefi = getenv ("HTTP_REFERER");
$httpagenti = getenv ("HTTP_USER_AGENT");
?>
<input type="hidden" name="ip" value="<?php echo $ipi ?>" />
<input type="hidden" name="httpref" value="<?php echo $httprefi ?>" />
<input type="hidden" name="httpagent" value="<?php echo $httpagenti ?>" />
Ditt Namn: *<br />
<input type="text" name="visitor" size="35" />
<br />
Din Email:*<br />
<input type="text" name="visitormail" size="35" />
<br />
<br />
SteamID:*<br />

<input type="text" name="steamid" size="35" />
<br />
Vem vill du prata med? Skriv Fronix eller Liipod:*<br />
<select name="vem" size="1">
<option value=" HNS " selected="selected">Fronix </option>
<option value=" CS1.6 " selected="selected">Liipod </option>
</select>
<br />
<br />
Hur Lång Hoppar du (Endast för hns clan ansökan):<br />
<input type="text" name="units2" size="35" />
<br />
<br />
<br />
Välj Kategori!:*<br />
<select name="attn" size="1">
<option value=" HNS " selected="selected">Ansöka till HnS Clan </option>
<option value=" CS1.6 " selected="selected">Ansöka till CS 1.6 Clan </option>
<option value=" CSS " selected="selected">Ansöka till CSS Clan </option>
<option value=" Admin Server Ans'o'kan " selected="selected">Ansöka till Server Admin </option>
<option value=" Admin Hemside Ans'o'kan " selected="selected">Ansöka till Hemside Admin </option>
</select>
<br />
<br />
:Berätta om dig själv:*<br />
<textarea name="notes2" rows="4" cols="40"></textarea>
<br />
<br />
Varför ska du bli Admin?? LJUG INTE! (endast för admin ansökan)<br />

<textarea name="notes" rows="4" cols="40"></textarea>
<br />
</p>
</p>
Allt markerat med * måste fyllas i
<p><br />
<input type="submit" value="Skicka Mail" />
<br />
</p>
</form>
</body>
</html>


My Sendeail.php

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html>

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
.style1 {font-size: 18px}
-->
</style>
</head>

<body>



<p>
<!-- Reminder: Add the link for the 'next page' (at the bottom) -->

<!-- Reminder: Change 'YourEmail' to Your real email -->



<?php



$ip = $_POST['ip'];

$httpref = $_POST['httpref'];

$httpagent = $_POST['httpagent'];

$visitor = $_POST['visitor'];

$vem = $_POST['vem'];

$notes2 = $_POST['notes2'];

$units2 = $_POST['units2'];

$steamid = $_POST['steamid'];

$visitormail = $_POST['visitormail'];

$notes = $_POST['notes'];

$attn = $_POST['attn'];





if (eregi('http:', $notes)) {

die ("Do NOT try that! ! ");

}

if(!$visitormail == "" && (!strstr($visitormail,"@") || !strstr($visitormail,".")))
if(!$steamid == "" && (!strstr($steamid,"STEAM_") || !strstr($steamid,".")))

{

echo "<h2>You did not enter a vaild email or steamid!</h2>\n";

$badinput = "<h2>GO BACK!</h2>\n";

echo $badinput;

die ("Go back! ! ");

}



if(empty($visitor) || empty($visitormail) || empty($notes )) {

echo "<h2>Use Back - fill in all fields</h2>\n";

die ("Use back! ! ");

}



$todayis = date("l, F j, Y, g:i a") ;



$attn = $attn ;

$subject = $attn;



$notes = stripcslashes($notes);



$message = " $todayis [EST] \n

Kategori: $attn \n

Om Mig: $notes \n

Varför ska jag bli admin?: $notes2

SteamID: $steamid

Units: $units2

Till: $vem

From: $visitor ($visitormail)\n

Additional Info : IP = $ip \n

Browser Info: $httpagent \n

Referral : $httpref \n

";



$from = "From: $visitormail\r\n";





mail("ansok@rtgaming.se", $subject, $message, $from);



?>
<span class="style1"><strong>Nu är mejlet skickat! </strong></span></p>
<p class="style1"><strong>Vi kommer ta kontakt med dig så snabbt som möjligt</strong></p>
<p class="style1"><strong>Mvh Bloodfury Crew</strong></p>
</body>

</html>

lux
07-07-2008, 05:33 PM
if($vem == ' HNS ')
{
$to = 'email address'
}
elseif($vem == ' CS1.6 ')
{
$to = 'other email address'
}

Fronix
07-07-2008, 05:41 PM
Ah like that i wrote waaay difrent :P

Fronix
07-07-2008, 05:44 PM
But if i put that in i have to change
mail("ansok@rtgaming.se", $subject, $message, $from); right?

to mail("$to", $subject, $message, $from); or am i completley wrong.

davidj
07-07-2008, 05:44 PM
switch($vem){

case 'HNS': $to = 'email address1'; break;

case 'CS1.6': $to = 'email address2'; break;

}

davidj
07-07-2008, 05:45 PM
mail($to, $subject, $message, $from);