Jump to content

requinix

Administrators
  • Posts

    15,229
  • Joined

  • Last visited

  • Days Won

    427

Everything posted by requinix

  1. The name of the file doesn't matter: && time() - $cachetime only the modification time.
  2. I'm really not a tutorial or video kind of learner so I can't help you much there. Try breaking everything down into smaller pieces, one at a time. File sharing means that someone has to be able to upload a file, probably give it a name or description or something helpful like that, and then someone else has to be able to download it. So that's two questions right there: how do you upload files, and how do you make someone download a file? Then you need to find a way to restrict who can access the files. That means you have to be able to tell who the user is, and that means a sort of register/login system. Look for answers about how to make those. After that comes the problem of knowing whether the user can download a particular file, which means storing something in the database about which users can access which files. Don't forget your greatest resource: your teacher. Believe me when I say that most teachers love it when you come to them for help instead of just guessing your way through and making things up as you go.
  3. MySQL and "mysql" are two different things. Yes, the capitalization can matter when talking about PHP. MySQL is the database engine where all your data goes. "mysql" is the name of an old PHP extension that you can use to access MySQL. PDO is also an extension for accessing MySQL (and other database engines) but has many benefits over "mysql". The only difference between mysql and PDO, that matters here, is the code you write to interact with the database. Everything else is the same - the file sharing, the group projects, the user restrictions... So you can go about the project like you were originally going to/intended to and all you need to change is that your code uses PDO instead of mysql. Now, while I commend you on learning about PDO and recognizing you should try to use that instead, don't let it weigh you down. If you've been taught mysql and its mysql_* functions then you may need to go with that. Like if you're pressed for time. It'll take you all of 2 minutes to ask your teacher about using PDO in the project - maybe s/he doesn't want you to because they only have the mysql stuff installed (since extensions require a bit of installation). On the other hand, maybe s/he'll be excited that you went out to learn something else and will give you extra credit for it. Dunno.
  4. Don't hijack threads. Redirect doesn't work with query strings. You do, in fact, need mod_rewrite (unless you want to do it in ViewCatalogUI.aspx). RewriteCond %{QUERY_STRING} ^$ RewriteRule /ViewCatalogUI.aspx http://www.example.com/products [L,R=301] RewriteCond %{QUERY_STRING} (^|&)\.product=(\d+)(&|$) RewriteRule /ViewCatalogUI.aspx http://www.example.com/products/product-%2 [L,R=301]
  5. Every TR you add where? "Equivalent space"? Appears above the table that you're adding in the PHP code? Use your browser to see if the space is coming from a padding or margin, or potentially cell spacing or padding. That's the most likely cause.
  6. Have you checked to see if you're getting the right session ID in your browser?
  7. Calling session_id() before session_start() should do the trick. What's your code?
  8. Find the most useful or informative reply and hit its Mark Solved button.
  9. You might have some invisible badness near there. Shift+space sometimes creates non-breaking spaces, which PHP does not treat the same as regular spaces. Do you have the option to "show all characters" enabled? Turn it on and see if there's something unusual hiding around that line.
  10. current version of sql server sql server features
  11. There's nothing wrong with what you posted. What line had the problem? What editor are you using?
  12. You have to send actual XML. According to your example, which I'm very sure does not show all the information required to make this work, $curl_post_data = <<<XML <xml> <UserProfileID>weiuYhJxmeoQLsKvviPNzr==</UserProfileID> <Name>John</Name> </xml> XML;
  13. Upping the memory limit (I'd suggest picking a limit, rather an unbounding it) would be the easiest solution if you know that the array won't get even larger. Otherwise you can construct some of the JSON yourself. How are you building $data_array? If you're using a loop like $data_array = array(); for ($i = 0; $i < 10000000; $i++) { $data_array[] = $i; } echo json_encode($data_array);then you can output parts of it inside the loop rather than all at once after. echo "["; // or { for an associative array (don't forget to output the json_encode()d keys and their colons) $first = true; for ($i = 0; $i < 10000000; $i++) { // json does not support trailing commas like php does // and you can't do an implode(",", $array) here because of the memory usage if ($first) { $first = false; } else { echo ","; } echo json_encode($i); } echo "]"; // or }
  14. PHP will be run as whatever user started it. If you ran it yourself, manually from the command line, then it will run as your user. When run by a web server (eg, when accessed through a browser) then it will run as whatever user the web server is running as: Apache is probably running as LOCAL_SYSTEM (which does not have networking privileges, so I suspect this is your problem) while IIS will run as a specific user account dedicated it (like "IUSR" or "IUSR_machine"). The best solution that I know for Apache on Windows is to create a brand-new user account just for it - so much like how IIS runs. The account will have networking privileges by default and your script should be fine. From there you can even manage file and directory permissions.
  15. It will never exist because you keep overwriting the session value in the line above. The array only has the "number" in it.
  16. Well, there are three issues I can see: 1. No way to get more than one row from a query (besides a column). 2. Can't do more than one thing with a query. Like get a count of the rows before fetching them. 3. Can't reuse a prepared statement with multiple values. [edit] By the way, I'm only considering design. If I were to comment on other things, I'd say something about the PDO configuration (eg, disabling emulated prepares). Or how you could optimize in a few places by not using prepared statements if there aren't any parameters to pass.
  17. Learning is always worth the time.
  18. PayPal has a specific set of hostnames it calls from. You can lift the restriction for the right one(s).
  19. $db is undefined. Because variables defined outside functions are not automatically defined inside functions. letterIndex($db, 'A'); function letterIndex($db, $string) {[edit] Find your php.ini and set error_reporting = -1 display_errors = onRestart your web server if you had to change that. PHP would have given you an error about calling a method on a non-object, cluing you into the problem with $db.
  20. I'll put my money on some sort of AJAX-y navigation.
  21. The closure will be using whatever the value of links.href is at the time of execution. Which is long after that for loop has ended and i is past the end of links. 1. Don't assign closures directly to on* properties. Use the proper event registration system for the browser, which is addEventListener() for most browsers and attachEvent() for older IE. 2. Don't return false from the handler. Use the event object to stopPropagation and/or preventDefault. Again, IE is the village idiot: event.stopPropagation() for most browsers versus event.cancelBubble=true for older IE, and event.preventDefault() versus event.returnValue=false. 2a. To the point, the most common way around the value issue is another closure. links[i].addEventListener("click", (function(link) { return function(e) { alert(link.href); e.preventDefault(); }; })(link[i])); The outer function is executed immediately and returns the actual event handler. That inner function uses link which was defined when the function executed. 2b. However there's a simpler way of doing it. links[i].addEventListener("click", function(e) { alert(this.href); e.preventDefault(); }); Don't even need links at all. 2c. And if you started using a Javascript framework, like jQuery, it's even easier: $(function() { // replaces window.onload/window.addEventListener(...) $("a[href]").click(function(e) { alert(this.href); e.preventDefault(); }); }); Forget links entirely.
  22. mysql_error. Really. And you should be using mysqli or PDO instead of the mysql extension and its functions: PDO and mysqli are all-around better replacements to use, and even better they won't be removed any time soon (which is more than can be said about mysql).
  23. Not really. An inference engine builds upon existing information. If this thing was supposed to take the ruleset and learn more rules over time then that would qualify. Otherwise... I suppose maybe an expert system? In a slightly more than typical sense of the term. What is "such things"? Your rules processing or inference systems?
  24. Use mysql_error to find out why your query failed. Also, stop using the mysql_* functions and learn about PDO or mysqli (or both) and the prepared statements they offer instead. They're faster and easier and safer. Because what you have now has a big, glaring vulnerability that will let people completely ruin your site if they wanted.
  25. Except for the extensions, the basic rule would be "digits, symbols, and spaces", right? Then the extension might have "e" or "ext" or "extension" or whatever, followed by more numbers. ^[\d.-() ]+([extension]+\d+)$Doesn't allow slashes, doesn't allow letters not found in the word "extension" and even those have to be followed by just digits.
×
×
  • 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.