Jump to content

para11ax

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

About para11ax

  • Birthday 08/07/1986

Contact Methods

  • Website URL
    http://www.clan20.com

Profile Information

  • Gender
    Male
  • Location
    Columbus, OH

para11ax's Achievements

Newbie

Newbie (1/5)

0

Reputation

  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.
×
×
  • 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.