Jump to content

Alex

Staff Alumni
  • Posts

    2,467
  • Joined

  • Last visited

Everything posted by Alex

  1. Is it really necessary to use flash for the countdown? If it's a time countdown I think it would be more elegant just to use JavaScript.
  2. Here's my input: function wrap($text, $maxLineLength = 70){ $lines = explode("\n", wordwrap_cut($text, $maxLineLength)); $out = ''; foreach($lines as $line){ $out .= "# " . str_pad($line, $maxLineLength) . " #\n"; } return str_repeat('#', $maxLineLength + . "\n" . $out . str_repeat('#', $maxLineLength + ; } function wordwrap_cut($text, $maxLineLength, $break = "\n"){ $split = str_split($text); for($i = 0, $n = floor(sizeof($split) / $maxLineLength);$i < $n;++$i){ if(strpos(substr($text, $i * $maxLineLength, ($i + 1) * $maxLineLength), $break) === false){ array_splice($split, ($i + 1) * $maxLineLength, 0, $break); } } return implode('', $split); } $text = "1. Extract the zip files to a folder on your computer.\n2. Follow the instructions in readme.txt"; echo wrap($text); Output: ############################################################################## # 1. Extract the zip files to a folder on your computer. # # 2. Follow the instructions in readme.txt # ##############################################################################
  3. I've had a purebred beagle before. If I had to guess that's what I'd say.
  4. <?php if(isset($GET['id']): // ... else: echo $obj->get_content(); endif; ?>
  5. urlencode is a better choice because if there are other characters that need to be changed to work in the URL it will change them as well.
  6. You're comparing them fine, your program logic must be flawed, and we can't help you with that without seeing code.
  7. filesize($_FILES['file']['tmp_name']).
  8. . Read the documentation and find out.
  9. That's just a bunch of defined constants, it's not the session class definition. It should look something like.. class session{ ... }
  10. $str = 'ann.1275669173/sugg.1275669055/upd.1275668000'; $new = array(); foreach(explode('/', $str); as $part){ $s = explode('.', $part); $new[$s[0]] = $s[1]; }
  11. This is what he means: $result_right_sec = mysql_query( "SELECT `id`, `name`, `icon` FROM sec ORDER BY id ASC" ); do { if ( $r = mysql_fetch_array( $result_right_sec ) ) { $sec_name = $r['name']; $sec_id = $r['id']; $sec_icon = $r['icon']; $right_cat = "{$right_cat}"." <tr>\n\t<td height='20' width='130' valign='middle' align='right' dir='rtl'><a href=\"".( "javascript:ajaxpage('sec.view.php?id=".$sec_id."', 'main1');" )."\"".( "><b>".$sec_name."</b></a></td>\n\t<td height='20' width='24' valign='middle' align='center'><img border='0' src='{$sec_icon}' width='16' height='16'></td>\n\t</tr>" ); $result_right_cat = mysql_query( "SELECT `id`, `name`, `sec` FROM cat WHERE sec='".$sec_id."' ORDER BY id ASC" ); do { } while ( !( $rr = mysql_fetch_array( $result_right_cat ) ) ); $cat_name = $rr['name']; $cat_id = $rr['id']; $right_cat = "{$right_cat}"." <tr>\n\t\t\t<td height='20' width='130' valign='middle' align='right' dir='rtl'><a href=\"".( "javascript:ajaxpage('cat.view.php?id=".$cat_id."', 'main1');" )."\"".( ">".$cat_name. "</a></td>\n\t\t\t<td height='20' width='24' valign='middle' align='center'><img border='0' src='images/switchon.gif' width='12' height='12'></td>\n\t\t\t</tr>" ); } } while ( 1 );
  12. You mean like redirect them to it after upload? Post your code so we can help you.
  13. You should not rely on the mysql PASSWORD() function exactly for this reason. The hash returned by PASSWORD() was changed from 16 to 41 bytes in MySQL 4.1. Instead you should use a hasing function that you know will not change. Two such functions are md5 and sha1.
  14. You mean like create a thumbnail of the pdf? This can be done with imagemagick, if you have it installed.
  15. This isn't a php problem. Look into mod_rewrite.
  16. You can do that like this using something like this: $file = file('file.txt'); foreach($file as $key => $line){ ${'line' . ($key + 1)} = $line; } But I don't see any need for that. Why create extra variables when you can just access the lines like $file[0], $file[1], etc..
  17. This is what you're doing wrong: if ( $r = mysql_fetch_array( $result_right_sec ) ) { ... } while ( 1 );
  18. In that code you're using $sp1 before you're defining, which you obviously can't do.
  19. # starts another part of the url known as the hash. To use something like that in a GET variable it should be properly encoded. # = %23. Use urlencode.
  20. This. Otherwise every time you entered the command it would have to re-include the file, this isn't necessary.
  21. Use file_exists to see if a file exists already before recreating it.
  22. I know it's not directly on topic, but you shouldn't be storing passwords like that. It's very insecure and no one should register on your website if that's how you're storing passwords. I know I wouldn't. Instead you should be storing a hash of their password so that if your database is compromised the passwords are still protected.
  23. [tt]get_info()[/url] returns an array which is then used in your second function. You can't use preg_match() with an array.
×
×
  • 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.