-
Posts
15,266 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
They're local times. Somehow. Not sure, but I can't find anywhere to set a timezone for myself so I assume the tooltip is set by Javascript.
-
If you store data in the session then you won't look it up in the database, and that means you won't know if it changes. If a user was logged in and you stored that they had a deluxe membership plan, what would happen if that plan changed? Or ended? You would continue using the deluxe plan and the user would have access they should not.
-
That would be nice. If it were possible to do easily I'd do it right now, but it's likely yet another nice feature they decided (in their infinite wisdom) to remove, forcing anybody who wants it to have to buy some paid plugin. I suggest quoting yourself. edit: I'm editing a question into my post. Can you see it?
-
Then you changed something else in that class, because it wasn't doing this before. Fix the syntax error and try again.
-
Unfortunately I don't really have tips or tricks to pass along. I can mention phptherightway.com as a good resource, but it isn't totally comprehensive. For now, make sure you avoid articles and tutorials from some random person's blog and instead try to hit up the more reputable sites that perhaps you've already heard of before. catch (PDOException $e) { /* If there is a PDO exception, throw a standard exception */ throw new Exception('Database query error'); } Don't do that either. You're taking a perfectly good exception and then discarding everything it has to offer and replacing it with a mere "Database query error". Remove the whole try/catch and see what happens.
-
Have you considered trying to use mysqli_error() to find out what went wrong?
-
$user->password = base64_encode($_POST['password']); $user->password = base64_encode(isset($_GET['password']) ? $_GET['password'] : die()); No. No base64_encode. Don't do that. $_GET['password'] That is incredibly bad. Do not put the password in the URL. That's... I don't know why this code even exists. Make the problem go away by changing the form to use method=post. I really, really shouldn't have to say that.
-
I see three blue colors: navy blue with writing, light blue with writing, and the dark blue/gray with images. I can't figure what you're describing according to that. I'm guessing that you want to have text + image / image + text alternating on desktop and then just text + image on mobile. Is that it? Rearrange everything in the markup so that it is correct: text first, image second. Desktop is where you should be making it read backwards. Do that by using looking into whatever options your CSS framework gives you regarding repositioning inside its grid system; if there isn't anything then use order.
-
How do you sync PHP code with Social Media, to show 'followers'?
requinix replied to simona6's topic in PHP Coding Help
Are you sure you need to do this from PHP? There should be a client-side API that embeds some Twitter information if you give it a username. -
different logins for different directories - one landing page
requinix replied to ajetrumpet's topic in PHP Coding Help
So don't password-protect the root... -
different logins for different directories - one landing page
requinix replied to ajetrumpet's topic in PHP Coding Help
You have a directory called ".htpasswds" that already exists? Then there is some mechanism already in place to do what I'm talking about. Do you see anything about password protecting directories in CPanel? -
different logins for different directories - one landing page
requinix replied to ajetrumpet's topic in PHP Coding Help
Yes, it's true that we do like quick answers, but only to quick questions: very often the background information is not just useful but even significant and can affect what advice should be given. Your criteria are that you have an authentication system that is applied for individual directories where one username and password (each) is sufficient, and that you are using Apache. Right? https://cwiki.apache.org/confluence/display/HTTPD/PasswordBasicAuth You can set up a single file containing all the information for all the directories, each one with a different "username", then instead of Require-ing any valid user, you require the specific "username" for that directory. -
different logins for different directories - one landing page
requinix replied to ajetrumpet's topic in PHP Coding Help
So the answer to the question I asked is "no, I do not want a different username/password for each person". Let's try another one and see if we can reach the answer with fewer posts this time: Are you using Apache? -
It will be either a string or an array. If you want to protect against that, a simple is_string() will suffice.
-
If it's a string then it won't be ===false. Because it's a string. Same for ===null. Maybe what you're looking for is isset($_POST["whatever"]) && trim($_POST["whatever"]) != ""
-
You have two forms, one to let you open the file and another to let you save contents to the file. The first form has the filename, the second form has the file contents. The question for you is: why would the second form also have the filename? You didn't put a filename in there. It's just the textarea. Your browser isn't going to take the filename from the first form and include it in the second form's data. So put both into one form. Filename and file contents. Put the two buttons into the form too. Since it's just the one form now, you'll need a different method to determine what your code should do. Solve that by giving a name to your button, and you might as well use the same name for both since the user can only click one of them, then checking (a) if $_POST has that button and (b) what value it has. Side note: <button> buttons are better than <input> buttons. <button type="submit" name="action" value="open">Open</button> But before you do any of this, open up your php.ini (should be where you installed PHP), find the error_reporting and display_errors settings (the real settings, not the ones that are part of the documentation inside the file), and set them to error_reporting = -1 display_errors = on Then restart your web server and try running your code as it is right now. You should see a number of error messages. Do the changes I said above and run it all, then if you still see errors you need to go in and start fixing them.
-
different logins for different directories - one landing page
requinix replied to ajetrumpet's topic in PHP Coding Help
Yes, a different username and password for the different directories, but do you also need a different username and password for each person? If so, how many people and do you need a full user system where they can log in and change passwords and whatever, or can you simply assign them passwords and that's the end of it? -
What do you mean by "save the changes"? What is supposed to be saved? Where?
-
how to debug the phpBB-forum software: i allways get 500 error
requinix replied to dil_bert's topic in Applications
I don't. You have no business trying something like installing software on a server. But I can't stop you. So if you're going to anyway, don't do anything except what the installation guides tell you to do. Don't touch files, don't go snooping around for stuff you won't understand, just forget it all exists and follow the steps to install. You probably messed something up. Delete all the files and start over again. -
How do I query a DB Table's field, selected by variable as column name?
requinix replied to simona6's topic in MySQL Help
Moved to MySQL. You address this problem by refactoring your application so that the problem doesn't exist in the first place. Storing the platforms as individual columns is not a good idea. For one, it puts you in the situation you're in now. For two, it makes it harder to support whatever platform will be popular next year. You can generalize each platform as having a URL to the user's page. Probably don't need much more than that. Create a table that lists all the platforms you support, with an ID (like every table should have) and a nice name. Want to support a new platform? Add a row. Then create a new table that contains a row for each combination of user and platform URL; if the user has a Facebook and a YouTube page then there will be two rows in this table. Add to that this concept of a number of followers. That's two new columns in the second table: one for the minimum and one for the maximum numbers. Or whatever. Then querying is easy. -
Did you install the PHP sources too?
-
Fortunately PHP 7.4 won't let it happen.
-
If you process credit cards then you can find out whether the charge was successful immediately. No problem. Some other payment methods are instant like that. For payment methods that are not instant then you need to tap into some mechanism where they notify your site of a change. For example, PayPal has IPN which pings your site when activity happens with a transaction. You thank the user for the payment and then wait for the IPN message that confirms the payment happened - it typically happens within seconds - before you give the user access.
-
But here's the question: what is that expression going to evaluate to? 2 or 4? The problem is the last line. It uses $i++ and $i in one statement, and that's a no-no. Did you see when I mentioned sequence points earlier? Look into it.