-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Do you want RSS or do you want a "newsletter" (digest email)? RSS is much easier to do but users have to know how to subscribe to it; newsletters are more complicated and you have to worry about bulk email with your host but with one-click signup a user doesn't have to think about it.
-
There's a typo in your code that does the query.
-
The username is just the user portion. No quotes or @host.
-
The site you PMed me is behaving exactly like your original rewriting rules are still in place. What's in your .htaccess now?
-
Refining MySQL Query To Look For First Letter & REGEX
requinix replied to kjetterman's topic in MySQL Help
Keep a separate column in the table for this kind of search (among other potential uses). Remove leading articles, remove punctuation, that kind of thing. -
And... the requirements? What are the constraints? "Optimized" for what? I can just add arbitrary points wherever I want?
-
Basic: how to find out the selected item of a listbox?
requinix replied to ixnayz's topic in PHP Coding Help
First thing you should do is stop trying to think of it in terms of things work with .NET and learn from scratch how it works with PHP. There is no SelectedIndex or anything like that. In $_GET or $_POST (depending which you're using) will be an item corresponding to the name of the you used. The value of that item will be the selected value from the . <form method="post"> <select name="dropdown"> <option value="1">One</option> <option value="2">Two</option> <option value="3">Three</option> </select> </form> echo $_POST["dropdown"]; // 1, 2, or 3[edit] You also mentioned Javascript, but it sounded like a PHP question. The Javascript version is, without a framework, just .value on the select element. alert(document.forms[0].dropdown.value); -
Music? I have a coworker here talking to me, and I'm looking at them, but I'm typing and not really paying attention to them. Tab, enter.
-
$http_response_header is only set when using PHP's built-in functions, like file_get_contents() or fopen(). If you want to get the headers with cURL then you'll need other options. I don't remember a nicer way of getting it than CURLOPT_NOBODY, CURLOPT_GET, and CURLOPT_HEADER, and parsing the headers returned...
-
Use include() to actually execute the code. You can use output buffering to capture the output of the script and run the templating logic on that too. /** * Run a file through the templating system * * @param string $file * @param mixed[] $vars */ function template() { // using func_get_args() to avoid problems with overwriting variables extract(func_get_arg(1) ?: array()); ob_start(); include func_get_arg(0); $content = ob_get_clean(); foreach ((func_get_arg(1) ?: array()) as $key => $value) { $content = str_replace('{$' . $key . '}', $value, $content); } return $content; } $HTML = template('TEMPLATES/' . $template . '/index.tpl', array( 'template' => 'TEMPLATES/' . $template )); <p>Template: template = {$template}</p> <p>PHP: template = <?=$template?></p>Just make sure, absolutely sure, your templates don't have any unwanted PHP code in them. Or anything that looks like PHP code.
-
Depends. Can you tell me any standard to estimate the time it will take to drive from Miami to Boston in a car vs in a truck?
-
You'd have to change the first RewriteCond to check if the HTTPS flag is off, but otherwise yes. Only a couple more days? Might as well wait. And when you do the switch you can enable HSTS too. - HTTP Strict Transport Security - OWASP
-
Permission Denied in php file read when file owner is not apache
requinix replied to snehu's topic in Apache HTTP Server
That's fine. Go ahead and do that. But don't make the file be owned by root. safe_mode is a PHP setting so check phpinfo(), ini_get(), or your php.ini. -
RewriteCond %{HTTP_HOST} !^https://www.example.com.au$ [NC]That will never match. The HTTP_HOST is literally just the hostname. You need to check the "HTTPS" flag separately. Redirect https to http, for some crazy reason, as well as no-www to www? RewriteCond %{HTTPS} =on [OR] RewriteCond %{HTTP_HOST} !=www.example.com.au RewriteRule ^ http://www.example.com.au%{REQUEST_URI} [L,R]
-
Permission Denied in php file read when file owner is not apache
requinix replied to snehu's topic in Apache HTTP Server
root is for privileged access to resources. You shouldn't be using it to create files for your website, and certainly not files that are supposed to be read and written to by the site. Do you have safe_mode enabled? -
Is it okay to have password hash in session?
requinix replied to Richard_Grant's topic in PHP Coding Help
The session is entirely under your control. You don't have to re-verify a user every single time: do it once during login and only store the user information if it's good. If the information is there then the user logged in successfully, and if the information isn't then the user hasn't logged in. It "should be safe", yes, but don't do it. -
RewriteRule ^user/([0-9]+)/(.*)/(.*)(/|$) ./board/user.php?ID=$1&FIRSTNAME=$2&LASTNAME=$3 [L,NC]That last (.*) is going to match everything up to the end of the string, including the slash. When the regex engine has to choose between / and the end of the string, it'll choose the latter because that's already true and it doesn't want to backtrack to match the slash. Be more restrictive than just .* for everything. Even if you want to allow all sorts of characters you know slashes won't be allowed, right? You should also enforce the end of the string, otherwise /1/Richard/Grant/other/stuff will be allowed. RewriteRule ^user/([0-9]+)/([^/]+)/([^/]+)/?$ ./board/user.php?ID=$1&FIRSTNAME=$2&LASTNAME=$3 [L,NC]
-
I think you are missing something. Yes, you need something variable in the query. Presumably the ITSchedule70 thing. Of course you can't write it directly in the query. But for you, just for now, write it directly in the query, okay? When all that works you can worry about using a variable or whatever.
-
Well you can't magically turn "ITSchedule70" into the number 2. You need a query that uses the term "ITSchedule70" in it. Might involve a JOIN against another table (or more than one).
-
Getting the value by itself is easy enough: $object->contractVehicle[0] // and [1]The only other thing is the query itself. How much do you have there? Is it ready except for adding in the value?
-
Hand to "another developer"... how? Are you going to print it out on a piece of paper and send it to them through the mail? Or maybe hire one of those airplanes that flies around cities trailing a banner? Because you have a PHP object right now and I can't figure that's very far from what you actually need.
-
There's no overlap with either of 7:30-8:30 or 12:00-14:00... The two will overlap if the new start time is before the existing end time and the new end time is after the existing start time.
-
How to include uri content after route traffic to controller.php ?
requinix replied to Dareros's topic in PHP Coding Help
Depends on whatever is generating those URLs. It's not happening automatically. -
How to include uri content after route traffic to controller.php ?
requinix replied to Dareros's topic in PHP Coding Help
You have to look at the REQUEST_URI and decide what to do. It's going to be (the path part of) the URL, not a filename. And it's even going to have the query string in there. Or you can modify your .htaccess to say RewriteEngine On RewriteCond %{REQUEST_FILENAME} !=/var/www/html/site/controller.php RewriteCond %{REQUEST_FILENAME} -f RewriteRule (.*) /var/www/html/site/controller.php?filename=%{REQUEST_FILENAME} [L,QSA]Then $_GET["filename"] will be the originally-requested file. Except now, instead of figuring out what file to show, you have to validate the filename - otherwise I could go to http://www.yoursite.com/controller.php?filename=anything I wantand get the contents of whatever file I choose.