Jump to content

dalecosp

Members
  • Posts

    471
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by dalecosp

  1. Ah, I see now. First thing that happens here in Chrome is that "chat.php" is 404.....
  2. Yes, you can write to different file types; it may depend on the system what your actual result is. For the most part, in a server environment, the content determines the way it's handled. You might also look into using file_put_contents() instead of the fopen/fwrite/fclose routine, if possible.
  3. Environment, then? Things like PATH and Drive Mappings would be prime suspects.
  4. General redirect for HTTPS only: if ($_SERVER['HTTPS']!="on") { header("location: https://site.com"); } I am not a security expert; I don't know if this ($_SERVER['HTTPS']) can be faked. For the rest, it's a tad more complex. You would probably want an array of approved IP's, and an array of approved domains. You could check the IPs with an in_array() call against $_SERVER['REMOTE_ADDR']. Since they could be coming from a presumably large number of pages on the "approved sites" list, you'd probably need to loop through that array and do something like stristr() for each value (I'm hoping you don't have thousands of approved domains ) For those, you'd likely want to set a boolean variable for whether or not they would need to be redirected. I do know enough about security to warn you on the IP's and "approved sites". IP's can be spoofed, and $_SERVER['HTTP_REFERER'] should probably *not* be trusted, as it's fairly trivial to spoof and usually is where the bad guyz are concerned... HTH,
  5. Well, it would have to be "<?php include('mailchimp.inc.php'); ?>" ... he's in HTML mode at that point.
  6. Incidentally, both of the options you describe would also work, but tend to be "more work", which we programmers don't like so much ;)
  7. There are lots of ways to do this, and several of them might even a] work, and b] make sense. First off, there's "include()", which is great for, well, including some code in some other place: <?php //my_includer.php //a PHP function, and another PHP function do_something(); do_something_else(); include "myHTML.html"; //"myHTML.html's content will appear right at this spot. This file is in the same directory as "my_includer.php" ?> Now, contrary to your statement above, there's no reason to use echo over and over ... as long as you understand how to make echo work over multiple lines, and realize that the delimiting characters for the string cannot be in the string itself. <?php //my_html_echoing.php //a PHP function do_yet_something_more($with_an_argument); //echo my HTML here echo " <ul> <li class='foo'>Item</li> <li class='foo'>Item 2</li> <li class='foo'>Item 3</li> <li class='foo'>Item 4</li> </ul> "; //note that THIS statement (below) will cause a parse error because it contains //the double-quote, which I'm using to delimit the string for echo() to use... echo " <ul> <li class="bad-quote">Item 5</li> </ul> "; //done properly, the above should use single-quotes for the LI class, or //single-quotes for the string delimiter. This won't create an error: echo ' <ul> <li class="bad-quote">Item 5</li> </ul> ';
  8. It's typically "\", not "/". It's called "escaping" the data. There are even some nice functions for it: http://php.net/manual/en/mysqli.real-escape-string.php
  9. First engineering maxim: if it ain't broke, don't fix it. OO vs. procedural is not some kind of 4th-grade urinal competition. It's a choice made in design, and, it takes some good brains to decide what the appropriate design methodology is. If OO code makes for easier reading/maintainability or faster execution, then you might change it. If it's procedural and fast, and well-documented and not hard to maintain (as you claim it to be), you have no need to change it.
  10. For the record, if you're the real username you say you are, I'm not trying to be mean. But there are plenty of bad peeps around who might happily appropriate a username from some other place, come to a busy programming forum, and do something malicious, and users here should be careful if you don't play by the community rules.
  11. Please consider wrapping your code in BBCode "Code" tags. This will help with formatting and legibility. True. Unless they're desperate. Which might be the case. Are you sure, OP, that you don't need to go back to match.com and stop phishing around here?
  12. http://framework.zend.com/manual/2.0/en/user-guide/overview.html
  13. Hmm ... under the cover of a married middle-aged convertible driving mild-mannered Midwestern conservative church-going wanna-be record producer lies the heart of a saboteur At any rate, glad you've resolved this, and "hats off" for learning in advance of the next time. Cheers,
  14. I suppose one might try something akin to this ridiculously nasty hack: fwrite($fd, str_replace("<script",$some_string_besides_script),$contents);
  15. Welcome, James!
  16. In most Unix flavors, an alias is acceptable in the second position: 127.0.0.1 localhost donny 127.0.0.1 www.mytestingwebsites.com development 1.2.3.4 www.google.com dagoog 11.22.33.4 development.server.mysite.com devel
  17. Well, you assume that the user will be giving you some sort of help with this, then? Because it could be they type it in without ever hitting return. I suppose you could look at wordwrap()...
  18. It would go in the excerpts you showed above, wherever they live, and should work in either HEAD or a separate CSS file, per convention and specs. +1 for that. Some javascripting and general all-around web knowledge required, but a very nice API to use.
  19. Is that all of it? That shouldn't even parse (it's missing the closing bracket for the foreach loop ...) ... that could be, of course, the problem.
  20. //code goes in code tags [php] $mycode; [/php]
  21. Have you tried the fully-qualified path to the resource? src: url(http://www.mysite.com/files/fonts/DancingScript-Regular.ttf); /* TTF file for CSS3 browsers */ If that's not it, you probably needs to investigate CORS.
  22. +1 for Mr. Ullman ... plus, he hangs on the PHP mailing lists, is a very friendly, helpful guy (although very busy), and grew up "around here" (that is, near where I live, or same state, anyway). His book got me started and ultimately helped provide a new career.
  23. Show us the table structure: mysql> describe mytablename; +-------+---------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +-------+---------+------+-----+---------+----------------+ | id | int(11) | NO | PRI | NULL | auto_increment | | bar | text | YES | | NULL | | +-------+---------+------+-----+---------+----------------+
  24. Can you set up a VM "dev box" on a laptop and take your projects with you? My employer didn't have many "code gurus" and wasn't too interesting in seeing the code ... they wanted to look at what the code produced. Dev sites/projects worked well for that. I set them up on a private VM and took the laptop to the interview. It seems to have worked....
×
×
  • 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.