Jump to content

Daniel0

Staff Alumni
  • Posts

    11,885
  • Joined

  • Last visited

Everything posted by Daniel0

  1. I don't understand how that would be a problem. Just generate the link like you would with any other link. E.g. instead of echo "<a href='game.php?id={$id}'>Game</a>"; you could do echo "<a href='{$name}.html'>Game</a>";. Note: You need to make sure that there aren't any spaces and such in the name of course. You could use a regular expression or str_replace to remove all characters other than a-zA-Z0-9 (you could use _ for spaces).
  2. I'd probably say 7. It looks pretty good, but there is something wrong with your footer (see screenshot1.png). I also think you should align your navigation links to the left instead of right and you should center the date vertically. Also, find some other way of signifying required fields at the registration page. [attachment deleted by admin]
  3. Looks really great. If you click the "Get quote"-button without entering anything, then you'll get a lot of errors on that page.
  4. I believe that Firefox is correct in serving the page whether the 404 header is there or not.
  5. It is probably if (cf_455 = 1) { which is wrong. It should probably be if ($cf_455 = 1) {
  6. If you need to delete a cookie, then just set it's expiry time to something in the past. E.g. time()-3600 (an hour ago).
  7. If you have PHP5, then scandir() is easier.
  8. Sounds like mod_rewrite is what you need.
  9. Here is what you could do: 1. User purchases a file 2. Script generates random unique download link (e.g. download.php?key=F9ah2fh287faHfAhk). This download link only works ONCE meaning if the go to it they will only have one chance of downloading it. 3. Give the link to the user. Inform them about the restrictions. 4. User clicks the link. 5. Deactivate link and then serve the file dynamically in a way like this: <?php // connect to db $db_link = mysql_connect('localhost', 'root', ''); mysql_select_db('store', $db_link); // check that key is set if(!empty($_GET['key'])) { die("No key given"); } // prepare it for sql $key = mysql_real_escape_string($_GET['key'], $db_link); // get link and file info $result = mysql_query("SELECT l.*,f.* FROM download_links AS l LEFT JOIN files AS f ON f.file_id=l.link_file_id WHERE l.link_key='{$key}' LIMIT 1", $db_link); if(mysql_num_rows($result) != 1) { die("Invalid download key"); } $link_info = mysql_fetch_assoc($result); // delete link. it's not valid anymore mysql_query("DELETE FROM download_links WHERE l.link_key='{$key}' LIMIT 1", $db_link); // serve file to user header("Content-Type: {$link_info['file_mime']}"); header("Content-Disposition: attachment; filename={$link_info['file_name']}"); header('Content-Description: File Transfer'); header('Accept-Ranges: bytes'); header("Content-Length: {$link_info['file_size']}"); readfile($link_info['file_path']); ?> Table download_links contains these fields: link_id, link_key, link_file_id Table files contains these fields: file_id, file_name, file_path, file_size, file_mime 6. User downloads file 7. User sends the link to his/her friend. 8. Friend tries to download and gets this message: "Invalid download key" I believe that this would prevent users from download the file multiple times and from sharing the link with their friends. The user could still send the file to their friends though...
  10. Read this (code too): ======= Try this: <?php $text = file_get_contents('testFile.txt'); $paras_2 = array_slice ( explode ("\n\n", str_replace(array("\r\n","\r","\n",$text)), 0, 2 ); echo join ('<br><br>', $paras_2); ?>
  11. Try: <?php $a= 1; echo $a; ?> Duh... where are the single-quotes in your script? You said they'd work with variables...
  12. Note: You still need to filter out the HTML. You can do it by running htmlentities() before the above function.
  13. Instead of doing an IP check (regarding file deletion), make users able to specify a file password. They could then attach the file to their account if they later chose to register and they would need the password in order to delete the file if they are unregistered.
  14. Here is what you could do. It should work: <?php function parse_bbcode($t) { // line breaks $t = nl2br($t); // Basic formatting $t = preg_replace("`\[b\](.*)\[/b\]`sUi","<b>\\1</b>",$t); $t = preg_replace("`\[i\](.*)\[/i\]`sUi","<i>\\1</i>",$t); $t = preg_replace("`\[u\](.*)\[/u\]`sUi","<u>\\1</u>",$t); // URLs $t = preg_replace("`\[url\]([\w]*[:\/\/]*[\w\.\?\/&=\:;, \-@%\?]+)\[/url\]`sUi","<a href='\\1'>\\1</a>",$t); $t = preg_replace("`\[url\=([\w]*[:\/\/]*[\w\.\?\/&=\:;, \-@%\?]+)\](.*)\[/url\]`sUi","<a href='\\1'>\\2</a>",$t); // Images $t = preg_replace("`\[img\]([\w]*[:\/\/]*[\w\.\?\/&=\;, \-@%\?]+)\[/img\]`isU","<img src='\\1' alt='User posted image' />",$t); return $t; } $text = <<<EOF [b]bold[/b] [i]italic[/i] [u]underline[/u] [url]http://google.com[/url] [url=http://google.com]Google[/url] [img=http://www.google.com/intl/en_ALL/images/logo.gif] EOF; echo parse_bbcode($text); ?>
  15. This function will allow you to create directories infinitely deep: <?php function mkdir_recursive($folder) { $folders = explode('/',str_replace('\\','/',$folder)); $temp_folder = null; for($i=0; $i<count($folders); $i++) { $temp_folder .= $folders[$i].'/'; if(!is_dir($temp_folder) && !file_exists($temp_folder)) { mkdir($temp_folder); } } } ?>
  16. You could filter some tags out (using black-/whitelists) or you could use BBcodes. BBcodes would probably be safer since you could then block all HTML tags and only parse the BBcodes which you have defined.
  17. You could start with showing us some code so we can see why it doesn't work
  18. And it triggers syntax highlighting within the -tags on this forum...
  19. That's exactly what jitesh just said...
  20. Try change the query to SELECT brand_name FROM engsoon_brands WHERE brand_name='$brand_name' OR bid='$bid'
  21. Perhaps it's time to turn the word filter off...?
  22. http://www.daily-sudoku.org/ - 11.427s - 2.215s http://www.daily-sudoku.org/sudoku/tournament.php?t_id=6 - 4.672s - 2.322s http://www.daily-sudoku.org/sudoku/monster.php?t_id=2 - 4.665s - 2.205s First time is with empty cache, second time is with full cache. The first page is quite large (415.7 kb) to download. Location: Denmark
  23. Instead of using <img> tags as bullets, you might want to actually use an unordered list (<ul>) and then change the bullet using CSS. The places I'm talking about is places like the login form and the box saying stuff like "Share files with all of your friends and upload them only once". Also, it's called "sponsor", not "sponser". How can the server load suddenly go from "low" to "high" and then to "low" again. (after each page refresh). When the page has been uploaded: The delete image (http://www.myportabledisk.com/images/ico_delete.gif) needs background transparency or a background similar to the container. On the front page: The "help" icon (http://www.myportabledisk.com/images/question.gif) has the same issues as the above image.
  24. <?php var_dump(extension_loaded('curl')); ?> What does that output? Also, have you tried adding the path of your PHP installation to PATH?
  25. It does work for me. <?php class SessionData { private $values = array(1, 2, 3); public function getValues() { return $this->values; } } $currentData = new SessionData(); $bob = $currentData->getValues(); print_r($bob); ?> Outputs Array ( [0] => 1 [1] => 2 [2] => 3 )
×
×
  • 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.