-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Get the dates as timestamps, like what you get from mktime() and strtotime(), and just subtract the two. Timestamps themselves are seconds so the difference between them is also in seconds.
-
preg_match does much more than just look for a simple string. It requires you to actually learn how to use the function rather than just throw stuff at it. if (preg_match_all("/" . preg_quote($string) . "/i", $paragraph, $matches)) {
-
This topic has been tr///ed to PHP Regex. http://www.phpfreaks.com/forums/index.php?topic=354498.0
-
You don't need the is_numeric() check because you just floatval()ed it. It will be numeric. Or if you want to reject the request because it wasn't numeric (probably a good idea), move the is_numeric() to before you floatval() it.
-
You intval()ed it. There's nothing else you have to do - including is_numeric() on it, because it will always be numeric (you made it so).
-
You're missing parentheses. As well as a description of your problem. It's nice to include that so we don't have to guess at what you want.
-
If you have multiple inputs with names like "area" then PHP will create one $_POST["area"] and overwrite it for every one in the form. However you can name them with a special array syntax and $_POST["area"] will be an array rather than a single value. You can extend this to multiple arbitrary array keys (so long as there's at most one "[]" and it probably has to be at the end). With that second syntax, "0" would be the ID number of the row, otherwise you'd have to put the ID in the form in its own special hidden field. foreach ($_POST["area"] as $id => $area) { // update #$id, set area = $area }
-
This topic has been belatedly moved to mod_rewrite. http://www.phpfreaks.com/forums/index.php?topic=354420.0
-
It does mean "last", as in "this is the last rule for this cycle, don't process any more". Thus mod_rewrite will do the redirect, the rule won't match the next time around, and the silent URL rewriting proceeds as normal.
-
Huh. Right. It would. Derp. Two rules. RewriteEngine on # generic HTTPSify rules, but only gets applied to the profile stuff RewriteCond %{HTTPS} off RewriteCond %{REQUEST_URI} !profile\.php RewriteCond %{REQUEST_URI} /([^/]+)/([^/]+)/([^/]+) RewriteRule !\.(gif|jpg|png|css)$ https://%{HTTP_HOST}%{REQUEST_URI} [L] # URL rewriting RewriteCond %{REQUEST_URI} !profile\.php RewriteCond %{REQUEST_URI} /([^/]+)/([^/]+)/([^/]+) RewriteRule !\.(gif|jpg|png|css)$ profile.php?shopid=%2&shop=%3
-
Add a RewriteCond %{HTTPS} off and change the destination of the RewriteRule so that it goes to the HTTPS location.
-
Help Importing csv file to a specific column in a database table.
requinix replied to php-newbies's topic in MySQL Help
Use whatever phpMyAdmin offers for uploading and importing. What I gave is (apparently) not what you'd need to use. -
Does the remote software offer any logs you can look at? Are the two machines the last in the "list" or are they located at random within? If you shuffle the "list" does the situation change? In your shoes I would be trying three things: finding more information (eg, logs, adding whatever debugging/verbosity options you have available), looking for patterns and similarities and differences (eg, two machines on a different subnet, not all running the same software with the same settings), and trying to change the outcome by manipulating the circumstances (eg, running the commands manually, rearranging lists).
-
Running the same command PHP tries to run: $ /var/www/html/slot_uptime/telnet_pots.sh $msan_ip $slot > /var/www/html/slot_uptime/uptime_pots.txt (after substituting values for those two variables, of course). And as a sanity check, echo out that command and make sure it is what you expect.
-
So it works when you try the bash script manually? What if you try manually running the exact same command the PHP script runs?
-
Simply calling rename() will have absolutely no effect on the HTML or CSS your script generates. The problem is elsewhere. Look at the actual HTML and CSS, before and after, and see what has changed that shouldn't have changed.
-
Turn off magic_quotes.
-
You need a URL for that resized image. Something like resize.php?newsid=123&width=110&height=146 The script then looks up the image to resize and outputs a resized version. Basically, what you have now but in its own script*. The "crazy characters" are the binary image data. They're good. But you have to tell the browser that it should display as an image, rather than the HTML it assumes. Before you output anything, header("Content-Type: image/jpeg"); * It doesn't have to be its own script - you could reuse an existing script for it. The issue is that you output the image and only the image. No HTML or anything else with it.
-
If those are the only two possibilities, // will grab the email. If it fails then the whole string is the email.
-
need help with like in where clause using variable from a second table
requinix replied to security_man's topic in MySQL Help
Wrong quotes. Backticks are for names of objects in the database (databases, tables, fields, etc.) while single- and double-quotes are for strings. LIKE "%tblhosting.domain%" But you don't want strings. How is this search supposed to work? Find all invoice items that have a description containing any hosting domain? -
Help Importing csv file to a specific column in a database table.
requinix replied to php-newbies's topic in MySQL Help
Look into LOAD DATA INFILE. Something like LOAD DATA INFILE "cities.csv" INTO TABLE `cities` FIELDS TERMINATED BY "," OPTIONALLY ENCLOSED BY '"' ESCAPED BY "\\" LINES TERMINATED BY "\n" (`csvcity`, `csvstate`) SET `city` = `csvcity`, `state`= `csvstate` -
You can't use aliases in WHERE clauses - pretend that aliasing happens after the conditions. HAVING doesn't have that restriction. SELECT *, (original_price - price) AS profit FROM items HAVING profit While I'm at it, 1. If a number is supposed to be a number, don't put quotes around it. 2. Are you sure you want to ORDER BY RAND()? Do you actually want [i]all[/i] of the results in a random order? Or do you just want a couple of them chosen randomly?
-
That's not all your code. Can you post the whole thing?
-
For some reason it was decided that if you're loosely comparing two numeric strings, PHP will compare them as numbers. Comparison Operators As random as spiderwell's comment is, he actually said the right answer: use a strict comparison instead.
-
function ssh2_connect doesn't exist
requinix replied to Kyle123's topic in PHP Installation and Configuration
It requires the ssh2 PECL extension. Apparently you don't have that installed. Try asking whoever maintains the server for it, or look for an alternative such making a simple web service.