-
Posts
15,274 -
Joined
-
Last visited
-
Days Won
432
Everything posted by requinix
-
$_POST["userid"] and $_POST["password"] will only exist after the form has been submitted. The first time you load the page, obviously it won't have been, but that code there is still trying to run. That thing you commented out? //if($_SERVER["REQUEST_METHOD"] == "POST"){ That detects whether the form was submitted. You need it.
-
No, for a couple reasons: 1. Regular assignment (=) assigns values. $username gets the value of $confirm_password - it's not literally saying "$username is the same thing as $confirm_password". 2. Technically, $a = $b = $c does not say $b=$c; $a=$b but actually $b=$c; $a=$c. It's a minor point that basically never matters. So the statement is really more like $confirm_password = ""; $username = "".
-
IE Issue - Portfolio grid on WordPress website
requinix replied to Bladerunner555's topic in CSS Help
Don't use IE? Really. Microsoft doesn't even want people to use IE anymore. I don't think they even install it in Windows anymore. But if you insist, how about a screenshot?- 1 reply
-
- 1
-
-
You've been given the answer: "yes, but you have to write code to do it". Even if it's just tracking you, the process is still the same. PHP won't do all this for you. However, if it's just you then maybe you don't need the session. Maybe just logging the information is enough and you can look through the logs?
-
You cannot track the user back through every page they visited. You can track them as they browse your website and you can sometimes (not always!) see what page they were on immediately before the current one. The answer is what gw1500se said: if you want to know what someone does after they click a button then track what they do after the click the button. Store each page in an array in the session, and when they get to the page you care about you can pull that array out. This is commonly referred to as "conversion tracking" or something similar. It's common for virtually every website that has some ecommerce or monetary aspect to it in order to see what drives people to the "goal" (them spending money) and what does not. So if you want to know more about the concept, there's some keywords for you to research.
-
Often those two conditions can be combined into one actual rewrite: move to https://www if the request is http or it's not www. Like for Apache, a RewriteCond with [OR] plus another RewriteCond.
-
www versus no-www matters. http vs https should not. Canonicalize everything and redirect appropriately.
-
Post the code you tried so we can see what the problem is.
-
Then the code you posted isn't wrong. Something else is.
-
What's the markup for the button?
-
If it doesn't function then it isn't correct. But it does need quotes.
-
When should DateTime be injected with DateTimeZone?
requinix replied to NotionCommotion's topic in PHP Coding Help
Agreed. I would rather work with them in UTC and alter how they're displayed to the user by literally altering how they're displayed to the user. So the first one. Play it safe: 1. Make sure your database abstraction can handle DateTime objects and will translate them to UTC before serializing for storage, then use DateTime instances everywhere 2. Give yourself one or more functions that can display dates to the user that will adjust the timezone as needed. This is a great way to ensure you display dates uniformly across the site, too. Note that if you're working with Immutables, you can do $userEventTime->setTimezone(new DateTimeZone(...))->format(...) But only if they're immutable. So it might be better to clone instead: (clone $userEventTime)->setTimezone(new DateTimeZone(...))->format(...) -
If you didn't have a constant named "green" then PHP was converting that to a string for you. But as of PHP 8, that will no longer happen and your script will die. PHP raised a warning when it did that. If you didn't see the warning then your PHP is not set up correctly for development.
-
gettext is a hook. What you want is the __ function. https://developer.wordpress.org/reference/functions/__/ Call it with the words to translate and stick the results into your $time_string.
-
That happens automatically. A lot of how webpages work for folks like us is declarative, meaning that you tell the browser what you want and it will deal with the how. Give the browser a standard web form, built correctly using the right information for the different pieces (eg, the form inputs will need the names "var1" and "var2"), and it will turn the form data that a user enters into the correct URL. A skeleton of the form's HTML markup is <form action="/" method="get"> <input type="text" name="var1"> <input type="text" name="var2"> <button type="submit">Submit</button> </form> That contains the absolute bare minimum information to get the behavior you want: entering "FOO" and "BAR" into the two fields and clicking the button will instruct the browser to go to "/?var1=FOO&var2=BAR".
-
Don't use PHP 8 yet? It was just released.
-
calculate total absents and presents based on user login data
requinix replied to ajoo's topic in MySQL Help
My version would be to JOIN the table to itself once or twice in order to pair up consecutive records, then DATEDIFF()-1 the end of the first with the start of the second, then SUM the results. -
Sure there's something better: your computer. 1. Create a file named whateveryouwant.html 2. Edit file in whatever editor you want 3. Open file in browser 4. ??? 5. Profit!
-
Reading Modbus-tcp registers of Solaredge inverter
requinix replied to rene's topic in PHP Coding Help
Hahaha. "I want to build a race car from scratch. It has four tires, a steering wheel that pivots them, and windshield wipers. How hard can it be?" You aren't just writing PHP code. You're writing PHP code that must observe a binary protocol communicating through a TCP socket. That is something 99% of PHP developers never have to think about in their careers. If you have a reliable spec that is relatively easy to understand then perhaps you should start there. Build your code from the ground up by dealing with the little things here and there: a function to send a specific message, a function to read a specific message, a class holding constants for all those magic numbers like 40084 and 40108. Each one of those can be written more or less by itself, and when you have enough of them, you can piece them together into something that actually does the thing you want done. Now that is something we're suitable to deal with. If you didn't create it yourself then yes: PHP doesn't have a "write" function. You will be wanting fwrite. The Python script says TCP... If it's not TCP then the initial connection to the device will fail. Which is a really easy thing to notice. And since you haven't noticed it, I imagine it hasn't happened. -
Reading Modbus-tcp registers of Solaredge inverter
requinix replied to rene's topic in PHP Coding Help
Without me trying to write the script myself, I see three options: 1. Dig deeper into the Python code to find out exactly what it does. Specifically, the ModbusClient. Translate everything in there directly to PHP code. Same class names, same method names, same everything. 2. Use a packet sniffer to see what the Python script sends versus what your script (for the same information) sends. 3. Keep the Python script, and write your output.log stuff in Python instead of PHP. -
How about... not developing your layout with jsfiddle?
-
Reading Modbus-tcp registers of Solaredge inverter
requinix replied to rene's topic in PHP Coding Help
What's the Python script, and is there some documentation online about this sort of thing? -
More or less. Try a regular CREATE TABLE with an existing table name and post the full output of what you get back from the server. Potentially. I didn't create it so I don't know what the motivation was behind creating it. I also said that it was my opinion that using IF NOT EXISTS is a symptom of a problem, and though very many people may believe otherwise, opinions are not facts.