Jump to content

marklarah

Members
  • Posts

    423
  • Joined

  • Last visited

    Never

Everything posted by marklarah

  1. Ie, can anyone help me set up a regex string to find the token? I assume this would be quite simple. Thanks.
  2. Definitely pagination, with the ability to sort by name, date registered etc
  3. <?php include("include.php"); doDB(); if (!$_POST) { $get_club_sql = "SELECT * FROM clubs WHERE id = '".$_GET["id"]."'"; $get_club_res = mysqli_query($mysqli, $get_club_sql) or die(mysqli_error($mysqli)); while ($club_info = mysqli_fetch_array($get_club_res)) { $name = strtoupper($club_info['name']); $adv = $club_info['adv']; $meet = stripslashes($club_info['meet']); $descrip = stripslashes ($club_info['descrip']); $pres = $club_info['pres']; $email = $club_info['email']; } $display_block .= " <h1>".$name."</h1> <form action="" method="post"> <p><strong>Faculty Advisor:</strong><br/> <input type=\"text\" name=\"adv\" size=\"30\" maxlength=\"50\" value=\"".$adv."\"></p> <p><strong>Meeting time/place:</strong><br/> <input type=\"text\" name=\"meet\" size=\"30\" maxlength=\"200\" value=\"".$meet."\"> <p><strong>Student President - (if multiple, use &):</strong><br/> <input type=\"text\" name=\"pres\" size=\"30\" maxlength=\"50\" value=\"".$pres."\"> <p><strong>President contact info:</strong><br/> <input type=\"text\" name=\"email\" size=\"30\" maxlength=\"50\" value=\"".$email."\"> <p><strong>Club Description:</strong><br/> <textarea name=\"descrip\" cols=\"50\" rows=\"5\" wrap=\"virtual\">".$descrip."</textarea></p> <p><input type=\"submit\" name=\"submit\" value=\"Edit Club\"></p> </form>"; } else if ($_POST) { if ($_POST["adv"]) { $update_adv_sql = "UPDATE clubs SET adv = '".$_POST["adv"]."' WHERE id = '".$_GET["id"]."'"; $update_adv_res = mysqli_query($mysqli, $update_adv_sql) or die (mysqli_error($mysqli)); } if ($_POST["meet"]) { $update_meet_sql = "UPDATE clubs SET meet = '".$_POST["meet"]."' WHERE id = '".$_GET["id"]."'"; $update_meet_res = mysqli_query($mysqli, $update_meet_sql) or die (mysqli_error($mysqli)); } if ($_POST["pres"]) { $update_pres_sql = "UPDATE clubs SET pres = '".$_POST["pres"]."' WHERE id = '".$_GET["id"]."'"; $update_pres_res = mysqli_query($mysqli, $update_pres_sql) or die (mysqli_error($mysqli)); } if ($_POST["email"]) { $update_email_sql = "UPDATE clubs SET email = '".$_POST["email"]."' id = '".$_GET["id"]."'"; $update_email_res = mysqli_query($mysqli, $update_email_sql) or die (mysqli_error($mysqli)); } if ($_POST["descrip"]) { $update_descrip_sql = "UPDATE clubs SET descrip = '".$_POST["descrip"]."' id = '".$_GET["id"]."'"; $update_descrip_res = mysqli_query($mysqli, $update_descrip_sql) or die (mysqli_error($mysqli)); } mysqli_free_result($get_list_res); mysqli_close($mysqli); $display_block = "<p>Your entry has been edited. <br/>View your edited entry <a href=\"showitem.php?id=".$id."\">here</a>"; } ?> <html> <head> <title>Edit Club</title> </head> <body> <?php echo $display_block; ?> </body> </html> Also, be sure to protect your input. Also what you can select http://www.csteffen.com/staples/edititem.php?id=-1
  4. Prepare to smack yourself in the head. Looking at the source code from the generated page, it shows <html> <head> <title>Edit Club</title> </head> <body> <h1>CLUB TO EDIT</h1> <p><strong>Faculty Advisor:</strong><br/> <input type="text" name="adv" size="30" maxlength="50" value="MeDe"></p> <p><strong>Meeting time/place:</strong><br/> <input type="text" name="meet" size="30" maxlength="200" value="Tuesdays"> <p><strong>Student President - (if multiple, use &):</strong><br/> <input type="text" name="pres" size="30" maxlength="50" value="Pres"> <p><strong>President contact info:</strong><br/> <input type="text" name="email" size="30" maxlength="50" value="email@lala.com"> <p><strong>Club Description:</strong><br/> <textarea name="descrip" cols="50" rows="5" wrap="virtual">Description</textarea></p> <p><input type="submit" name="submit" value="Edit Club"></p> </form></body> </html> Your <form> tag is not there
  5. http://www.phpfreaks.com/forums/index.php/topic,200925.0.html
  6. Hi! So I'm scraping a page, and the following text comes up, from which a string needs extracting/ The session=g7657h7h575, I already will have the session key stored in a variable, (but not the 24, the number could be a one or two digit number.) Anyway, I've been pulling my hair out with preg_matches and m tokens and (.+?) and stuff...nothing seems to work. Anyone want to guide me in the right direction? Thanks....
  7. Try running this in your address bar javascript:alert(1.1^12); last time I checked, 1.1 to the power twelve was not 13! What is going here?
  8. Well I managed to do it myself nevermind <?php echo substr($_SERVER['REQUEST_URI'],strrpos($_SERVER['REQUEST_URI'], "/")+1); ?> is working for me.
  9. Hang on isn't this 'cheating' as such? We're doing this assuming the folder will always be 7 characters, if there is even a folder. Is there a better way to do it so it will always work?
  10. Hmm that actually seems to work thanks very much! someone should probably make a sticky with common FAQs with this in or something anyway thanks man
  11. Can't we just find the last "\" in the string in $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; and then get the content after that or something?
  12. Thats just doing the same as <?php echo $_SERVER['REQUEST_URI']; ?> ? EDIT: Because my stuff is in a folder, I'm getting /thingy/test.php?a=b or whatever with that :/
  13. Hi I need to get the the current page and store it as a variable. I realize I could do something like <?php echo basename($_SERVER['SCRIPT_FILENAME']); ?> but if the current page was page.php?a=b or whatever, that would of course only tell me page.php, and I would like to be able to store page.php?a=b. So currently, I am using this <?php $urlarr = explode('/', $_SERVER['REQUEST_URI']); $page = count($urlarr)-1; echo $urlarr[$page]; ?> but it seems terribly inefficient for something that is probably rather simple. How would I do this in a quicker way? Thanks
  14. So you found that function in the user comments somewhere? Well that function you found the creator most likely did not have probably works the same as http_get if you do not have PECL installed. So it worked for him. EDIT: I do not think it works the same. Either way to use it, change your function name to something like : function my_http_get and your script should work just fine. http://php.oregonstate.edu/manual/en/features.remote-files.php Ctrl+f: 29-Apr-2008 01:18 05-Aug-2003 12:25 to find the post So I just renamed the function, and it finished loading the page, in a time that might of seemed it could have downloaded the file, but the file in my downloads folder is just Zero kilobytes
  15. Yeah I just tried that lol Thing i, I found this function on php.net so...I assumed it would be all working and such. EDIT: Right now, the page is just loading, surely it should initiate the download
  16. Wait....so how do I call this function then with the download?
  17. Silly PHP.... Actually I'm more it's just silly me, probably something stupid I'm missing here, but what exactly could be wrong with this simple download script? <?php function http_get($url) { $url_stuff = parse_url($url); $port = isset($url_stuff['port']) ? $url_stuff['port'] : 80; $fp = fsockopen($url_stuff['host'], $port); $query = 'GET ' . $url_stuff['path'] . " HTTP/1.0\n"; $query .= 'Host: ' . $url_stuff['host']; $query .= "\n\n"; fwrite($fp, $query); while ($tmp = fread($fp, 1024)) { $buffer .= $tmp; } preg_match('/Content-Length: ([0-9]+)/', $buffer, $parts); return substr($buffer, - $parts[1]); } header("Content-Description: File Transfer"); header("Content-Type: application/x-rar-compressed"); header("Content-Transfer-Encoding: binary"); header("Content-Disposition: attachment; filename=test.rar"); http_get('file url goes here'); ?> I guess that should work, but I get on the line referring to the } that closes the function. I can't see anything wrong with it...maybe you could point it out to me? Cheers...
  18. Guys please help me I've tried looking at google at php.net, I just really need some code now, on how to this with sockets or wget
×
×
  • 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.