Jump to content

Graxeon

Members
  • Posts

    260
  • Joined

  • Last visited

Everything posted by Graxeon

  1. Hello! I'm trying to put captcha into my code but I can't seem to get it right. Note: I removed the captcha code from my form because I keep doing it incorrectly and don't want the form to seem cluttered . I need someone to show me how to implement the captcha code into my form. form.html <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JW FLV Player</title> <link rel="stylesheet" type="text/css" href="view.css" media="all"> <script type="text/javascript" src="view.js"></script> </head> <body id="main_body" > <img id="top" src="top.png" alt=""> <div id="form_container"> <form id="form_229096" class="appnitro" method="get" action="urldisplay.php"> <div class="form_description"> <h2>Have a video URL? Fill this out.</h2> </div> <ul > <li id="li_2" > <label class="description" for="element_2">Who made this video? </label> <div> <select class="element select medium" id="element_2" name="element_2"> <option value="" selected="selected"></option> <option value="User1" >User1</option> <option value="User2" >User2</option> <option value="User3" >User3</option> </select> </div> </li> <li id="li_3" > <label class="description" for="element_3">Which episode is it? </label> <div> <select class="element select medium" id="element_3" name="element_3"> <option value="" selected="selected"></option> <option value="1" >1</option> <option value="2" >2</option> <option value="3" >3</option> </select> </div> </li> <li id="li_4" > <label class="description" for="element_4">Where did you find this URL? </label> <div> <select class="element select medium" id="element_4" name="element_4"> <option value="" selected="selected"></option> <option value="YouTube" >YouTube</option> <option value="Direct" >Direct FLV/MP4</option> </select> </div> </li> <li id="li_1" > <label class="description" for="element_1">URL </label> <div> <input id="element_1" name="element_1" class="element text large" type="text" maxlength="255" value=""/> </div> </li> <li class="buttons"> <input type="hidden" name="form_id" value="229096" /> <input id="saveForm" class="button_text" type="submit" name="submit" value="Submit" /> </li> </ul> </form> <div id="footer"> Copyright </div> </div> <img id="bottom" src="bottom.png" alt=""> </body> </html> urldisplay.php <?php $xml = ''; $xml .= '<font size=10>Now Playing...</font>' . PHP_EOL; $xml .= '<br />' . $_GET['element_2'] . ', Episode ' . $_GET['element_3'] . PHP_EOL; $xml .= '<br />Host:' . $_GET['element_4'] . PHP_EOL; $xml .= "<br><br>" . PHP_EOL; $xml .= "<script type='text/javascript' src='mediaplayer/swfobject.js'></script>" . PHP_EOL; $xml .= "<div id='mediaspace'>This text will be replaced</div>" . PHP_EOL; $xml .= "<script type='text/javascript'>" . PHP_EOL; $xml .= "var so = new SWFObject('mediaplayer/player.swf','ply','470','320','9','#ffffff');" . PHP_EOL; $xml .= "so.addParam('allowfullscreen','true');" . PHP_EOL; $xml .= "so.addParam('allowscriptaccess','always');" . PHP_EOL; $xml .= "so.addParam('wmode','opaque');" . PHP_EOL; $xml .= "so.addVariable('file','" . $_GET['element_1'] . "');" . PHP_EOL; $xml .= "so.write('mediaspace');" . PHP_EOL; $xml .= "</script>" . PHP_EOL; $xml .= "<br><br>" . PHP_EOL; $xml .= "<br>" . PHP_EOL; $xml .= '<a href="javascript:history.back()"><---back to the form</a>' . PHP_EOL; $xml .= "<br>" . PHP_EOL; $mainemail = "[email protected]"; $subject = "Video Submit Check"; $subemail = "[email protected]"; $from = "From: $subemail"; $ip=$_SERVER['REMOTE_ADDR']; $content = $_GET['element_2'] . " _____" . $_GET['element_3'] . " _____" . $_GET['element_4'] . " _____" . $_GET['element_1'] . " _____" . $ip; $send = mail($mainemail, $subject, $content, $from) ; print $xml; ?> So as they are...form.html and urldisplay.php are both working. Now I need to add some security to it through Captcha but I can't get it right. Help, please? Here is the Captcha site + code: www.captcha.net <html> <body> <form action="" method="post"> <?php require_once('recaptchalib.php'); // Get a key from http://recaptcha.net/api/getkey $publickey = "123456"; $privatekey = "654321"; # the response from reCAPTCHA $resp = null; # the error code from reCAPTCHA, if any $error = null; # was there a reCAPTCHA response? if ($_POST["recaptcha_response_field"]) { $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if ($resp->is_valid) { echo "You got it!"; } else { # set the error code so that we can display it $error = $resp->error; } } echo recaptcha_get_html($publickey, $error); ?> <br/> <input type="submit" value="submit" /> </form> </body> </html>
  2. Dont know if others have seen this...just saw it on a weight lifting site xD I lul'd my pants off So...have any of you landed in this position? But then again...this is PHPfreaks...everyone is too good >.>
  3. Perfect! Thank you
  4. That works but only if "times=1". If it's anything higher than 1 then it just displays 0. Same test page: http://t3st1ng.ulmb.com/equation.php?cash=14000000&cost=1532&profit=18&times=2&shards=59&unlock=yes
  5. It gives the same result. Here's the test page: http://t3st1ng.ulmb.com/equation.php?cash=14000000&cost=1532&profit=18&times=1&shards=59&unlock=yes
  6. Any ideas?
  7. Let me shorten the post a little Here's my equation: $originalcash2 = $_GET['cash']; $equation2 = 0; for ($i=0;$i<$times;$i++) { $originalcash2+= ($originalcash2 / $cost * $shards / 50000); } echo "<br />Total Trades: " . number_format($originalcash2,2,'.',','); exit; } I call that script by saying: equation.php?cash=100&cost=20&profit=4&times=7&shards=59&unlock=yes And I need the equation to do this: 100/20 = 5 5*59 = 295 (first set of shards out of "&times=3") (start 2nd "&times=3") 120/20 = 6 (120 is $cash + $cash/$cost * $profit) 6*59 = 354 (second set of shards out 3) (start 3rd "&times=3") 144/20 = 7.2 7.2*59 = 424.8 (now add up all of the values) 295+354+424.8 = 1073.8 (now divive by 50,000) 1073.8/50000 = 0.021476 (50,000 is just a number I picked)
  8. I'm trying to echo how many times it takes to get rid of an item (the equation is in the if statement): <?php $cash = $_GET['cash']; $cost = $_GET['cost']; $profit = $_GET['profit']; $times = $_GET['times']; $equation = 0; for ($i=0;$i<$times;$i++) { $cash+= ($cash / $cost * $profit); } $originalcash = $_GET['cash']; $profitnew = $cash - $originalcash; $buystarting = $originalcash / $cost; $buyending = $cash / $cost; echo "Starting Cash: " . number_format($originalcash,2,'.',','); echo "<br />Ending Cash: " . number_format($cash,2,'.',','); echo "<br />Total Profit: <b>" . number_format($profitnew,2,'.',',') . "</b>"; echo "<br />"; echo "<br />Cost per item: " . number_format($cost,2,'.',','); echo "<br />Profit per item: " . number_format($profit,2,'.',','); echo "<br />Times: " . number_format($times,2,'.',','); echo "<br />Total items you can buy with Starting Cash: " . number_format($buystarting,2,'.',','); echo "<br />Total items you can buy with Ending Cash: " . number_format($buyending,2,'.',','); echo "<br /><br />"; $unlock = $_GET['unlock']; if($unlock=="yes") { $shards = $_GET['shards']; $shardsstarting = $shards * $buystarting; $shardsending = $shards * $buyending; $trades = $shardsstarting / 50000; $trades2 = $shardsending / 50000; echo "<br />Total Shards made with Starting Cash: " . number_format($shardsstarting,2,'.',','); echo "<br />Total trades at start: " . number_format($trades,2,'.',','); echo "<br />Total Shards made with Ending Cash: " . number_format($shardsending,2,'.',','); echo "<br />Total trades at end: " . number_format($trades2,2,'.',','); $originalcash2 = $_GET['cash']; $equation2 = 0; for ($i=0;$i<$times;$i++) { $originalcash2+= ($originalcash2 / $cost * $shards / 50000); } echo "<br />Total Trades: " . number_format($originalcash2,2,'.',','); exit; } ?> It's outputting the correct amount of times it takes to get rid of the "shards" but it's also adding "$originalcash" to it. If I try subtracting "$originalcash" then it gives me a totally different number (not what you'd expect). How can I fix it to just show how many times it takes to get rid of "$equation2"? So say the we had this: equation.php?cash=100&cost=20&profit=4&times=7&shards=59&unlock=yes To find out how many times it takes to get rid of $equation2 this would happen: 100/20 = 5 5*59 = 295 (first set of shards out of "&times=3") (start 2nd "&times=3") 120/20 = 6 (120 is $cash + $cash/$cost * $profit) 6*59 = 354 (second set of shards out 3) (start 3rd "&times=3") 144/20 = 7.2 7.2*59 = 424.8 (now add up all of the values) 295+354+424.8 = 1073.8 (now divive by 50,000) 1073.8/50000 = 0.021476 (50,000 is just a number I picked)
  9. Not sure about a PHP drop drown...but I know there are JavaScript ones. Here's the first one I found on Google: http://javascript.internet.com/forms/country-state-drop-down.html
  10. Perfect, thank you
  11. Oh just a quick question: Is there any way to add commas? The number is hard to read if it goes into the millions. So instead of displaying "158782393.387839" it'll display it like "158,782,393.387839"
  12. Thank you very much
  13. @Budd That gave me "105" as the answer. The answer should be well over 132 @neil I'm sorry, you lost me xD (though that's like almost the same thing as Budd's code)
  14. I have a math equation that calculates profit. What I don't know how to implement is "times." Times is how many times you repeat the equation. Each time you repeat it though, it uses the new TOTAL cash. So let's say I had this: equation.php?cash=100&cost=20&profit=3&times=7 It should calculate this: 100/20 = 5 5*3 = 15 (now it calculates the "times") 100+15 = 115 115/20 = 5.75 5.75*3 = 17.25 ("times" #3) 115+17.25 = 132.25 132.25/20 = 6.6125 6.6125*3 = 19.8375 (then keep repeating until you get to "&times=7") <?php $cash = $_GET['cash']; $cost = $_GET['cost']; $profit = $_GET['profit']; $times = $_GET['times']; $equation = $cash / $cost * $profit; //I don't know how to implement $times echo $equation; ?>
  15. Hehe, better to learn it the pro's way than another xD Thank you!!!! Ok, I won't ask ask any more questions
  16. Hey, sorry for bugging you...but can you help me change 1 last thing? The last script you posted works perfectly...but I rethought how it should handle an input. Instead of posting ALL of the stuff in the arrays for ALL of the genre, can you make it so it only posts the stuff within the arrays that show up in multiple genres? For example, if these were the genres: $action1 = array("Man", "Boy", "Girl"); $adventure1 = array("Female", "Man", "Boy"); and if the selection in the search form was "action" and "adventure", then it should output this: Search results for: action, adventure Boy Man Now go back to the site and select one of these titles! ...or search again This is what your last script would produce with those selections: Search results for: action, adventure Man Female Girl Boy Now go back to the site and select one of these titles! ...or search again The reason I'm asking for this change is because what it's currently searching is too broad.
  17. Awesome! Thank you again
  18. Hey...is there any way of omitting duplicate "Titles"? Because some "Titles" have more than 1 genre so they'll show up in both. If I put them in just 1 genre...then the search misses it. So is there a way of saying "if any duplicates in all arrays, remove all but 1"? For example, I may have this: $action1 = array("The Boat", "Girl"); $adventure1 = array("Country", "The Boat"); So if I search for "action" and "adventure" I'll get "The Boat" coming up twice. I only need it to come up once.
  19. Thank you VERY much!
  20. That gave this error: Invalid argument supplied for foreach() in line 12 which is "foreach ($_GET['g'] as $genre) {" And the final result for more than 1 genre would be say we chose "action" and "comedy": Search results for: action, comedy Action Title1 Action Title2 Comedy Title1 Comedy Title2 Now go back to the site and select one of these titles! ...or search again
  21. Ok well I played with it a little. I made 2 files: popup.php and results.php It works only for 1 genre, though. If I choose more than 1 of the genres then it only displays the last "g" input. popup.php <form action="results.php" method="get"> <h5>Genres:</h5> <input id="1in" name="g" type="checkbox" value="action" /><input id="1ex" name="g" style="display:none" type="checkbox" value="-action" />action <br /> <input id="2in" name="g" type="checkbox" value="adventure" /><input id="2ex" name="g" style="display:none" type="checkbox" value="-adventure" />adventure<br /> <input id="3in" name="g" type="checkbox" value="comedy" /><input id="3ex" name="g" style="display:none" type="checkbox" value="-comedy" />comedy<br /> <input id="4in" name="g" type="checkbox" value="drama" /><input id="4ex" name="g" style="display:none" type="checkbox" value="-drama" />drama<br /> <input id="7in" name="g" type="checkbox" value="fantasy" /><input id="7ex" name="g" style="display:none" type="checkbox" value="-fantasy" />fantasy<br /> <input id="8in" name="g" type="checkbox" value="magic" /><input id="8ex" name="g" style="display:none" type="checkbox" value="-magic" />magic<br /> <input id="9in" name="g" type="checkbox" value="supernatural" /><input id="9ex" name="g" style="display:none" type="checkbox" value="-supernatural" />supernatural<br /> <input id="10in" name="g" type="checkbox" value="horror" /><input id="10ex" name="g" style="display:none" type="checkbox" value="-horror" />horror<br /> <input id="11in" name="g" type="checkbox" value="mystery" /><input id="11ex" name="g" style="display:none" type="checkbox" value="-mystery" />mystery<br /> <input id="12in" name="g" type="checkbox" value="psychological" /><input id="12ex" name="g" style="display:none" type="checkbox" value="-psychological" />psychological<br /> <input id="13in" name="g" type="checkbox" value="romance" /><input id="13ex" name="g" style="display:none" type="checkbox" value="-romance" />romance<br /> <input id="14in" name="g" type="checkbox" value="science fiction" /><input id="14ex" name="g" style="display:none" type="checkbox" value="-science fiction" />science fiction<br /> <input id="15in" name="g" type="checkbox" value="thriller" /><input id="15ex" name="g" style="display:none" type="checkbox" value="-thriller" />thriller<br /> <p> <input type="submit" value="Search"> <input type="reset" value="Reset"> </p> <form> results.php <?php $action1 = array("Action Title1", "Action Title2"); $adventure1 = array("Adventure Title", "Adventure Title2"); $comedy1 = array("Comedy Title", "Comedy Title2"); $genre = $_GET['g'] ; $f = '1'; $var = $genre . $f; $locations = $$var; $xml .= 'Search results for: ' . $genre . PHP_EOL; $xml .= '<br><br>' . PHP_EOL; foreach($locations as $location) { $xml .= $location . PHP_EOL; $xml .= '<br>' . PHP_EOL; } $xml .= '<br>' . PHP_EOL; $xml .= 'Now go back to the site and select one of these titles!' . PHP_EOL; $xml .= "<br><br>" . PHP_EOL; $xml .= '...or search again' . PHP_EOL; print $xml; ?> I don't know how to tell the script that there are different values of "g". Can you guys help me fix up this code so if there's more than 1 genre chosen then it displays all of the genres' "Title"s requested?
  22. Can someone point me to where I can make something like this search form: http://www.animenewsnetwork.com/encyclopedia/search/genre However, the only part I want to know from that is how to use the stuff under "Genres:" where it says "action, adventure, comedy, drama, etc." I can't use a database, though (besides...I won't have many things to search for). I can use PHP, though. So from that page's source I just need this left over: <form action="genreresults" method="get"> <h5>Genres:</h5> <input id="tristate1in" name="g" type="checkbox" value="action/A" /><input id="tristate1ex" name="g" style="display:none" type="checkbox" value="-action/A" />action <input id="tristate2in" name="g" type="checkbox" value="adventure/A" /><input id="tristate2ex" name="g" style="display:none" type="checkbox" value="-adventure/A" />adventure<br /> <input id="tristate3in" name="g" type="checkbox" value="comedy" /><input id="tristate3ex" name="g" style="display:none" type="checkbox" value="-comedy" />comedy<br /> <input id="tristate4in" name="g" type="checkbox" value="drama/D" /><input id="tristate4ex" name="g" style="display:none" type="checkbox" value="-drama/D" />drama <input id="tristate7in" name="g" type="checkbox" value="fantasy/F" /><input id="tristate7ex" name="g" style="display:none" type="checkbox" value="-fantasy/F" />fantasy <input id="tristate8in" name="g" type="checkbox" value="magic/F" /><input id="tristate8ex" name="g" style="display:none" type="checkbox" value="-magic/F" />magic <input id="tristate9in" name="g" type="checkbox" value="supernatural/F" /><input id="tristate9ex" name="g" style="display:none" type="checkbox" value="-supernatural/F" />supernatural<br /> <input id="tristate10in" name="g" type="checkbox" value="horror" /><input id="tristate10ex" name="g" style="display:none" type="checkbox" value="-horror" />horror<br /> <input id="tristate11in" name="g" type="checkbox" value="mystery" /><input id="tristate11ex" name="g" style="display:none" type="checkbox" value="-mystery" />mystery<br /> <input id="tristate12in" name="g" type="checkbox" value="psychological" /><input id="tristate12ex" name="g" style="display:none" type="checkbox" value="-psychological" />psychological<br /> <input id="tristate13in" name="g" type="checkbox" value="romance" /><input id="tristate13ex" name="g" style="display:none" type="checkbox" value="-romance" />romance<br /> <input id="tristate14in" name="g" type="checkbox" value="science fiction" /><input id="tristate14ex" name="g" style="display:none" type="checkbox" value="-science fiction" />science fiction<br /> <input id="tristate15in" name="g" type="checkbox" value="thriller" /><input id="tristate15ex" name="g" style="display:none" type="checkbox" value="-thriller" />thriller<br /> <p> <input type="submit" value="Search"> <input type="reset" value="Reset"> </p> </form>
  23. Never mind. It's bugged with my site. I'll ask something else in a diff topic.
  24. Hey, I'm trying to make a form popup for genres after clicking an option on a drop-down list. That form has a list of different genres, creates a new JS file based on what the user selects, and sends that new JS file to the 2nd drop-down list. I can find out how to make the form, I know how to generate the JS file, but I DO NOT know how to link that new JS file (generated from a PHP script) to the 2nd drop-down list. That is my question, how do I link the newly generated JS file to the 2nd drop-down list? The rest of my post is an explanation of how the drop-down lists function. This is pretty long so bear with me, please. Also, note some of the comments within the code This is the first drop-down list: <select onchange="drop_down_list_level_1(this.options[this.selectedIndex].value);" name="level_1"> <option value='main.xml'>Start Here</option> <option value=''>--------</option> <option value='da'>Sort Alphabetically</option> <option value='dg' onClick="javascript:makeExternalPopup()">Sort by Genre</option> //the onClick value is what makes the form popup </select> My website has 3 drop-down lists (it's like a state-city-county thing). They're all linked to each other by "option value=''". Each "value" is an individual JavaScript file. So, "da" is really "da.js" and "dg" is "dg.js". However, for the option on "dg" though, I want the form to popup first and THEN have the "value" link to a PHP generated JS file. Here is an example of a JS file that would be generated by the form: function populate(form) { form.options.length = 0; form.options[0] = new Option("Drama, Horror, Action",""); form.options[1] = new Option("Title1", "dglink1"); //Every "dglink#" is a JS file that comes up in Drop-down list 3. form.options[2] = new Option("Title2", "dglink2"); form.options[3] = new Option("Title3", "dglink3"); form.options[4] = new Option("Title4", "link4.xml"); //These options can link directly to an XML file, btw. Essentially, that's what it all gets down to. This, ofc, is all handled within the PHP file that generates it. }; Here is the code for all 3 drop-down lists: <body onload="drop_down_list_level_1(document.form.level_1.options[document.form.level_1.selectedIndex].value);" bgcolor="black" TEXT="#FFFFFF"> <form name="form"> <table width="0" border="0"> <tr> <td width="0"> <select onchange="drop_down_list_level_1(this.options[this.selectedIndex].value);" name="level_1"> <option value='main.xml'>Start Here</option> <option value=''>--------</option> <option value='de'>Sort Alphabetically</option> <option value='dg' onClick="javascript:makeExternalPopup()">Sort by Genre</option> <!-- L1-playlist_multiple_locations.xml --> </select> </td> </tr> <tr> <td> <div id="level_2_drop_down" class="drop_down"> <select onchange="drop_down_list_level_2(this.options[this.selectedIndex].value);" name="level_2"> <option value="">Level 2...</option> </select> </div> <span id="loading_level_2_drop_down" class="loading_drop_down"> <img src="loader.gif" width="16" height="16" align="absmiddle"> Loading... </span> <div id="no_level_2_drop_down" class="no_drop_down"> <!-- This Category has no further Levels. --> </div> </td> </tr> <tr> <td> <div id="level_3_drop_down" class="drop_down"> <select onchange="loadPlaylist(this.options[this.selectedIndex].value);" name="level_3"> <option value="">Playlist...</option> </select> </div> <span id="loading_level_3_drop_down" class="loading_drop_down"> <img src="loader.gif" width="16" height="16" align="absmiddle"> Loading... </span> <div id="no_level_3_drop_down" class="no_drop_down"> <!-- This Category has no Levels. --> </div> </td> </tr> </table> </form> It's a bit confusing, sorry. But PLEASE help me with this...I googled it and couldn't find anything better than this: http://www.openjs.com/tutorials/advanced_tutorial/popup.php . But that doesn't answer my question on how to link a newly generated JS file to the 2nd drop-down list.
  25. Awesome! I tinkered around with it a bit and it works VERY nicely! I like your sig, btw
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.