Jump to content

requinix

Administrators
  • Posts

    15,267
  • Joined

  • Last visited

  • Days Won

    431

Everything posted by requinix

  1. I think you're creating something far more complex than you actually need.
  2. If you want to send something to the browser then there must be a connection open. Which is what the spinning circle is telling you. If you don't want the spinning circle then you need to keep the open connection over something like AJAX or a WebSocket. Which is a different (but better) design than what you have right now.
  3. Yes: identify what the problem is with the header and adjust your code to make the problem go away. If you weren't aware, the filename can't have any sort of directory path in it.
  4. I'm not sure exactly what the problem you're facing is, but if you want ideas for how to clean up the code... Instead of trying to build the whole query at once, build the pieces of it and then assemble it at the end. In your case it seems the only concern is the WHERE conditions. Use an array to track all the conditions you want, then join them together with ANDs to get the full clause, then add that in to your main query. Goes like $conditions = []; if ($some_condition) { $conditions[] = "some condition"; } if ($other_condition) { $conditions[] = "other condition"; } // ... if ($conditions) { $where = "WHERE " . implode(" AND ", $conditions); } else { $where = ""; } $query = " SELECT fields FROM table {$where} ORDER BY fields LIMIT whatever ";
  5. If you don't know any PHP then the first step is to learn some PHP. There are plenty of resources on the internet to do that, and you're going to be the one who knows what learning style works best for you. Maybe you like those online "academy" things. Or maybe YouTube videos. Or maybe online tutorials. They're all different styles for different people.
  6. Browsers are liable to ignore a Content-Disposition header if it suggests a bad filename. Look into whether that's the case for you.
  7. Since your code is already written to assume there is a $link variable it can use, and since the name of the parameter there is also "link", you don't need to do anything else. At least not anything inside the function. Since it requires an argument, you do have to pass that value into it when you call the function. Which happens to be a variable also named $link. Note that's two different variables: the one on the outside is separate from the one on the inside, and they just happen to be named the same thing. Just like with people.
  8. Variables defined outside of functions are not available inside of functions. Pass $link as a function argument.
  9. I don't care. If they can't remember their passwords then it's their fault. It's not your job to give them easy to remember passwords. Anything that suggests using MD5 for passwords is bad and you should never, ever look at again. Aren't you going to tell the students their passwords? I don't care how "sensitive" you think this is. A password is a password and there is no excuse for doing it wrong.
  10. Don't use their student numbers. If you create passwords based on something any student can know, then you create passwords that any student can know. Create a random password. It takes no effort to do this, and there is absolutely no good reason to do it the dumb way when a better way is available and easy. bin2hex(random_bytes(6)) That's all it takes.
  11. Have you already started by understanding how SOAP works in PHP? Seen the extension and examples for how to use it?
  12. Keep thinking. If the one column is unique then any search including that column will be able to find the corresponding row...
  13. Please, PLEASE do not make me answer your implied question about where you should generate a password. Because I will not be polite. AllowOverride is about whether (sub)directories can use .htaccess files. This sort of authentication is automatically remembered by your browser. You don't have to do anything to make that happen. Passwords are not encrypted. They are hashed.
  14. That's a step in the right direction but you still have a ways to go. We aren't going to write this code for you, and people generally are not willing to guide you every single step of the way. You need to show initiative and a willingness to learn. So keep going. You're doing fine so far. You will need to learn some PHP. It also seems like you're going to be dealing with file uploads, which PHP can certainly do, but I didn't get the impression that you needed it for this. Then again, you didn't really go into any sort of detail explaining how this work or what it is all about, so I don't know.
  15. You should probably do something about that.
  16. It is. Try going to http://www.website.com without my changes and make sure it redirects. If so then you can disregard.
  17. Does the python script output anything as it goes? Are you trying to return that output?
  18. You might be able to do just that, yes. "Might" because we have no idea what your application is. As long as it isn't trying to link to itself as "http://www.website.com/page.html", and is just using server-relative paths like "/page.html", then everything should continue working. If it is using "http://" links then those have to be fixed manually. You should also support redirecting from http to https, though. All you need to do is add another condition to the redirect already there to say that it should happen if the URL was http or website.com. Which I would write differently: RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} !www.website.com RewriteRule ^ https://www.website.com%{REQUEST_URI} [L,R=301]
  19. This isn't image preloading 😕 Look at your myFunction. Look at the way you call the function, then at what happens inside the function. Pay attention to the variables.
  20. Set it up as a submodule, or install it to the build host manually and reuse it that way, or write your common build code as extensions to Jenkins directly.
  21. By finding the correct name according to wherever you're installing from. Those flags are for compiling PHP. You are not compiling PHP. If you were able to install everything, except ext/sockets, then apparently you were able to install everything.
  22. Yeah. Sure. Of course it's possible. Are you able to generate an HTML page that outputs what you want? It's not that hard. If you can do that then you can generate an XML page. Give it a shot, and if you have problems with your code then post it here with a description of what's wrong and we can help you with it.
  23. Not necessarily. Tons of websites out there are heavy on images, and many of them need those images to be available soon. You don't - we're talking about a textual book with some illustrations, not a picture book. (Even if it was a picture book, people only read one page at a time.) Meanwhile text isn't particularly strenuous on browsers. 40 pages * 500 words/page * 10 characters/word (spaces, punctuation, some HTML markup) = 200,000 characters. A fraction of a megabyte. So don't worry about it. Not yet. 40 pages could be a lot for a mobile device, so for that it would be worth considering paginating the content. Perhaps on desktop too, if you want the aesthetic of it. Unless pages are important concepts you need to account for, and you should try to avoid that if you can (pages are just so arbitrary), then you don't need to break it down beyond chapters. Worry about AMP later.
  24. Look more closely at the array you have to work with. $arr is an array, containing a "global" that is an array, containing a bunch more arrays, some of which have "div" in them. Now look at your code, which I'm going to paste here so that people don't have to go somewhere else on the internet to find it: $split = []; $i = 0; foreach($arr as $k => $v) { if ($v == 'div') { $i++; } $split[$i][$k] = $v; } Your code looks at what's in $arr and tries to find anything that is the string "div". Your array and your code are pretty far apart.
×
×
  • 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.