-
Posts
15,290 -
Joined
-
Last visited
-
Days Won
436
Everything posted by requinix
-
[^.] means anything that isn't a period. That will include slashes.
-
Not necessarily. I'm saying I don't know so experiment with it and find out.
-
I don't know the answer to this one. Create a file with a non-ASCII character, make sure that you can access it through the web server (without PHP), then see what readdir() shows you.
-
<VirtualHost *:80> If you're supporting HTTP and HTTPS, make sure you have everything on the HTTP side redirecting to the HTTPS side. So don't serve anything over HTTP except for redirects.
-
Can I assume the rest of the site works? Did you put these rules into your virtualhost configuration or .htaccess?
-
using GET to display universal content on one page only
requinix replied to ajetrumpet's topic in PHP Coding Help
Good question. -
Retreiving data from database upon change of textbox
requinix replied to ohad's topic in PHP Coding Help
Don't need to delete. You can just reply and say "oh, hey, by the way, figured it out, it was ___". -
using GET to display universal content on one page only
requinix replied to ajetrumpet's topic in PHP Coding Help
It's rare. It has some significant problems, and is only really excusable when you have absolutely no other choice. And there's always another choice. For the most part you should be storing the content in a representation-agnostic way. Meaning no HTML. For example, Markdown is popular because it allows an author to dictate structure (like headings and lists) without saying exactly what they look like. An application can then render the Markdown into whatever actual format, like HTML or RSS. Markdown is also a lot easier for non-technical people to read and write, and unlike HTML a malicious author cannot write anything that could compromise the website hosting the content. Your example could be written as # Page Header This is article 1's first paragraph of text. *  Side note: the page header should be separate from the content - you'll want it for <title>s and tables of content and other things. You can render it yourself easily enough. Even XML would be better than HTML (but it's not as easy to write). There are actual standards for this, but I'm too lazy to look them up for an example so <?xml version="1.0" encoding="utf-8"?> <content> <paragraph>This is article 1's first paragraph of text.</paragraph> <numbered-list> <item> <image src="image.jpg" caption="CAPTION" /> </item> </numbered-list> </content> You can transform XML into HTML with two steps: the first is writing a specific thing that an XML translation library understands (difficult) and the second is writing a bit of PHP code to perform the translation (easy). I did this once years ago as an experiment for a website. Rather fun. -
Remember? There's nothing to remember. Javascript is passing the value to PHP as a whole, not to a specific file. More technically, the value is in $_POST (because you're using the POST method) and that can be accessed from any PHP code regardless of which file the code lives in. It's just a reference to the character in my avatar.
-
using GET to display universal content on one page only
requinix replied to ajetrumpet's topic in PHP Coding Help
Virtually every single website on the internet works like this. In fact it's such a common thing, you should try looking for a tutorial on how to use PHP and databases, because one of those will cover the URL stuff automatically. $_GET (which is a variable, not a function) can give you the ID. You do a database query to find the information according to that ID. If found, you grab the data and display it on the page. (If not, you do something appropriate.) -
Retreiving data from database upon change of textbox
requinix replied to ohad's topic in PHP Coding Help
Please use the Code <> button when posting code. I fixed your first post earlier and your second post just now. And for the love of everything that's holy, if you're not using a license header then don't use a license header. $username = (DBOracle::getInstance()->get_user_details1($userid)); if(!$row) Look at those two lines. Read them to yourself out loud. If you can't see the issue, step away from the computer for a while, make a sandwich or play some games, then come back and check again. -
That doesn't make any sense. Anyway, you skipped over the most important part of what I said: you're trying to pass $pid as a parameter but your query doesn't have a placeholder for it. That means you need to reconsider exactly what is happening around there.
-
Why is the article number coming from the session? Shouldn't the query have a placeholder for the $pid?
-
Retreiving data from database upon change of textbox
requinix replied to ohad's topic in PHP Coding Help
Try using your browser's developer console to watch the AJAX request itself. Pull it up, go to the network or whatever area, then type in the box and click away, and you should see the request go to the server and the response come back. Then take a look at it. -
Retreiving data from database upon change of textbox
requinix replied to ohad's topic in PHP Coding Help
Modify your AJAX so that it can handle an error response - perhaps by console.log-ing the response - then see if you get an error message from PHP showing where the problem is. (Spoiler: there is an error from PHP) -
The syntax of a for loop is for (<initialization>; <condition to check>; <action to take on each loop>) { ... } For you, The initialization would be starting the $j variable at 2017 The condition to check is that $j is greater than or equal to (since it will be counting down) $mindate The action is to decrement (--) $j
-
So how about posting what you tried so you can find out what was wrong with it?
-
for($j=$mindate;$j<='2017';$j++) { That's what you need to change. It's currently counting from $mindate to 2017 by adding one to $j (that's what $j++ means) each time. You want that to instead count from 2019 to $mindate by subtracting one from $j (that would be $j--) each time. When you have that working, why 2019 specifically? Is it because that was last year? Since it says 2017 now, does that mean someone forgot to update it last year to say 2018? If you want the year to be dependent on the current year then you can have PHP do that automatically instead of having to edit the script...
-
If you want to change the values that $j gets then you need to change the code that gives values to $j. That will have been somewhere earlier in the script.
-
What is the path to the directory where you're putting your files, and exactly how are you "starting the server"?
-
Then the first thing you have to do is get an error message. Check your server error logs for why it's giving you a 500.
-
Submit button not clickable on mobile, works on PC
requinix replied to amateurcoder's topic in HTML Help
Seems to be working for me: I tap the button and I get validation errors. What browser and OS? Tried other mobile devices? -
prepared delete statement is not doing anything
requinix replied to DeckDekk's topic in PHP Coding Help
if ($stmt) { That will always be true. -
RewriteConds are important. Can't just decide to omit them for a Rule.