-
Posts
15,229 -
Joined
-
Last visited
-
Days Won
427
Everything posted by requinix
-
Copying from a book is risky. Replace your _autoload with function autoload($name) { require strtolower($name) . '.php'; } spl_autoload_register("autoload"); 1a. The function is supposed to have two underscores, but the whole thing is outdated to begin with.1b. Instead make a normal function and use spl_autoload_register 2. Unless the file is named "Page.php" (uppercase 'P') then you need strtolower() to lowercase the class name to get the filename.
-
Regex to match and return all anchor tags in a string
requinix replied to kyleabaker's topic in Regex Help
That. Very that. Not only are regular expressions the wrong tool for dealing with HTML, DOMDocument is actually better at doing what you want. getElementsByTagName -
get hardware serial number of USB stick with php
requinix replied to yosibeck's topic in PHP Coding Help
You'd have to use a shell command, like dir on Windows, to get it. C:\>dir Volume in drive C has no label. Volume Serial Number is 9675-8706 ... -
Well, the field is called "date" so I would expect more like SELECT * FROM jobs WHERE MONTH(date) = 4If you're still not getting results, what are some of the actual values from the table?
-
$_SERVER["REMOTE_USER"] blank.. but not really?
requinix replied to jgauthier's topic in PHP Coding Help
REMOTE-USER is not correct. It should be REMOTE_USER or maybe HTTP_USER. -
Unless you need access outside your network, a NAS is plenty. VPN would be more about you wanting access while you're not home (among other things).
-
$_SERVER["REMOTE_USER"] blank.. but not really?
requinix replied to jgauthier's topic in PHP Coding Help
Could it be that the new Apache configuration isn't setting the REMOTE_USER? -
Nope, nothing fancy. All you need is a database to store the information and a little PHP to add stuff and to show stuff. Start by writing the admin page without any database interaction to the point where you have the information you want (title, description, and uploaded picture) into variables. Then write the "show" page to the point where you start with variables with that data (you'll get those from the database later) and outputs the page how you want it. Note that you never actually create a "new webpage". You don't make a file for every event but instead have URLs like "showevent.php?id=123"; that ID tells showevent.php what event information (from the database) to show on the page. If you want a fancier URL, like "event/example-event-123", that can happen easily later.
-
Uh, no? $rTPattern = '<span class="label">Runtime:<\/span>.*<span class="data">(.*)<\/span>'; $starringPattern = '<span class="label">Starring:<\/span>.*<span class="data">.*<span itemprop="name">(.*)<\/span><\/a><\/span>.*'; $pattern = '/' . $sPattern . $dPattern . $gPattern . $rPattern . $rTPattern . $starringPattern . '/siU';There is no .* between the $rTPattern and the $starringPattern. You put one at the end of $starringPattern but not at the end of $rTPattern. There very likely needs to be one.
-
A signed BIGINT at allows values up to Or 9,223,372,036,854,775,807. If that's not enough for your currency or whatever then you really need to change the currency. Not even the Zimbabwean dollar is that bad.
-
Any errors? What does your code look like when you var_dump() the $output and the $result, and exactly what output do you get (because you will get something).
-
Learning AJAX - got stucked on the first example
requinix replied to B_CooperA's topic in PHP Coding Help
You've got more than one element in the HTML with id=search... -
Multi-Field Search Form; PHP returning all data/Not filtering results
requinix replied to Doc20's topic in PHP Coding Help
Ah, but you left all the other fields empty, and ended up with conditions like address LIKE '%%'which will, of course, match anything and everything. Only add those conditions in when there is a value to search for. -
PHP has this crazy feature called variable variables. Lets you use a string value to determine the name of a variable. The syntax is basically either adding another $ or, for more complicated situations, ${}. It works in very many places, actually, and even lets you get and set otherwise invalid variables... as long as you can deal with the potential "bugs" of doing so. Given $methodProperty = "name", self::${$methodProperty} -> self::$name -> "Allan"Just try not to use it too much: in, like, damn near every possible situation where they would solve a problem, an array is a better solution. Including this situation: it's better to store the values in an array and bypass all this nonsense. Plus, you have a very convenient array of all the data instead of a bunch of variables.
-
How to convert multidimensional array into java script object?
requinix replied to drayarms's topic in Javascript Help
Copying from pairs? Any reason you can't just NS.harvest = pairs;But are you executing this from a function? Either have the function return pairs, or forget the function and just access NS.harvest (after setting it) directly. -
What's the raw $output you got?
-
Try variable variables. return (isset(self::${$methodProperty}) ? self::${$methodProperty} : null);
-
PHP newbie having trouble with php5 on debian 7.2
requinix replied to phantom21's topic in PHP Installation and Configuration
Are you sure it's not something simple like having the wrong URL or the wrong filename? Even if PHP wasn't working, going to the right URL should get you something besides a 404. You don't have readline installed, which is fine. Enter anything you want there, remembering to use <?php and ?> when you want in and out of PHP mode. Whatever you input should be like a valid .php file. When you're done hit ^D and PHP will execute whatever you entered.- 16 replies
-
- php5
- debian 7.2
-
(and 1 more)
Tagged with:
-
if ($option->textContent = $_POST['txtTitle']) {Count your equals signs. But you actually use the "value" attribute instead of the textContent since that's where the txtTitle value actually comes from.
-
1. print_r() is only for debugging. Not "primarily". Only. It's a string. Just output the string with an echo or print. 2. Find the appropriate (a simple loop over the select node's getElementsByTagName("option") with a check of their values) and if you find one set its "selected" attribute.
-
If the "time" field is an integer then don't use date(). If it's a DATETIME field then you should be using "Y-m-d H:i:s" format for the date. $d=date('Y-m-d H:i:s', time() - 5 * 60);If that's still not working, what are the values of some of the rows from the navigate table you expected it to find?
-
...If the upload isn't successful then don't do anything with the file. Only when error=UPLOAD_ERR_OK (0), the first thing you should check, do you continue with the process and bother to check file extensions and types and whatnot. The ones that don't upload: how about a more useful error message than "something is wrong"? There are error codes you can look up to find out what happened.
-
Paypal IPN-It's all set up, but one issue.
requinix replied to the 7th Hokage's topic in Third Party Scripts
You're welcome No. The part I'm talking about isn't there. Not in any of the files you posted. None of them. Only that second script you found (and discarded) way back when had it. I'm sorry that you don't know anything about IPN. I'm sorry that you went out and bought something incomplete. I'm sorry that you think you have all the pieces when you don't. But I'm not sorry that you're leaving. -
Paypal IPN-It's all set up, but one issue.
requinix replied to the 7th Hokage's topic in Third Party Scripts
That "final script" is still missing the part that verifies the IPN message. That was the problem. Big problem. You need to write code so that it verifies the message or else use a different script.