Jump to content

para11ax

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Everything posted by para11ax

  1. [quote author=AndyB link=topic=103209.msg410886#msg410886 date=1154896211] [quote]Ideas on why a space isn't a space?[/quote] When it's '%20' not ' ' [/quote] True enough, but the way I found the problem was by reading the log in my PHP editor, and the line is blank.  So I think it must be that PHP is considering the line breaks and such in the ASCII formated file... since they wouldn't show up anywhere. Thanks for everyone's input.
  2. Looks like it's working.  Thanks! I wish something that seems so simple would be.  I'll let you know if it hangs up anywhere else... it could take a while to run through.
  3. That brings me back to the original behavior of going into the IF statement, even though it is a space. [code=php] if(!ereg("^[ ]*$",$line)){     echo "($line)";     exit();     parse($line, $server, $log, $current_round, $name_guid, $line_num); } [/code] [quote="Output"] ( ) [/quote]
  4. Adding the extra & didn't change the behavior at all. I tried the regular expression code you gave... and it did make it to the end of the log... but it didn't parse a single line, so it looks like that expression evaluated to TRUE for anything.
  5. PHP seems totally incompetant when it comes to comparing strings.  I have had many issues with this while writing a program to parse a log file.  I have ignored previous problems, but now one is stopping the program from working at all. Basically, there is a line that is just a space (" ")... I had not programmed for this and the parser timed out.  After debugging for a long time I figured that out.  Here's the problem though.  I added code to make sure that the line isn't a space or null... and only parse that line if it is something substancial.  BUT, it's not working. [code=php] $line = fgets($log); if(!($line == "") & !($line == " ")){     parse($line, $server, $log, $current_round, $name_guid, $line_num); } [/code] This seems pretty straightforeward... but amazingly utterly fails.  The parser still times out... and if I put a stop inside the IF and output the line, like so: [code=php] $line = fgets($log); if(!($line == "") & !($line == " ")){     echo "($line)";     exit();     parse($line, $server, $log, $current_round, $name_guid, $line_num); } [/code] Guess what the output is? [quote="Output"] ( ) [/quote] A SPACE!  What is wrong with PHP when it comes to strings.  Just as a note... I've also used === and strcmp to no avail.  Nothing seems to be able to compare strings. Any ideas? EDIT: As an added note... PHP doesn't seem to recognize this as a space ever... even though it is obviously a space based on the output.  If I use str_replace(" ", "A", $line)... I still get " " as the output. Ideas on why a space isn't a space?
  6. Do you have a database that you can use for this?  Or are you already logging the uploads to some sort of file.  If you don't have a database you can use a file to log the uploads, but that could eat away at page load times. The basic method I would use in this case is to start by creating an "index.php" page in the video upload directory.  That way when a person goes to that folder they will see that page instead of a file list.  Since I don't know your situation I'll finish off with a quick overview of the rest of the method until you provide the rest of the details: There are two ways to do this depending on if you only want to show files with info or if you want to show all files and include info if possible.  The former would simple require you to pull all rows from the database and list them out.  That will give a list of all files that are currently logged as uploaded.  The latter would use scandir() to get a filelist, and then for each file, query the database (the filename would be the primary key), and if a row is returned, output that info.  Otherwise it is a file with no info and you can simply display a link and output "No Info".  There are some other combinations of these methods that would produce other effects.  Let me know what your situation is and how you are looking to make it work and I can detail a specific method further.
  7. I'll put in a request to the helpdesk for my host.  They're usually pretty good about opening up the firewall if you have a legitimate need for something.
  8. Correct me if I'm wrong, but post variables go into the $_POST array, so you should change the line: [code] $req = (!isset($_REQUEST['req'])) ? 'default' : $_REQUEST['req']; [/code] to: [code=php] $req = (!isset($_POST['req'])) ? 'default' : $_POST['req']; [/code]
  9. You might also want to add "or die (mysql_error());" to your query to make sure it is executing correctly and to get an error if not: [code=php] $result = mysql_query("SELECT owner FROM pokeballs where id = '1'") or die (mysql_error()); [/code]
  10. Here's some code I cooked up, it's probably not the most efficient, but it should do it: [code="php"] //Select URLs from database? $sql_pages = mysql_query("SELECT pagelist FROM pagelist") or die(mysql_error()); $num_rows = mysql_num_rows($sql_pages); //Add all pagelists to array $count = 0; while($count < $num_rows){   $row = mysql_fetch_array($sql_pages);   $page_array[$count] = $row['pagelist'];   $count++; } //Select a random pagelist entry $rand_sel = rand(0, $num_rows); $rand_page = $page_array[$rand_sel]; [/code] I may have misinterpreted the question.  Is pagelist a list of pages for each entry in this table and you only want to compile an array for a single entries pagelist?  Or, are you trying to put all "pagelists" into an array (putting a database column into an array) - that is what the above code should do.  Disregard it if you are trying to do the former.
  11. What exactly is happening?  Is the query failing, but it's skipping the if statement?
  12. Any thoughts?  If you think it can't be done just let me know and I'll just have to buy more bandwidth and go back to downloading them to the web server before displaying them.
  13. The script will stop without any delays. That addition got it to spit out the error: "couldn't connect to host". Could it be that it doesn't like the trailing /, or could the host reject curl connections?
  14. Can you post the login form?  I'm used to login forms sending $_POST variables.  Could that be the problem, or does your login form process itself and then send the user to this validation page with the  POST variables as REQUEST variables? Though, if this is the case it should still go to default, but it seems like it's worth a shot.
  15. The host I use recently put some restrictions on mail() to avoid it being hijacked for spamming easily.  They require a good amount of headers to be submitted with the mail() for it to go through: [code="php"] $headers  = "From: MyName <".$fromemail.">\r\n"; $headers .= "Reply-To: <".$fromemail.">\r\n"; $headers .= "X-Sender: <".$fromemail.">\r\n"; $headers .= "X-Mailer: PHP4\r\n"; //mailer $headers .= "X-Priority: 3\r\n"; //1 UrgentMessage, 3 Normal $headers .= "Return-Path: <".$fromemail.">\r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "Content-Type: text/html; charset=iso-8859-1\n\n\r\n"; mail($toemail, $subject, $message, $headers); [/code] (you define $fromemail, $toemail, $subject, $message before this) This might be worth a shot if you are still having problems.  Otherwise you can try contacting your host to see if they have disabled it (or check the phpinfo() output to see).  Hope this helps.
  16. I'll field another open-ended question that I have been tangling with for a while:  Is there some way that I can display images off of a FTP server to a user without taking up my sites bandwidth or hitting a connection cap on the FTP server? The situation is that I have a game server that takes random in-game screenshots.  I want to let users see these screenshots from my website on a different server.  I have FTP access to the server, but there is no public HTTP server on it so that I could simply link the files without regard for anything.  The way I see it there are two options and each has a downside that I've seen. 1) Download the screenshots via ftp() to my web server and then display them from there.  This opens a single ftp connection and streams them down.  BUT, this consumes a HUGE amount of bandwidth as hundreds are taken a day at around 100-200KB each. 2) Show them via links to the ftp server in the form of ftp://user:password@folder/file.png.  This consumes no bandwidth on my web server, BUT I have recently run into problems with FTP connection limits.  I show 25 screenshots per page in my script to view the images, but on average half show up as deadlinks.  If you use IE and click Show Image, the image will load.  I tracked down the problem and it is the limit on the number of concurrent FTP connections.  My game server sees this at 25 separate connections and disallows some.  If the user manually tries to load it with Show Image it later works since there are no more connections. So, basically I'm looking for some php function or extension that could help to give me the best of both worlds.  Stream all of the images over one FTP connection, but don't download them to my website (thus, not bandwidth consumption).  Is there some way to do this?  Perhaps some way to load the images into the user's temporary cache before the php finishes and outputs the HTML? Thanks for any input!
  17. It's still just timing out on the curl_exec().  Here is the code.  This is from a test script I made and is the complete code for the page that i'm running (I just wanted to be sure it wasn't any of my code that was the problem). [code="php"]<? error_reporting(E_ALL); ini_set('display_errors', 1); //Stop the server $ch = curl_init(); $url = 'http://69.65.0.75:1400/stop/'; curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($ch, CURLOPT_USERPWD, 'x:x'); $r = curl_exec($ch); if (curl_errno($ch)){     print curl_error($ch);     exit(); } else{ echo "Test success."; } ?>[/code] Just to be clear, I don't actually get the php message telling me that the script has timed out... but after around 30 seconds the page just comes up blank and reports DONE. Also, I check my phpinfo(), and it is '--with-curl', so that shouldn't be the issue.  Here's the Curl Information just to be safe: "libcurl/7.15.3 OpenSSL/0.9.7a zlib/1.2.3 libidn/0.5.6".  Any thoughts?  Thanks. [b]edit(shoz): Removed login details[/b]
  18. Although I am further helping the off topic cause I would like to point out the complete falseness of the previous post. 1) You basically say "hey, he can get a file list of your computer instantly and it will be 3-10kb". A) I hope you don't beleive that.  Two things wrong.  First, you thing that an entire HDD can be indexed instantly.  It's not that simple to pull the contents of a HDD and organize them.  Run Google Desktop and see how long it takes to index your files (yes, I know it is making a much more complicated arrangement of data, but you get the idea).  Second, that text has little to no size bitwise.  I've dealt with many raw data extracts in my day, and I can tell you that even plaintext files can get really big really fast.  Indexing (just a text structure) for a 250gb could be 50MB easily.  Windows comes with a 10,000 file overhead, not to mention every program and personal file that you put on your computer.  Basically... this isn't going to be indexed instantly and it isn't going to to transfer instantly either. EDIT:  Just to give you an idea... I took your sample directory structure (just the filenames, no extra stuff)... and lets say... your hard drive structure is 100 times more than that VERY simple structure.  That makes a 19.3 KB file.  In reality... a 250GB hdd will have a dir structure that could be more in the order of 10,000 or 100,000 times more complex than the simple structure you posted (of one folder with 3 files... inside a few other folders) 2) Just upload a packet sniffer... keylogger?  In my experience only programs that are currently executing can actually access memory that is currently committed by Windows.  You can put anything you want into a user's temp Internet directories... but executing it remotely... I don't think so.  Not to mention that fact that even WINDOWS firewall will ask a user if they want to allow a program to access the internet to transmit data... let alone the much more secure 3rd party firewalls that most people have (ie: Symantec, McAfee, ZoneAlarm... etc). I suppose I'd prefer not to incite any more arguing on this topic, but I coudln't resist bashing back.  This always happens when the term "hacking" comes up.  A bunch of little kids pounce on it and claim that they are "ub3r-1337 h@x0rs" and talk about all the things they can do... when in reality they know nothing about computers and the boundaries of what is and what isn't possible.
  19. Ya, curl was hanging on exec.  I'll try that link out tomorrow and post up if I have any problems.  Thanks for everyone's help so far!
  20. Thanks!  Sorry it took me SO long to get back to this.  I went on vacation shortly after posting and it slipped my mind.  I'll try it out and let you know how it goes.
  21. Hi, I consider myself pretty competant when it comes to PHP and mySQL, but when it comes to the whole issue for HTTP headers, I'm pretty lost, so maybe someone can break it down a little bit for me. I have an idea of something I want to do and I think if it's possible HTTP Headers are the solution, so let me break this down: [b]Idea[/b]: Basically, I want to bypass some HTTP Authentication. The issue is that there is a page that simply executes a function, but to access it you need to log in with basic HTTP authentication. I'm running a PHP member system and want certain members to be able to use these pages, but want them to be transparent in order to simplify their use and hide the administrative password to them from the end users. [b]Execution[/b]: It seems to me that if this can be done it would be in the form of somehow presetting the HTTP Headers to make it seem like I had already submitted the username and password into the page. This is where I could use some help. Any ideas would be appreciated. [b]More background than you probably need[/b]: Here is the full situation. Basically this is an interface for a game server. The game server runs a Web interface called ServerDock which I have access to, and want to make some PHP functions to delegate functions to different users. Basically, you can stop and start the server using the links [a href=\"http://69.65.0.74:1300/stop\" target=\"_blank\"]http://69.65.0.74:1300/stop[/a] and [a href=\"http://69.65.0.74:1300/start\" target=\"_blank\"]http://69.65.0.74:1300/start[/a]. These prompt for a password and then once entered will simply perform their function and return nothing. My plan is to create a page that will call the STOP page and then the START page... so that users can seamlessly restart the server. I handle user security on my end, so the only access to this function would be through my authentication... so there are no security risks. Basically I want to prevent users from accessing advanced server settings that they may screw up and integrate this as semalessly as possible into my current system. I assume since these pages actually load some minimal content, I will call them using 2 iFrames within the page, so that I have a place for the returned content to be dumped without redirecting the actual page that the users access.
×
×
  • 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.