Jump to content

.josh

Staff Alumni
  • Posts

    14,780
  • Joined

  • Last visited

  • Days Won

    43

Everything posted by .josh

  1. Well your problem is that you're trying to look for really cheap shared hosting, so they are not going to offer all the bells and whistles. If you want a host to offer all those things, you need to pony up more cash. Alternatively, since you say you're just using it for testing/development, have you considered just downloading and installing a package like wamp or xampp and doing your stuff on your own computer?
  2. Have you considered using a framework that has login functionality?
  3. .josh

    PHP trashing

    I'm probably talking out my ass, but I personally think you don't see a whole lot of banks using php because they've been around a lot longer than php and started out making their website in the languages available at the time, and have more or less just stuck with whatever they started out with.
  4. alternatively, their temperature could be rising due to them getting angry at you, or getting nervous because you are coming off as creepy.
  5. yep. I think the easiest method will be to pass your 'formatting rules' as an array of the rules you want, and wrap most of that function inside a foreach loop.
  6. how should we know? $kernel->format_input is some arbitrary method in some arbitrary class. You can start by posting that method.
  7. I mean, if you really really really wanted to do strictly php, you could write and compile your own php extension. But that is done through c...which if you're gonna go that far, you may as well just write it in c in the first place.
  8. well yeah...but that's the point. Some other program is interacting with the sensor, writing the data to a file. PHP can parse data in a file and display it or put it into a db just fine. The point though is that it's not designed to directly interact with hardware.
  9. Without a database you will need to hardcode an id => filename relationship. You can create a separate textfile with a list and read it into an array or just hardcode an array in your script. Here is a small example: <?php $content = array(1 => 'home', 2 => 'about', 3 => 'contact'); echo "<div>"; foreach ($content as $id => $page) { echo "<a href='?id=$id'>$page</a> "; } // end foreach echo "</div>"; echo "<div>"; $page = (int) $_GET['id']; $page = (array_key_exists($page, $content))? $content[$page] : $content[1]; include ("{$page}.php"); echo "</div>"; ?>
  10. index.php includes head.php which in turn includes cust_main.php. Since the main file being called is index.php, unless you use an absolute path, all path/to/files being included will be relative to index.php. But when you submit to cust_main using PHP_SELF, PHP_SELF is the path/to/file for cust_main.php itself, which breaks the relative path you had going. You can solve this by either using absolute paths for everything, or by doing action="path/to/index.php" in your form action, since it includes all those files anyway. If the form was on say, for instance, addclient.php, you would do action="path/to/index.php?action=add" in addclient's form.
  11. php isn't really designed to interact with things on the hardware level. You would need a lower level language for that, like c++ for example. If you are using windows, you can possibly look into com to interact with some other program.
  12. It's not really a workaround if it's how you are supposed to do it...
  13. I don't really have a whole lot of experience in character sets, but I'd personally try specifying the hebrew charset in your email header. charset=iso-8859-8 and/or charset=windows-1255 afaik you can't specify multiple charsets in an email header. Since it looks like you are using mixed charsets, you can try using charset=UTF-8
  14. Right. As you have figured out, shared hosts usually attach prefixes to database names and usually even database user names. Prefix is usually some part of your hosting account username or domain name, like the first 8 chars of it.
  15. Unless you enter in some kind of arrangement with the other site, to which they give you access to a list of files (through ftp or some custom script they make), you have to rely on scraping their site. First thing you would do is submit the search phrase to their server, to get the page that shows the results. You can use curl to submit data to their search form and grab the results output (the resulting rendered html page, not a nice and tidy list of files you want. No, it's not that easy). Or if keywords can be sent via GET method, you can use file_get_contents with a dynamically generated url string. Either way, you are then going to have to use regex to extract the list of files from the page so you can then present them to your user. Oh and btw, though it's not illegal, most sites frown upon being scraped like this. If you want to avoid potentially getting your server's ip address banned on their site, I suggest contacting them and at least getting their permission to scrape their pages. If they say it's okay, they may even throw together something that allows you to skip the b.s. of having to regex the page.
  16. You can't just sort($text) because $text is a string. sort is for sorting a list of strings, not a single string. The way you have your code setup, it's building a string by pasting the new file name to the end of the string, so you're doing for example $text = "a"; $text = "ab"; $text = "abc"; etc... meh. unless you're heavy into oop, there isn't anything significant in php5 that you can't live without or at least mimic, in php4. And even if you're heavy into oop, there's still workarounds for a lot of the stuff. In short, it really isn't that big of a deal. Now, when php6 is released, then I'd for sure say you need to upgrade, as a lot of deprecated stuff in php4 will be gone.
  17. $xmlData is the object. $xmlName should be a string. He did, after all, print it, earlier in his script. My guess is maybe you have a newline attached to the end of $xmlName. try trimming $xmlName first.
  18. < php5 $list = glob("*"); sort($list);
  19. As I mentioned before, since you are trying to match the full string, you don't need preg_match_all. Also, since you're simply trying to figure out if it matched, and return a 1 or 0 based off that, all of that code can be condensed down to this single line: return preg_match('/^[-a-zA-Z .,]{2,200}$/', $Valstring); if $Valstring matches the regex, true (1) will be returned. If it doesn't, false (0) will be returned.
  20. if you don't want the if condition to do anything if it's true, then just don't use it. if (!$var) die("Not Defined"); or if you insist on having it but doing nothing, put nothing in it: if ($var) { // I do nothing, what's the point in living?? } else { die("Not Defined"); }
  21. Your code returns a 0 on "hulu+" for me... anyways, you can try '/^[-a-zA-Z .,]{2,200}$/' Also, since you are expecting the entire string to consist of this match, you can use preg_match instead of preg_match_all and ditch the foreach loop.
  22. using a .htaccess for 'logging in' only password protects a directory and its subdirectories. There is no 'logging out' from it, except to just, you know, leave the directory. It is not the same as a full fledged login system.
  23. PHP parses its own code and sends the results to the client. javascript is not parsed by php. It is sent to the browser to be rendered. Your php is syntactically correct, so that stuff will be echoed. So...you're going to have to be more specific than "It doesn't work."
  24. (assuming we are talking about american 10 digit area code+phone number numbers...) My suggestion is that instead of trying to write some way complex regex that handles variations of some arbitrary format, you just cut to the chase and see if there's 10 digits. That way users can use any format they want. $number = preg_replace('~[^0-9]~','',$number); if (strlen($number) == 10) { // number is good, do something } else { // number is bad, do something }
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.