flemingmike Posted March 30, 2009 Share Posted March 30, 2009 hi, im wondering if i have made a mistake in this script, as its not taking affect. here is my script <SCRIPT language='JavaScript'> function checkamount() { with (document.challenge) { login[points].value = points.value; if (points.value=='') { alert('You have not filled in an amount to deposit '); points.focus(); return false; } if (isNaN(amount.value)) { alert('Deposit Amount must be a number '); points.focus(); return false; } if (parseInt(amount.value)<20) { alert('Minimum Deposit is $ 20.00 '); points.focus(); return false; } } return true; } </SCRIPT> and here is a bit of my code that the script is checking. <table width='70%' border='0' cellspacing='1' cellpadding='1' bgcolor='#00000'> <form method='post'> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='center' align='left' colspan='2' background='$config[bg]'> <strong>Challenge</strong> </td> </tr> <tr bgcolor='$config[altcolora]'> <td width='40%' valign='center' align='left' background='$config[cellbg]'>Game</td> <td width='60%' valign='center' align='center' background='$config[cellbg]'> <select class='button' name='login[id]' value='$login[id]'>"; $teams=mysql_query("SELECT teamid,ladderid FROM membersteams WHERE memberid='{$_COOKIE['tid']}' "); while(list($teamid,$ladderid1)=mysql_fetch_row($teams)){ $name=mysql_query("SELECT name FROM teams WHERE id='$teamid'"); $name=mysql_fetch_array($name); $fam=mysql_query("SELECT name FROM ladders WHERE id=$ladderid1"); while(list($ladname1)=mysql_fetch_row($fam)){ $out[body].="<option value='$teamid'>$ladname1</option>\n"; }} $out[body].="</select> </td> </tr> <tr> <td width='40%' valign='center' align='left' background='$config[cellbg]'>Challenge Amount</td> <td width='60%' valign='center' align='center' background='$config[cellbg]'> $ <input type='text' name='login[points]' value='$login[points]' class='input' size='5' maxlength='10'> +10% </td> </tr> <tr bgcolor='$config[altcolorb]'> <td width='40%' valign='center' align='left' background='$config[cellbg2]'>Opponents ID</td> <td width='60%' valign='center' align='center' background='$config[cellbg2]'><input type='text' name='login[cid]' class='input' value='$login[cid]' size='25' maxlength='10'></td> </tr> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='top' align='right' colspan='2' background='$config[cellbg]'> <input type='hidden' name='login[failchallenge]' value='1'> <input type='hidden' name='action' value='challenge'> <input type='submit' name='submit' class='button' value='Challenge >>'></td> </form> </tr> </table> </center><br /><br /><br /><br />"; include("$config[html]"); exit; } any help is appreciated. thanks Quote Link to comment Share on other sites More sharing options...
Silverado_NL Posted March 30, 2009 Share Posted March 30, 2009 if this code page is the whole page, you are missing php tags <?php and ?> to start your php. and u are also missing echo statements for outputting the html. might be that u left em out to keep the posted code short, if not this might be your problem. <?php echo "<table width='70%' border='0' cellspacing='1' cellpadding='1' bgcolor='#00000'> <form method='post'> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='center' align='left' colspan='2' background='$config[bg]'> <strong>Challenge</strong> </td> </tr> <tr bgcolor='$config[altcolora]'> <td width='40%' valign='center' align='left' background='$config[cellbg]'>Game</td> <td width='60%' valign='center' align='center' background='$config[cellbg]'> <select class='button' name='login[id]' value='$login[id]'>"; $teams=mysql_query("SELECT teamid,ladderid FROM membersteams WHERE memberid='{$_COOKIE['tid']}' "); ... ... ?> Quote Link to comment Share on other sites More sharing options...
flemingmike Posted March 30, 2009 Author Share Posted March 30, 2009 no, that was just the table where the script to check the values is suposed to check. here is my whole script (below) i need to add in a check to ensure 'login[points]' is a number and the number is greter than 20 <?PHP include("./includes/incglobal.php"); switch($action){ case "challenge": start_challenge($login); break; default: check_login($login); break; } function check_login($login){ global $config; $login[cid] = str_replace ('\'', ''', $login[cid]); if(!mysql_num_rows(mysql_query("SELECT id FROM members WHERE name='{$_COOKIE['user']}' AND password='{$_COOKIE['pass']}'"))){ $out[body].="<br /> <center> <table width='90%' border='0' cellspacing='1' cellpadding='1' bgcolor='#00000'> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='center' align='left' colspan='2' background='$config[bg]'> <strong>Challenge</strong> </td> </tr> <tr bgcolor='$config[altcolorb]'> <td width='100%' valign='center' align='left'><center> <b>You must be logged in to view this page!<br /> [<a href='./login.php'>Login</a>] [<a href='./register.php'>Register</a>]</center></td></tr> </table></center><br /><br /><br /><br />"; include("$config[html]"); exit; } $out[body].="<br /> <center> <table width='70%' border='0' cellspacing='1' cellpadding='1' bgcolor='#00000'> <form method='post'> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='center' align='left' colspan='2' background='$config[bg]'> <strong>Challenge</strong> </td> </tr> <tr bgcolor='$config[altcolora]'> <td width='40%' valign='center' align='left' background='$config[cellbg]'>Game</td> <td width='60%' valign='center' align='center' background='$config[cellbg]'> <select class='button' name='login[id]' value='$login[id]'>"; $teams=mysql_query("SELECT teamid,ladderid FROM membersteams WHERE memberid='{$_COOKIE['tid']}' "); while(list($teamid,$ladderid1)=mysql_fetch_row($teams)){ $name=mysql_query("SELECT name FROM teams WHERE id='$teamid'"); $name=mysql_fetch_array($name); $fam=mysql_query("SELECT name FROM ladders WHERE id=$ladderid1"); while(list($ladname1)=mysql_fetch_row($fam)){ $out[body].="<option value='$teamid'>$ladname1</option>\n"; }} $out[body].="</select> </td> </tr> <tr> <td width='40%' valign='center' align='left' background='$config[cellbg]'>Challenge Amount</td> <td width='60%' valign='center' align='center' background='$config[cellbg]'> $ <input type='text' name='login[points]' value='$login[points]' class='input' size='5' maxlength='10'> +10% </td> </tr> <tr bgcolor='$config[altcolorb]'> <td width='40%' valign='center' align='left' background='$config[cellbg2]'>Opponents ID</td> <td width='60%' valign='center' align='center' background='$config[cellbg2]'><input type='text' name='login[cid]' class='input' value='$login[cid]' size='25' maxlength='10'></td> </tr> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='top' align='right' colspan='2' background='$config[cellbg]'> <input type='hidden' name='login[failchallenge]' value='1'> <input type='hidden' name='action' value='challenge'> <input type='submit' name='submit' class='button' value='Challenge >>'></td> </form> </tr> </table> </center><br /><br /><br /><br />"; include("$config[html]"); exit; } function start_challenge($login){ global $config; $check=mysql_query("SELECT position FROM membersteams WHERE memberid='{$_COOKIE['tid']}' AND teamid='$team[id]' ORDER BY position"); $check=mysql_fetch_array($check); if(!$login[id]){ error("You must select a clan to challenge."); } if($check[position] > 3){ error("You do not have permission to send challenges from this id."); } if($login[id] =="$login[cid]"){ error("You cannot challenge yourself."); } //check the challenge points $getid = mysql_query("SELECT * FROM teams WHERE id = $login[id]"); $getvalue=mysql_fetch_array($getid); $email =$getvalue['email']; //echo $email; $getmail =mysql_query("SELECT * FROM members WHERE email ='$email'"); $getpoints = mysql_fetch_array($getmail); $points = $getpoints['points']; $chpoint = $login['points']+$login['points']/100*10; //echo $login[points]; if(!$login[points]) { error("You must enter points to challenge."); } if($chpoint > $points) { //echo $chpoint; //echo $points; error("You do not have enough points to challenge"); } //echo $chpoint.$login[points] ."sdfgf". $points; $challgdteam=mysql_query("SELECT ladderid,email,ipaddress,status FROM teams WHERE id='$login[cid]'"); $challgdteam=mysql_fetch_array($challgdteam); $check[current]=getenv("REMOTE_ADDR"); if($check[current] == $challgdteam[ipaddress]){ mysql_query("INSERT INTO tickets (teamid, oppid, priority, description, ip) VALUES('0','$login[cid]','4','The challenger ID $login[id] IP was the same as the challenged ID $login[cid].','N/A')"); error("Fake account detector triggered, administration has been contacted."); } if(!$challgdteam[ladderid]){ error("Unable to find the challenged team on this ladder."); } $ladder=mysql_query("SELECT * FROM ladders WHERE id='$challgdteam[ladderid]'"); $ladder=mysql_fetch_array($ladder); if(!$ladder[name]){ error("Unable to load the ladder information."); } $challgr=mysql_query("SELECT * FROM ladder_$ladder[id] WHERE ladder_$ladder[id].teamid='$login[id]'"); $challgr=mysql_fetch_array($challgr); $challgd=mysql_query("SELECT * FROM ladder_$ladder[id] WHERE ladder_$ladder[id].teamid='$login[cid]'"); $challgd=mysql_fetch_array($challgd); if(!$challgr[name]){ error("Unable to find the challenger teams stats."); } if(!$challgd[name]){ error("Unable to find the challenged teams stats."); } if($challgdteam[status] == 2){ error("This team is not currently accepting challenges."); }else if($challgdteam[status] == 3){ error("This team is currently locked by administration."); } if(mysql_num_rows(mysql_query("SELECT challid FROM challenges WHERE challgrid='$login[id]' AND challgdid='$login[cid]' OR challgrid='$login[cid]' AND challgdid='$login[id]'"))){ error("There is already a current challenge between these 2 teams."); } $oppchallenges=mysql_query("SELECT COUNT(*) FROM challenges WHERE challgrid='$login[cid]' OR challgdid='$login[cid]'"); $oppchallenges=mysql_fetch_array($oppchallenges); $oppchallenges="$oppchallenges[0]"; $challengerss=mysql_query("SELECT COUNT(*) FROM challenges WHERE challgrid='$login[id]' OR challgdid='$login[id]'"); $challengerss=mysql_fetch_array($challengerss); $challengerss="$challengerss[0]"; if($oppchallenges >= 10){ error("This team already has 10 challenges pending."); } if ($challengerss >= 10){ error("You already have 10 challenges pending."); } mysql_query("INSERT INTO challenges VALUES ( NULL, '$challgdteam[ladderid]', '$login[id]', '$login[cid]', '$challgr[name]', '$challgd[name]', NULL,".($login[points]).",".($login['points']*0.1).")"); $challenge_id=mysql_query("SELECT challid FROM challenges WHERE challgrid='$login[id]' AND challgdid='$login[cid]'"); $challenge_id=mysql_fetch_array($challenge_id); mysql_query("INSERT INTO chall_chat (chall_id,challenger,challenged) VALUES('$challenge_id[challid]','$login[id]','$login[cid]')"); //CLEAN UNPLAYED CHALLENGES $deletedate=date("Y-m-d H:i:s",time()-60*60*24*30); mysql_query("DELETE FROM challenges WHERE created < '$deletedate'"); $leader=mysql_query("SELECT memberid FROM membersteams WHERE position='1' AND teamid='$login[cid]'"); $leader=mysql_fetch_array($leader); mysql_query("INSERT INTO messages VALUES ( NULL, '{$_COOKIE['tid']}', '$leader[memberid]', 'You Have Been Challenged!', 'You have just been challenged by <a href=\"./stats.php?account=$login[id]\">$challgr[name]</a> With the points $login[points] <a href=\"challenge.php?action=accept&id=$login[cid]&pt=$login[points]\">Accept</a> To manage or delete this challenge click on the calendar next to the challenge on <a href=\"./stats.php?account=$login[id]\">My Account.</a> Thanks <i>$config[sitename]</i>', '1', '1', NULL)"); $header = "From: \"$config[sitename]\" <$config[sitemail]>\r\n"; $header .= "Reply-To: \"$config[sitename]\" <$config[sitemail]>\r\n"; $subject = "VGBetting - You have been challenged !"; $content = "You have been challenged by $challgr[name] View the details of this challenge using the link below.\n $config[scripturl]/stats.php?account=$login[cid]\n $config[sitename] $config[sitelink]\n\n"; //$out[body].="\"$challgd[name]\" <$challgdteam[email]>"; //$out[body].="From: \"$config[sitename]\" <$config[sitemail]>\r\n"; mail("\"$challgd[name]\" <$challgdteam[email]>",$subject,$content,$header); $email[toname] ="$challgd[name]"; $email[toemail] ="$challgdteam[email]"; $email[fromname] ="$config[sitename]"; $email[fromemail] ="$config[sitemail]"; $email[replyname] ="$config[sitename]"; $email[replyemail] ="$config[sitemail]"; $email[subject] ="You have been challenged"; $email[body] ="You have been challenged by $challgr[name] View the details of this challenge using the link below.\n $config[scripturl]/stats.php?account=$login[cid]\n $config[sitename] $config[sitelink]\n\n"; //email($email); $out[body].="<br /> <center> <table width='90%' border='0' cellspacing='1' cellpadding='1' bgcolor='#00000'> <tr bgcolor='$config[altcolora]'> <td width='100%' valign='center' align='left' colspan='2' background='$config[bg]'> <strong>Challenge</strong> </td> </tr> <tr bgcolor='$config[altcolorb]'> <td width='100%' valign='center' align='left'><center> <b> The challenge has been recorded and an email sent to $challgd[name].<br> <br> $challgr[name] vs $challgd[name] <br> <br> <a href='$config[scripturl]/stats.php?account=$login[id]'>View Your Stats</a> </b></center></td></tr> </table> </center><br /><br /><br /><br />"; include("$config[html]"); } ?> Quote Link to comment Share on other sites More sharing options...
flemingmike Posted March 30, 2009 Author Share Posted March 30, 2009 i figured it out - if($login[points] < 2){ error("Minimum bet is $ 2.00."); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.