Jump to content

Dale_G

Members
  • Posts

    74
  • Joined

  • Last visited

    Never

Everything posted by Dale_G

  1. Hey guys, quick question! Working on an image uploader and so far...securities pretty tight, the majority of the security is in the java app which controls the upload, but lets just say if SOMEHOW someone was able to get around the applet security and upload a non image file, which CHMOD should the file be modded so it cannot be ran? If possible, of course. Basically, what's the lowest CHMOD level that will still allow an image to be viewed by everyone, and that if somehow a script was uploaded, it would be CHMODDED so it cannot be ran, if possible of course.
  2. Alrighty, uh, mind sharing what to do again exactly? Like, exactly what I should put from <?php TO ?>, because..I've put what you put, the first part, the second part, then both, then separate, only to get a blank page, a non loading page, or the page itself with none of the cookies applied. So yeah that would be super if you can help me out here!
  3. Alright..thanks, pretty sure I'm doing something wrong but, I have this code so far exactly, with the exception of the user and passes. <?php $sock = fsockopen( "www.myspace.com", 80, $errno, $errstr, 5 ); fwrite( $sock, "GET / HTTP/1.1\r\n" ); fwrite( $sock, "Host: www.myspace.com\r\n" ); fwrite( $sock, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0\r\n" ); fwrite( $sock, "Set-Cookie: cookie\r\n" ); fwrite( $sock, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" ); fwrite( $sock, "Keep-Alive: 300\r\n" ); fwrite( $sock, "Connection: keep-alive\r\n" ); fwrite( $sock, "POST / HTTP/1.1\r\n" ); fwrite( $sock, "Host: www.myspace.com\r\n" ); fwrite( $sock, "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9) Gecko/2008052906 Firefox/3.0\r\n" ); fwrite( $sock, "Content-Length: 28\r\n" ); fwrite( $sock, "Content-Type: application/x-www-form-urlencoded\r\n" ); fwrite( $sock, "\r\nusername=blah&password=blah\r\n" ); fwrite( $sock, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n" ); fwrite( $sock, "Keep-Alive: 300\r\n" ); fwrite( $sock, "Connection: keep-alive\r\n" ); while( !feof( $sock ) ) { print fread( $sock, 1024 ); } fclose( $sock ); ?> And I'm getting this totally epic error! Any ideas?
  4. So yeah that would be super cool if anyone knew!
  5. Hey everyone, so like I'm new to cURL and I was wondering if it was possible to successfully "login" to a site such as say...MySpace using cURL. Or retrieve data only available whe logged in from a site that has a session ID in the URL to keep you logged on, such as www.mysite.com/index.php?id=le4377sdswe-==. So basically, I'm hoping cURL will shine where file_get_contents fails! Just uh, some external references I've found if they may help anybody! http://curl.haxx.se/mail/curlphp-2001-10/0015.html http://www.weberdev.com/get_example-4555.html
  6. I've always wondered how you would create a proxy, you know all those sites that let you "view the web anonymously", do those sites run on PHP or some other technology? And if so how do you, you know, set one up? Thanks!
  7. Hey everyone, pretty basic question so I'll start off with an example. I have, on my server a file named "echo.txt" which has, in plain text, "echo 'hello world';". I also have a php file named "read.php". How can I read in "echo.txt" using "read.php" and attempt to PARSE whatever text is inside? So, say, if I update "echo.txt" to "echo 'hello there';", when I view "read.php" it will echo out "hello there" parsed straight from "echo.txt"?
  8. Well, just did. No luck, not the methods I used anyway. If you know any I could try, just post 'em.
  9. Hey everyone. Uh, right now I'm trying to scrape some data from an https:// page on another site. It's fully accessible, no log-in is required, once you load it you can view it. However I seem to have a problem reading in this page with PHP. I used file_get_contents but...I end up just waiting around for 10 minutes with nothing happening. So uh, anyone care to offer me and solutions? Thanks.
  10. Alright, I got it. foreach ( $mytext as $boldtext ) { echo bold_text( $boldtext ); } That was simple.
  11. Hey everyone, quick question. Alright, for example, let's say I have an array of random text. $mytext = array( 'ololol', 'hilol', 'WTFBBQ', 'OMFGPWNISw##@234' ); Right? And I have a function that adds bold tags to text. function bold_text( $text ) { return '<b>'.$text.'</b>'; } Now, how can I apply the function to every item in the array of $mytext? Yes I know I could just do it manually as I would only have to do it 4 times, but I have a more complicated use for this using an array that contains hundreds of items in the array. So uh, thanks for the help fellow PHPers!
  12. Hey everyone, I need to know how to output, as an integer, the number of times some data is found in a string. For example $data = 'two'; $string = 'oneonethreetwofourseventwoeightninetwotwelve'; 'two' is found three times in $string, I'd like to output '3', in integer form.
  13. Yeah, anyone know how to do this? At first I thought it would be like this In this example, we are querying a database named 'ibf_members', two columns are named 'id' and 'member_name', and here we're trying to get all the member id's place them into an array, and pick what out at random using the rand function. $result = mysql_query( "SELECT * FROM ibf_members" ); $myArray = array(); while ( $row = mysql_fetch_array( $result ) ) { $myArray[] = $row['id']; } $rows = count( $myArray ); $id = rand( 1, $rows ); $id = $myArray[$id]; $idresult = mysql_query( "SELECT * from ibf_members WHERE id = '$id'" ); $membername = mysql_result( $idresult , 0, "member_name" ); $message = '<b>Member Name:</b> '.$message; And, we're not having much luck here with this one, since an array starts at 0, for SOME reason it seems 0 is being picked occasionally at random, and id 0 does not exist in the database since the PRIMARY KEY starts at 1. So, this method isn't working too well. Anyone care to share there methods with SQL and arrays? *I rarely use SQL, just getting into it now*
  14. Okay, I'm using Regex to pull the names of certain power tools from an xml style home improvement blog. Basically, this page is made up of <item> <name>Name</name> <description>Description</description> <Format id="xhr_3452" /> </item> Over and over again. Now, I'm trying to get the contents of Format id, which in this case is xhr_3452. $fgc = file_get_contents('http://www.site.org/feed/btg.xml'); preg_match('{id="xhr_([0-9]+)" /}', $fgc , $cms ); echo $cms[1]; And using the code above, I can do that just fine, however theres about 20 other entries on that page in the same format using format id="", but with different content. How can I use regex to get not only the first instance of format id="", but also all OTHERS on the page. So if we see <item> <name>Name</name> <description>Description</description> <Format id="xhr_3452" /> </item> <item> <name>Name</name> <description>Description</description> <Format id="xhr_4564 /> </item> <item> <name>Name</name> <description>Description</description> <Format id="xhr_524" /> </item> <item> <name>Name</name> <description>Description</description> <Format id="xhr_8423" /> </item> I can get ALL the format id's. Also note, the 'xhr_' will not change, so basically all that needs to be retrieved are the numbers.
  15. Hey everyone! Ever download something of off download.com or a similar site? Well, it pops up a confirmation window on your browser, asking you to download it. Upon checking out the code I see the source is some sort of PHP file with some string variables and the download name. So does PHP do this, or can it be set to do this for say...an MP3 file? As opposed of playing it in the browser like it would normally do, open up a download confirmation maybe send out a different header? This may just be 100% handled by the browser, but...just thought i'd check.
  16. Well, if you don't get my question from the topic alone.. What's the difference between an if and an elseif. When should one use an elseif INSTEAD of an if, maybe using a short code example?
×
×
  • 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.