
Graxeon
Members-
Posts
260 -
Joined
-
Last visited
Everything posted by Graxeon
-
Sorry...last request: can you tell me where I include the "site.com/url/1234" URL? Because I tried this but it didn't return anything: $url = "site.com/url/1234"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_setopt($curl, CURLOPT_RETURN_TRANSFER, FALSE); curl_exec($curl); $url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); $query = parse_url($url, PHP_URL_QUERY); echo $query; This code is not in "site.com/url/1234" ...it's in a different PHP file (let's call it "home.php") so it has to have some refference to "site.com/url/1234" within that PHP file.
-
So like this? <?php $url = "site.com/url/1234"; $curl = curl_init(); curl_setopt($curl, CURLOPT_RETURNTRANSFER, FALSE); curl_exec($curl); $url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); $query = parse_url($url, PHP_URL_QUERY); echo $query; ?> If it is...it's not showing anything. I get a blank page.
-
I haven't tested it but it should be something like this with the redirect put in: <?php if (isset($_GET['u'])) { echo 'Do you really want to continue?<br/> <form method="post" action=""><input type="submit" name="yes" value="Yes"><input type="submit" name="no" value="No"></form>'; } if (isset($_POST['yes'])) { //Redirect Code header("Location: " .$_GET['u']); } if (isset($_POST['no'])) { //Go back to old location or whatever else you want. } ?>
-
It just has a generic "do you really want to continue" yes/no option to a link defined by whatever comes after the .php?u=
-
so am I supposed to take out the $query? Sorry, I'm not familiar with it either lol
-
It didn't display anything. It got rid of the error, though.
-
Ok, but I keep getting this error code: Wrong parameter count for curl_exec() And is this how I setup the script? Again, I don't know exactly how this code works. <?php $url = "site.com/url/1234"; $curl = curl_init(); curl_setopt($curl, CURLOPT_URL, $url); curl_exec(); $url = curl_getinfo($curl, CURLINFO_EFFECTIVE_URL); $query = parse_url($url, PHP_URL_QUERY);; echo $_GET['file']; ?>
-
any ideas or help with Ignace's code?
-
I read the PHP cURL manual but I'm still lost on this. I also tried googling different things about curl and $_get but I couldn't find anything that explained it clearly. Help please?
-
Sorry...could you explain that to me? I don't know how that works or how to apply the URLs.
-
I'll rephrase my question I'm on a page called "home.php" "home.php" has code in it that does this: 1. Opens "site.com/url/1234" 2. That URL redirects to "site.com/image.php?num=25&loc=china" 3. "home.php" now gets the value of "num" from that new URL and echos it. So the end product after opening "home.php" is: 25 How can I do this? I know $_GET but that's for what's already in the browser bar. How can I "get" the "num" after I open "site.com/url/1234" It doesn't matter what the contents of "site.com/url/1234" and "site.com/image.php?num=25&loc=china" are. I'm only working with the URLs themselves.
-
But I have to load the URL first. Edit: As in: loadpage(site.com/url/1234) $_GET['num'] //from the page
-
I have this URL: site.com/url/1234 That URL redirects to: site.com/image.php?num=25&loc=china How can I get "num" after I am redirected? I feel so dumb for not understanding this :/
-
oh...odd. That fixed it though. Thank you for helping me!
-
Aww you're offline Since CB is away...can anyone else see the problem?
-
Changing it to POST messes up urldisplay.php because it doesn't receive the inputs. Well, it does for the Captcha code but not for processing the video because of the "$_GET[element_#"]" things. Edit: and even with the POST method...captcha doesnt work. It lets me through without putting in the letters. Edit2: print_r gave me the form inputs and some other random characters. I also changed the $_GETs to $_POSTs. The video display works, but the captcha isn't checking if the code was correct. I can still go through the form without typing in the security letters. form.php <!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"> <?php require_once('recaptchalib.php'); $publickey = "MYKEYHERE"; echo recaptcha_get_html($publickey); ?> <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 print_r($_POST); require_once('recaptchalib.php'); $privatekey = "MY2NDKEYHERE"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); // This part can be modified to fit the style of your website, etc. if (!$resp->is_valid) { $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 .= "If you would like to contribute to the website, please submit more video URLs through the same form." . PHP_EOL; $xml .= "<br>" . PHP_EOL; $xml .= '<a href="javascript:history.back()"><---back to the form</a>' . PHP_EOL; $xml .= "<br>" . PHP_EOL; $xml .= "NOTE: Video URLs have to be the FULL episode. So, videos that are split into 'parts' like those on YouTube can't be added to the website." . PHP_EOL; $mainemail = "[email protected]"; $subject = "Video Submit"; $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; } else { die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } ?>
-
Got this: Array ( )
-
Oh yeah sorry this is what I have (forgot to replace when transferring to forums ) die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); And yes, the keys are correct.
-
Yeah I put my form processor within the if statement. Like this: if ($resp->is_valid) { //my code here } else { # set the error code so that we can display it. You could also use # die ("reCAPTCHA failed"), but using the error message is # more user friendly $error = $resp->error; } } I don't get an error but the Captcha code isn't doing anything now. I click "submit" without filling out the Captcha box and it still lets me through.
-
Lol thanks I get an error after putting your first code into the form.html file (well, form.php now) and your second code into urldisplay.php like so: <?php require_once('recaptchalib.php'); $privatekey = "my key"; $resp = recaptcha_check_answer ($privatekey, $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); // This part can be modified to fit the style of your website, etc. if (!$resp->is_valid) { die ("The reCAPTCHA wasn't entered correctly. Go back and try it again." . "(reCAPTCHA said: " . $resp->error . ")"); } $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; //and the rest of the code... Should my "print $xml" code be within the "if" statement or am I doing something else wrong? Here's the error: The reCAPTCHA wasn't entered correctly. Go back and try it again.(reCAPTCHA said: incorrect-captcha-sol) It was entered correctly, though. And recaptchalib.php is in the same directory.
-
Sorry...did I explain it correctly? Haven't gotten a reply for a while xD
-
I've seen a similar thing to this so I hope it helps: $xml = ''; $xml .= 'hello'; $xml .= 'world'; print $xml though idk exactly what your code means
-
Does anyone know how to put the captcha code into the form.html file?
-
Oh, also...if anyone knows of a better captcha system, please show me. Apparently recaptcha guesses if youre correct on half of the entry :/ (just tested "New noodles" with "Naw noodles" on the official site and it accepted it, lol)