check_captcha($_POST['captcha'], $_POST['captcha_hash'])) {
$error="The security code was wrong!";
die('ERROR: '.$error.'
');
}
if(!(strlen(trim($opponent)))) {
$error="you forgot to enter your clanname!";
die('ERROR: '.$error.'
');
}
if(!(strlen(trim($league)))) {
$error="you forgot to enter a league!";
die('ERROR: '.$error.'
');
}
if(!(strlen(trim($map)))) {
$error="you forgot to enter a map!";
die('ERROR: '.$error.'
');
}
if(!(strlen(trim($server)))) {
$error="you forgot to enter a server!";
die('ERROR: '.$error.'
');
}
$sem = '^[a-z0-9_\.-]+@[a-z0-9_-]+\.[a-z0-9_\.-]+$';
if(!(eregi($sem, $email))) {
$error="your e-mail is not valid!";
die('ERROR: '.$error.'
');
}
$sem = '^[http://]+[a-z0-9_\.-]+[a-z0-9_-]+$';
if(!(eregi($sem, $opphp))) {
$error="your homepage is not a valid url!";
die('ERROR: '.$error.'
');
}
$date=time();
$cwdate=mktime($hour,$minute,0,$month,$day,$year);
safe_query("INSERT INTO ".PREFIX."challenge ( date, cwdate, squadID, opponent, opphp, oppcountry, league, map, server, email, info)
values( '$date', '$cwdate', '$squad', '$opponent', '$opphp', '$oppcountry', '$league', '$map', '$server', '$email', '$info' ) ");
$ergebnis=safe_query("SELECT userID FROM ".PREFIX."squads_members WHERE warmember='1' AND squadID='".$squad."'");
while($ds=mysql_fetch_array($ergebnis)) {
$touser[]=$ds[userID];
}
if($touser[0] != "") {
$date = time();
$message = '[b]There is a new challenge entry![/b]\n\n Click here: [URL]index.php?site=challenge[/URL]';
foreach($touser as $id) {
safe_query("INSERT INTO ".PREFIX."messenger (userID, date, fromuser, touser, title, message, viewed)
values('$id', '$date', '1', '$id', 'Fight us', '".$message."', '0')"); // eintrag für empfänger
safe_query("UPDATE ".PREFIX."user SET pmgot=pmgot+1 WHERE userID='$id'");
}
}
redirect('index.php?site=challenge', 'thank you for your entry.');
}
elseif($action=="delete") {
$chID = $_GET['chID'];
if(isclanwaradmin($userID)) {
safe_query("DELETE FROM ".PREFIX."challenge WHERE chID='$chID'");
redirect('index.php?site=challenge', 'the entry has been deleted.');
}
else redirect('index.php?site=challenge', 'no access!');
}
else {
echo'