-
Posts
15,265 -
Joined
-
Last visited
-
Days Won
431
Everything posted by requinix
-
Can you throw something up in a JSFiddle so we can see it in action?
-
I don't see how you're expecting this to work. Is PHP supposed to stream the server desktop UI to the client? Which it won't be able to do unless you have some highly insecure PHP setup, since services on Windows run in a protected sandbox that doesn't actually allow interaction with a user's desktop? If you're on Windows then why not just use RDP?
-
__DIR__ is a "magic constant" (it's a constant with a value that varies) that is the directory of the file you put that code in. That's all there is to it. Period. Super simple. Nothing to do with URLs. Nothing to do with MVC design. Nothing to do with your website, really. Just a directory path.
-
Like I mentioned on Discord, put your application behind a login - because if it's an internal thing then you really aren't going to want anybody to go in there and screw around. I also mentioned robots.txt but Google says not to use that to prevent indexing and to do something else instead (like put the area behind a login).
-
What's more, even a successful run of your endpoint doesn't return JSON. Your JS has no business attempting to read JSON from the response at all. If you're going to do this then do it right: always return JSON, and use status codes like 400 and 500 for errors.
-
Then it's easy: show the time of the reservation in Florida's timezone. Look at most travel and reservations sites and you'll see them presenting the time in the local timezone. Why? Because if I'm going to go to Florida to go scuba diving, I have to be in Florida to do it. Plus, it's really easy to implement since you don't have to care about anybody's timezone but your own. On the technical side, it's hard to tell for sure with what you've posted, but you're probably not using some of the date functions correctly. Certainly not if you're getting December 31st 1969 as output. How is the user (you) choosing the date and time? What's the code for that part?
-
Like you started to hit on towards the end of your post, the actual problem you're trying to solve here is to display the time in the user's timezone. When you're the user, that means US Central. When I'm the user, that means US Pacific. You have four options: you can guess their timezone, you can guess their timezone, you can ask for their timezone, or you can ignore their timezone. "Ignore it?" Potentially. What sort of reservations are you talking about here?
-
You seem to be really enjoying single quotes today. https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.single
-
As a general rule of thumb, if you have an error message that you don't understand and would like help understanding what's wrong, post the error message.
-
That does not make sense. What is the value of the DOCUMENT_ROOT? I would expect it to be /home/bierglae/www/Webseite.ch. I don't know what the /var/services/web path is supposed to represent.
-
There are two paths you have to think about: the path to files as they exist on your server, and the URL that you see in the address bar of your browser. For files on your server, it's best to always use absolute paths all the time for everything. That way there's no confusion about "well what if I put this in a different place, then I have to change all the paths". To get an absolute path you can use the DOCUMENT_ROOT in $_SERVER. That will tell you what directory is the root of your website, then you can continue building a path from there. include $_SERVER["DOCUMENT_ROOT"] . "/phpadds/head.php"; For URLs, it's common to use absolute paths all the time for everything. Again, so there's no confusion. This time you start everything with a leading slash for the root of your website, then build from there. <a href="/index.php">This one always goes home</a> <a href="/google/index.php">This one always goes to the Google thing you set up</a>
-
Why do it that way since all you're doing is reinventing tempnam? Yes, but you missed the important part: "when there are no remaining references to the file handle". Which is exactly the case when you use the handle, call stream_get_meta_data on it, and then forget the handle existed.
-
php 8.1 upgrade and error in ssh2 output stream.
requinix replied to robetus's topic in PHP Coding Help
-
php 8.1 upgrade and error in ssh2 output stream.
requinix replied to robetus's topic in PHP Coding Help
It would be the same error message if it returned true, that's right. But the function does not return true. It only ever returns a resource or false. There is a problem and neither of us knows exactly what it is just yet. This unknown problem is causing ssh2_exec to return false. If you can find out what the problem is and fix it, then your code will get the resource it expects and everything should work. To try to find out what the problem is, my question was: is there anything else that has changed with your system, or perhaps the system you are trying to SSH into, besides the fact that you are using PHP 8 instead of PHP 7? Any other configuration changes? Could it be that you are using PHP 8 not because the server upgraded but because you're using a whole new server entirely? -
php 8.1 upgrade and error in ssh2 output stream.
requinix replied to robetus's topic in PHP Coding Help
Wrong question. What you should be asking is "why is $stream a boolean and not a resource?" It is because ssh2_exec returned a boolean - false, specifically. So why is it returning false? The documentation says it will return false "on failure". Not especially helpful, but at the very least it means there was a failure in trying to run your command. Do you have any idea what it might be? Any messages in your error log? Anything changed besides literally the fact that you are using PHP 8 instead of 7? -
The correct syntax is demonstrated in the link I gave.
-
Then the issue here may just be your syntax: return view('products.create', [ $result = (new CategoryController)->Category() ]); Compare that with how the online docs use the view() function.
-
Question: why choose PHP for network programming? It's like choosing a hammer to peel a banana...
-
What is this, Laravel? Get the list of categories in your controller and pass them to your view. Try writing the code for that and we'll see how it goes.
-
I don't see how "my spreadsheet has a checkbox" and "PHP is web-based" are related... The only other thing I can think of is highly specialized: if PHP is running on a Windows machine that has Office installed then you can probably make use of COM. If that's the case then the first step towards using that would be writing VBA that does everything you need to do instead of PhpSpreadsheet.
-
To prevent accidental repeated submissions of the form. Look around the internet and you'll see this "disable on click" paradigm everywhere.
-
Can we assume that the button is located within the form? What's your full code right now?
-
I believe that's what kicken was trying to say.
-
SoapServer with operation name with dash
requinix replied to CapnSqueakers's topic in PHP Coding Help
You don't, and whoever created that WSDL was dumb to not consider potential situations like this. You can, however, use the magic __call method to intercept calls to methods that don't exist, and create a properly-named method to do the work. class MySoapServerClass { public function __call(string $method, array $args) { return match ($method) { "ProvideDocument-b" => $this->ProvideDocumentB(...$args), }; } private function ProvideDocumentB(...) { ... } }