-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Adding a index.html does not automatically forbid access so I think there's something else going on there. IIS is IIS. It's not Apache. It works differently. Just because doing one thing with IIS gets you the result you want doesn't mean that doing the same thing on Apache will too. But I'm still not clear on what you're doing. How are you forbidding access? Is it definitely Apache's 404 page and not its 403 page? If it is the former, have you tried either of the things I said?
-
When Apache serves a 404 it uses the ErrorDocument setting. You have two options: 1. Use URL rewriting to rewrite non-existent requests to the framework, thus bypassing the 404 mechanism entirely. This is best. RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ whatever.php [L]2. Use ErrorDocument to make the framework also serve as the 404 page. You say 404 but you're describing 403s. Is that what you mean? You've explicitly forbidden access to something (with an Order/Allow/Deny) and need CI to take over?
-
Start by building { "November": { "A": 7, "B": 8, "C": 3, "D": 4, "category": "November" }, "December": { "A": 1, "B": 2, "C": 1, "category": "December" } }You're close to that already: $out[$element['category']][] = array($element['trainFunction']=> $element['value1']);Move the trainFunction value into the empty [] to specify a key, then remove the array() part so that it's just value1. Then use array_values() on $out to strip off the outermost keys and turn it into a regular array.
-
You have curly braces {} between a1 and a2 instead of parentheses ().
-
Look closer at those parentheses you thought you typed.
-
Searching through serialized data... ugh. AND has higher precedence than OR, just like how multiplication has higher mathematical precedence than addition. That means writing a OR b AND c 2 + 4 * 5is equivalent to a OR (b AND c) 2 + (4 * 5)Applying that to your query we discover you've effectively written matches q1 OR matches q2 OR (matches q3 AND is not shop manager AND is subscriber)Use parentheses to force evaluation the way you want: (matches q1 OR matches q2 OR matches q3) AND is not shop manager AND is subscriberBut I fear you may discover other problems.
-
Oh, I missed something that would have been nice to point out. Remember how you made joke_text sticky? "If the joke_text is present in $_POST then output it"? Start with the same concept except with the author if(isset($_POST['author'])) { echo $_POST['author']; } then add a condition that the POSTed author matches the author in $data (remembering that what's in $_POST will be the author ID and not the name) if(isset($_POST['author']) && $_POST['author'] == $data['id']) { echo $_POST['author']; } then change the output to be not the value from $_POST but "selected". if(isset($_POST['author']) && $_POST['author'] == $data['id']) { echo 'selected'; }
-
Huh? The results you want are the inactive users, and the query you described will return the inactive users. Where's the problem?
-
That's a step in a direction that will not take you away from where you need to go. You still need the comparison: output the "selected" if the ID in $data matches the ID from the form. That means there's going to be a == in there.
-
Try it and find out No really: a great thing about PHP is that if you're not sure about whether something will work or not then you can just try it and see what happens. Though I'll say you should just do "selected" and not the whole "selected=selected" thing - it's more modern.
-
To make an option selected, add a "selected" attribute to it. As in WhateverBe sure to only mark the right one as selected - the name will match what's in $_POST. Try that out, and if you have a problem then post what you have.
-
o7 There's also the simpler foreach loop: foreach ($corpid as $id) { $url="https://api.eveonline.com/corp/CorporationSheet.xml.aspx?corporationID=" . $id;And SimpleXML supports loading directly from a URL so you can skip the file_get_contents() step and do $list = new SimpleXMLElement($url, 0, true); // true=first argument is a url
-
Sounds like you're asking for plain ol' form-processing-in-PHP code. Since your form is already pointing to predictor.php, make the code in there look like <?php if (isset($_POST["submit"])) { // submit button was pressed /* process the form data however you want */ } else { /* form was not submitted. you can display the form here or redirect back to the form page or whatever. */ }To get the values you need to pass to your predictor() function, use $_POST. The function will return a value that you can output however you want.
-
Showing mele or female and brith date from entered personal id number
requinix replied to HaxorNab's topic in PHP Coding Help
Take a look at substr. Write some code and if you have problems then come back and post what you have and a description about what is happening. -
1. .scroll(function) will "bind an event handler to the 'scroll' Javascript event". 2. .scrollTop() will "get the current vertical position of the scroll bar". 3. .css(object) will "set one or more CSS properties". All together, If you're not sure what that means, see it in action.
-
I phrased my post specifically so someone might mention that I was then going to follow up with "yes, that may hide the path to the image file itself, but the image is still accessible in some form at that URL so it doesn't help much". At least doesn't help with what it sounds like OP wants to do.
-
If PHP were to somehow obscure the path to the image, how would the browser know where to find it? Ultimately the browser needs to know because it's the one displaying the image. So no.
-
The command objects only live as long as they're needed. Once executed, or stored, or dealt with in whatever way you using them for, they're destroyed and cleaned up. They aren't persistent objects like your current Commands - ephemeral, created when needed and destroyed when handled. For example, this UpdateDatabaseCommand thing would go like 1. Client receives whatever request. 2. Client interprets request to mean to update the database according to whatever. 3. $command = new UpdateDatabaseCommand(with whatever information is needed to update the database) 4. $command gets executed or whatever. 5. You could unset($command) so then it gets cleaned up immediately, but really you can just ignore it and reassign whatever new object to that variable the next time through the loop. Six. Six of them. Probably could fit more in there.
-
Is it possible to change my username?
requinix replied to colap's topic in PHPFreaks.com Website Feedback
Turns out only the username is supported, not both as I thought. So that's the second lie I've told. I changed your username. -
And how are we supposed to know what's wrong?
-
Is it possible to change my username?
requinix replied to colap's topic in PHPFreaks.com Website Feedback
That can't be changed. The forum allows logging in with both the username and the display name. -
The as-a-service thing is irrelevant. This is a question of code design: either you a) Use one big class that can do every possible thing, requiring that it knows all possible information ahead of time, and call methods on it, class Commands { public function __construct($everything, $and, $the, $kitchen, $sink) { // ... } public function updateDatabase($foo, $bar, $baz) { // update the database } // public function doAnotherDifferentThing(???) { // ... // } } if (/* need to update database */) { $this->commands->updateDatabase(...); }orb) Use multiple small(er) classes that each do one specific thing, only needing whatever information is relevant at the time it's created, and have it be "executed" or something class UpdateDatabaseCommand implements ICommand { public function __construct($db, $foo, $bar, $baz) { // ... } public function /* ICommand:: */ execute() { // use $this->db to update the database } } if (/* need to update database */) { $command = new UpdateDatabaseCommand($this->db, ...); } // execute $command // updating the database requires that $db thing // you could hold onto it, or put it into a factory and hold onto that instead class DatabaseCommandFactory { public function __construct($db) { // ... } public function createUpdateCommand($foo, $bar, $baz) { return new UpdateDatabaseCommand($this->db, $foo, $bar, $baz); } } if (/* need to update database */) { $command = $this->dbcommandfactory->createUpdateCommand(...); } // execute $commandWhether you can perform multiple actions/commands per "request" doesn't actually affect the code. The difference comes in when you add Client into the mix. The big unified class wants the Client ahead of time but the Client needs the unified class too, while the single class you don't do it ahead of time. Of course now that I write it out, there's no particular reason why everything has to be set in the constructor. You're calling some method on Commands - pass the Client at that time.
-
Is it possible to change my username?
requinix replied to colap's topic in PHPFreaks.com Website Feedback
You can change your display name over here. -
There's really no need for slow and expensive regular expressions here. $modelName = substr($modelName, 0, -1);