-
Posts
15,227 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
This topic has been moved to PHP Coding Help because it has nothing to do with regular expressions. http://forums.phpfreaks.com/index.php?topic=362582.0
-
This topic has been moved to JavaScript Help. In other news, this poster has been moved to Bed. http://forums.phpfreaks.com/index.php?topic=362534.0
-
At a glance I don't see any syntax errors so I'll point out how that is wrong. Do a quick search to find out what the type= should be. Also, this is [b]obviously[/b] not an HTML question which is why I'm having a hard time imagining why you put this thread in the HTML Help forum.
-
Fatal error: Cannot use string offset as an array
requinix replied to lordshoa's topic in PHP Coding Help
$result is not an array. What is the code that generates it? -
Depending how the likes are stored you could grab them with the first query (the one you aren't showing). Otherwise not really: you'll need three queries somewhere, be they subqueries or not.
-
Alright, need more specific information. 1. What are the actual values of those variables? Only redact the bare minimum, and do that by replacing letters with 'X' and numbers with '0'. 2. Given those redacted values, what is the exact command you need to run? 3. How are you building these values?
-
start hour = 14, end hour = 24, interval hours = 2 interval start hour = start hour while start hour interval end hour = min(interval start hour + interval hours, end hour) // assuming the same day interval = [interval start hour : minute, interval end hour : minute] save interval interval start hour = interval end hour loop Or a for loop.
-
Are you escapeshellarg()ing those three variables before you put them into the command? You need to, otherwise there's a risk that there will be something in them that the shell will try to interpret. Which is the problem you're having.
-
Assign the command to a variable, print out the variable, and see what it looks like. Also redirect stderr so you can catch any error messages. Also, 1. The /./ is unnecessary. 2. passthru() prints the output for you. 3. passthru() does not return anything. $command = '/host/Crypto/newlm/LMSignature -verify 224 -message= text -signature= ' . $signature . ' -verifkey= ' . $verifkeys . ' -hashfunc= ' . $hashfunc . ' 2>&1'; echo $command; //passthru($command);
-
For each productNN and quantity you have, 0. If the quantity 1. Get just the NN part. 2. Subtract 1. 3. Look for the value in the array of prices under that (NN-1) key. 4. If and only if you find it then do whatever. Even easier would be if you modified the form field name to be name="product[$n]" Then you can grab the number very easily with a foreach over $_POST["product"].
-
Use URL rewriting with a "the request doesn't exist" condition. That means virtual folders like "images" or "style" wouldn't work if they were actual directories on your site. RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ...
-
Do you want a subfolder or a subdomain?
-
So what does it output?
-
Sounds like the table isn't empty. Because the table definition clearly states that the id must be unique.
-
$lastimage is the path to the file. header("Content-Type: image/jpeg"); // tell the browser this is a JPEG image header("Content-Length: " . filesize($lastimage)); // be nice and say how large the image is readfile($lastimage); // output the file exit; // stop the script so it doesn't accidentally do anything else
-
simpleXML Attribute won't be read in foreach loop
requinix replied to candybrie's topic in PHP Coding Help
$post = $post->{'regular-body'}; You overwrote $post with something else. -
I don't get 6026 either. I didn't know what out was supposed to be so I just guessed at a boolean. Try if (out != 0) { Also I didn't put in the timezone stuff because I wasn't even sure you needed/should have it. Feel free to put it back. And for the record, as an example nicetime(new Date(2012, 0, 1, 0, 0, 0, 0), true)
-
I kiiinda rewrote it. Felt like it. function nicetime(a, out) { a = parseInt(a instanceof Date ? a.getTime() : a); var now = new Date(); var d = Math.floor((now.getTime() - a) / 1000); if (!out) { return d; } if (d return "Now"; } var chunks = [ [60*60*24*365, 'year', 'years'], [60*60*24*30, 'month', 'months'], [60*60*24*7, 'week', 'weeks'], [60*60*24, 'day', 'days'], [60*60, 'hr', 'hrs'], [60, 'min', 'mins'], [1, 'sec', 'secs'] ]; var nice = []; for (var i = 0; i if (d >= chunks[i][0]) { var count = Math.floor(d / chunks[i][0]); nice.push("" + count + " " + chunks[i][count == 1 ? 1 : 2]); d -= count * chunks[i][0]; } } return nice.join(" ") + " ago"; } I doubt that's exactly what you want but it should be close.
-
It's possible, fairly straightforward, and cool, but it's generally not a good idea. You lose out on some features by doing it that way and you'd probably end up writing weird-looking code in order to use it. As for extensions, wouldn't you just end up writing one to be used on just one of the sites? A framework is your best bet: you can push out a lot of the menial work to it and extend the functionality with common code that all your sites are going to use (such as the login/registration mechanism), and it leaves you in just the right place where you can write good, solid code for the unique functionality.
-
You have to go through the children and attributes methods before you can access them. How those work is by returning to you a list of elements/attributes located in the new namespace. Or returning a copy of the original object with its "current namespace" changed. Whatever the mechanism the end result is basically the same. Anyways, code. echo $xml /* default namespace */ ->children("f", true) /* "hppt://www.test.org" namespace */ ->name;