oni-kun
Members-
Posts
1,984 -
Joined
-
Last visited
-
Days Won
1
Everything posted by oni-kun
-
PHP4 host but PHP5 code, don't know what to do?
oni-kun replied to budder's topic in PHP Coding Help
Yes, But Dreamweaver is bloatware for most developers who don't need all the pampered features. -
Advanced page handling. Need a little help.
oni-kun replied to PSYCHONAUT's topic in PHP Coding Help
What is the problem with this? Either add the "Successful" message along with the information of the image uploaded in session, or add a &done=true key for example at the end of the url to show it is done, whilst still on the admin.php?cmd=images. -
PHP4 host but PHP5 code, don't know what to do?
oni-kun replied to budder's topic in PHP Coding Help
http://www.phpfreaks.com/forums/index.php/topic,277416.0.html If you're on Windows, Netbeans or Notepad++ supports syntax/brace match highlighting. -
Contact form Mail lands-up only in spam or junk folder Help
oni-kun replied to dingi's topic in PHP Coding Help
$headers .= "Reply-To: [email protected] \n"; $headers .= "Return-Path: [email protected] \n"; -
The function ereg has been deprecated since PHP version 5.3.0 in favour of PERL compatable regular expressions. An example difference is this: eregi('expression'); preg_match('/Expression/i'); The documentation for the current function is here: preg_match
-
PHP4 host but PHP5 code, don't know what to do?
oni-kun replied to budder's topic in PHP Coding Help
It supports md5, sha1 and crypt, Although crypt()'s underline coding may have changed through versions, you can check the documentation. -
It wasn't right of me to nitpick at people, Yes, It is logically impossible to have a 'perfect', anything. Warning taken. I don't think picking at wrongs and rights will get me anywhere....
-
PHP4 host but PHP5 code, don't know what to do?
oni-kun replied to budder's topic in PHP Coding Help
Yes, You should look at the mysql_query format. All in all it doesn't matter, Performance wise it's in a fractional margin. You should turn error reporting to E_ALL during development with display_errors on, It should provide useful information instead of blank screens as well. -
Deprecating the working volenteered staff structure further.
-
Has anyone ever read those? Just because you have a habit of not reading rules, stickies and other important information doesn't mean nobody else do... Just as the OP has read the subjective description of the forum? I guess not! EDIT: See? It was moved. Maybe I know the rules better than the staff, Huh? No one is worth their salt apparently.
-
How about storing them in sessions instead of needlessly storing 81 values to the database per turn? Do what you wish to find if a block is false, isset, FALSE..
-
How about you post this in Misc? Why it is here is beyond me. EDIT: Has anyone ever read those?
-
Your function creates nine different objects after execution just for the purpose of editing one file, $xmlfile, You shouldn't put procedural code inside a function unless you require it to be flexible enough for other files, in this example it is redundant.
-
glob supports wild cards and file matching patterns, You'll find it simple to implement. The following code may not work without tweeking, but it seems simple: $username = glob($path.'___*.log'); $userinfo = glob($path.'___*_.log'); You can append array searches to $username and $userinfo arrays for your keyword exclusions.
-
That means you are using HTML within PHP tags. Close them or print the HTML.
-
http://www.php.net/manual/en/ref.image.php Why not look yourself? If you wake up you'd see you answered yourself long before. Why not read what some of the functions do.
-
You repeat the most redundant code, which does not help your.. "problem." Why not copy the image to another plane and save that? Obviously if it fails then it's not an image.
-
If you wish to tackle that imaginary problem, Why not verify the binary itself? class PNG_Reader { private $_chunks; private $_fp; function __construct($file) { if (!file_exists($file)) { throw new Exception('File does not exist'); } $this->_chunks = array (); // Open the file $this->_fp = fopen($file, 'r'); if (!$this->_fp) throw new Exception('Unable to open file'); // Read the magic bytes and verify $header = fread($this->_fp, ; if ($header != "\x89PNG\x0d\x0a\x1a\x0a") throw new Exception('Is not a valid PNG image'); // Loop through the chunks. Byte 0-3 is length, Byte 4-7 is type $chunkHeader = fread($this->_fp, ; while ($chunkHeader) { // Extract length and type from binary data $chunk = @unpack('Nsize/a4type', $chunkHeader); // Store position into internal array if ($this->_chunks[$chunk['type']] === null) $this->_chunks[$chunk['type']] = array (); $this->_chunks[$chunk['type']][] = array ( 'offset' => ftell($this->_fp), 'size' => $chunk['size'] ); // Skip to next chunk (over body and CRC) fseek($this->_fp, $chunk['size'] + 4, SEEK_CUR); // Read next chunk header $chunkHeader = fread($this->_fp, ; } } function __destruct() { fclose($this->_fp); } // Returns all chunks of said type public function get_chunks($type) { if ($this->_chunks[$type] === null) return null; $chunks = array (); foreach ($this->_chunks[$type] as $chunk) { if ($chunk['size'] > 0) { fseek($this->_fp, $chunk['offset'], SEEK_SET); $chunks[] = fread($this->_fp, $chunk['size']); } else { $chunks[] = ''; } } return $chunks; } } Simple 'nough to do other extentions verifying off JP2000 EXIF/alpha-ret. EDIT: Why does your code contain such redundancy?
-
$phpcode = file_get_contents('./foo.php'); print $phpcode; Why not test and view source? (FF may hide <? tags). And what exactly do you mean array?
-
Comment out imagepng/jpg/gif lines including header lines, and add error reporting. It will prevent the image from parsing, and send you an actual error. Obviously you can't see one if there is no domain for text to be displayed.
-
Add the following headers to the page the AJAX is calling: header("Cache-Control: no-cache"); header("Pragma: nocache"); That should eliminate caching on MSIE.
-
Why can't you use PHP's simplexml library to modify it?
-
$_SERVER['DOCUMENT_ROOT']; instead of traversing back one directory.
-
I see you're working with German titles too, If in case there's an accented character you can always use iconv: $string = "ABBĀSĀBĀD"; echo iconv('UTF-8', 'ISO-8859-1//IGNORE', $string); // output: ABBSBD echo iconv('UTF-8', 'ISO-8859-1//TRANSLIT//IGNORE', $string); // output: ABBASABAD