Jump to content

Irap

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

Irap's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Don't worry, I fixed it by changing my password to "Password1".
  2. I always assume a site doesn't hash my password, which is why I don't go posting my ultra-secure password on any old site and use my normal password on other things. Mixed case and numbers don't equate to a good password: 0bv10us 1337King B008s Abc123 Area51 Area69 Fiesty1 Link182 Error404 Password1 P455w0rd Sims3 Etc.. Not that I've ever tried any such thing and it worked, ehem It's just a personal thought. I can't imagine that constant password resetting is exactly a good thing. Anyway, I meant "Thanks for the help, anyways." to be a confirmation of the question being answered
  3. Hey, it was nothing personal. Why wouldn't I want to come here (not that I come here much anyway)? The problem is, I'm having difficulty coming here. The requirements only act as an accessibility problem for me. But as we all should know, mixed capitalisation and numbers does not equate to a good password. My "normal websites" password has never failed me. But that's not something I expect you to need to understand, it not being your password and such. Thanks for the help, anyways.
  4. Bloody phpfreaks.com is annoying with it's insistance on having a password with "a mixture of upper and lowercase letters" etc. Because of this I've had to reset my password every time I've posted here. My password is nice and secure with only lowercase letters (I use my secure password for things I really care about keeping secure). Password requirements is a stupid move on any site. Anyway, I'm from the UK and I find this date/gmdate thing very odd. As far as I'm aware, I'm in GMT. When I use gmdate, everything is fine... but apparently gmdate doesn't change to reflect daylight savings... However, date() is off by an hour most of the time. So what the hell do I use? Do I have to manually get whether daylight savings is in effect and then choose which one to use? I'd probably be able to figure it out myself.. but it'd take a year
  5. Hi, I have this very simple code... <?php echo "<code>"; $hFile = fopen("myfile.ini","rt"); while(!feof($hFile)) { $string = trim(fgets($hFile,); $c = substr($string,0,1); if($c!="[" && $c!="\n" && $c!="\r" && $c!="") { $i = crc32($string); echo printf("%8X", $i) ."=". $string ."<br/>"; } } fclose($hFile); echo "</code>"; ?> However, it's returning results like this: 4C20553D=4NATION 7BE5EF8C=4RIP EAAD529E=4SPIDER 4EB7AFA2=4WEED 7367626=4_OR_14 83101629=5CROSS When I wanted leading 0's, like this: 4C20553D=4NATION 7BE5EF8C=4RIP EAAD529E=4SPIDER 4EB7AFA2=4WEED 07367626=4_OR_14 83101629=5CROSS I've tried "%.8X", which I figured would work... but it just turned all the hashes to 0. Also, which other varients of CRC are commonly used? The results I am getting are not what I expected as from another program...
  6. I prefer to have it there as a "just in case" measure. There has also been times when PHP Notices have appeared in the file and there's not much to bother doing about that. Thanks for the help, anyways.
  7. Heh, I thought I had used content type. The problem with PHP outputting errors is that it messes up the file that is being printed. As they say, don't output anything else besides from the file data when using header() to output files... Otherwise you get an error at the start of the file.
  8. Try replacing your query with: SELECT * FROM `uploaded_instructions` WHERE `title`={$file_name_no_ext} `table_name` is good to use as you might end up typing SQL keywords, invalidating the query... "title" could be one. I like to add {} to make PHP parse the $file_name_no_ext properly (and not use it as raw text). I like to think that should be the standard. If that doesn't work, make sure the tables "uploaded_instructions" and "title" actually exist within your table. I've found that I often get the table names muddled.
  9. The file being outputted is a .rar # $file['filename'] = "myfile.rar"; // given by database $file['extension'] = substr( $file['filename'], -3 ); // Set the mime according to the extension. // I believe these are appropriate mime types to use. if ( $file['extension'] == "rar" ) { $file['mime'] = "application/x-rar-compressed"; } elseif ( $file['extension'] == "zip" ) { $file['mime'] = "application/zip"; } // Added the if statement just in case the above wasn't working. if ( $file['mime'] == "application/zip" || $file['mime'] == "application/x-rar-compressed" ) { mysql_query(" UPDATE `web_downloads_mods` SET `downloads` ='{$file_mod['file_downloads']}' WHERE `id` ='{$file['id']}' LIMIT 1 "); @header( "Expires: ".gmdate("D, d M Y H:i:s", mktime(date("H")+2, date("i"), date("s"), date("m"), date("d"), date("Y")))." GMT" ); # expire the file in 2 hours. @header( "Last-Modified: " . gmdate("D, d M Y H:i:s", $file['uploaded']) . " GMT" ); @header( "Content-Length: {$file['filesize']}" ); # given by the database in bytes. @header( "Content-Disposition: attachment; filename='". $file['filename'] ."'" ); // Internet Explorer compatibility: @header( "Pragma: " ); @header( "Cache-Control: " ); readfile( "http://". $_SERVER['HTTP_HOST'] ."/uploads/". $file['filename'] ); } Firefox will open the file in a new tab and display gibberish... Except, of course... At the beginning of the file there is a fun "Rar!". Is this something that occurs in many files and can be used to test if files are the right extension?
  10. I would guess a table called "topic_views" or something that logs each users last topic viewed time individually. member_id - topics_read 1 - 12;14;16 12;14;16 = each number is a topic id exploded and checked.
  11. Irap

    A New [code]

    ... I notice my whole last post messed up, but I'm unable to edit. Anything I'm able to do about this?
  12. Okay... Fixed it. ini_get('upload_max_filesize'); Seemed to return a filesize in MB followed by M (8M). $MAX_FILE_SIZE = ini_get('upload_max_filesize'); $NUM_SIZE_VAL = strpos($MAX_FILE_SIZE,"M"); $MAX_FILE_SIZE = substr($MAX_FILE_SIZE, 0,$NUM_SIZE_VAL); $MAX_FILE_SIZE *= 1024; if($MAX_FILE_SIZE >= 15360){ $MAX_FILE_SIZE = 15360; }
  13. I added: $ext = substr($filename, strpos($filename,'.'), strlen($filename)-1); $ext = str_replace(".rar", "rar", $ext); $ext = str_replace(".zip", "zip", $ext); But now it returns: The file you attempted to upload is not allowed. Unlike before... The array is set to scan for ".zip" or ".rar" anyway. Not "zip" and "rar". The main problem was the filesize limit issue, anyway. It says: Warning: filesize() [function.filesize]: stat failed for 6544 in upload.php on line 39 And I want there to be a limit on the filesize. Code: $file['file_size'] = $_FILES['file']['size']; // < unused if(filesize($_FILES['file']['size']) > $MAX_FILE_SIZE) // < line 39 { die('The file you attempted to upload is too large.'); }
  14. Irap

    A New [code]

    Maybe I can finally fix this here. There's a coding language that has it's own code-like tag on my forum. Most of the code works, but there are many bugs with it. I can't quite figure out how to do numbers either. The main problem is, when I use PHP to and <span> HTML, the HTML often becomes part of the search. I've been using preg_replace, not preg_match (I find it a little more confusing). Maybe that's the problem... Another problem is when certain parts match twice for different things. I need a way to tell the difference of which to do. [code=php:0]// HEX Numbers. $code = preg_replace( '#\b(0x([0-9a-fA-F]+))#i', "<span class='code-number'>\\1</span>", $code ); // Numbers *broked* - doesn't replace always, sometimes displays HTML. // $code = preg_replace( '#\b([0-9.]+)\b#', "<span class='code-number'>\\1</span>", $code ); // special variables (12@) // Want this to be compatible with arrays 12@(4,25int) $code = preg_replace( "#(([0-9]+)@)#i", "<span class='code-variable'>\\1</span>", $code ); // Variables ($var) // Want this to be compatible with arrays $var[23] $var(23,25int) $code = preg_replace( '#((\$|\&)([a-zA-Z0-9_]+))#', '<span class=\'code-variable\'>\\1</span>', $code ); // Label or Label pointer (@label - :label) $code = preg_replace( "#((@|pzcolon)([a-zA-Z0-9_]+))#i", "<strong class='code-lable'>\\1</strong>" , $code ); // line comment - bug: changes colour within the comment ("text" would be red). $code = preg_replace( "#(//(.*?)\n)#i", "<span class='code-comment'>\\1</span>" , $code ); // block comment - bug: doesn't change if is reached before \n. $code = preg_replace( "#({.*?})#is", "<span class='code-comment'>\\1</span>" , $code ); // Strings ("") - seems to work smoothly $code = preg_replace( '#("(.*?)")#', '<span class=\'code-string\'>\\1</span>' , $code ); // #TEXT - #421numbers29 $code = preg_replace( "#(\#([a-zA-Z0-9_]+))#i", "<strong class='code-number'>\\1</strong>", $code ); // Replace HTML ' with " so that the string replace can be performed safely. $code = preg_replace( "#(class='code-string')#", "class=\"code-string\"" , $code ); $code = preg_replace( "#(class='code-comment')#", "class=\"code-comment\"" , $code ); $code = preg_replace( "#(class='code-lable')#", "class=\"code-lable\"" , $code ); $code = preg_replace( "#(class='code-number')#", "class=\"code-number\"" , $code ); $code = preg_replace( "#(class='code-variable')#", "class=\"code-variable\"" , $code ); // Strings ('') $code = preg_replace( "#(\'(.*?)\')#", "<span class=\"code-string\">\\1</span>" , $code ); // Keywords $code = preg_replace( "#\b(if|and|wait|return|downto|else|end|false|true|for|hex|not|or|repeat|then|to|unknown|var|until|while)\b#i", "<strong class='code-keyword'>\\1</strong>" , $code ); $code = preg_replace( "#\b(classword|classword2|myclassword|anotherclassword)\.\b#i", "<strong class='code-class'>\\1</strong>." , $code ); $code = preg_replace( "#\.\b(commandword|commandword2|mycommandword|anothercommandword)\b#i", ".<strong class='code-command'>\\1</strong>" , $code );[/code]
  15. <br /> is a HTML, which will make things you can see in the page start a new line. However if the text isn't formatted (and is a plain text file or the source of the HTML file) \n will start a new line with no characters visible. so: echo "<b>Test</b>\n<i>Hello!</i>" Would print out: Testhello But the source of the file, would print: <b>Test</b> <i>Hello!</i> Wheras: echo "<b>Test</b><br /><i>Hello!</i>" Would print: Test Hello! But the source code would be: <b>Test</b><br /><i>Hello!</i>
×
×
  • 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.