Jump to content

ManiacDan

Staff Alumni
  • Posts

    2,604
  • Joined

  • Last visited

  • Days Won

    10

Everything posted by ManiacDan

  1. shell_exec will always execute on the server, regardless of how you access the file (through the cli or through a web server).
  2. IN is the operator itself, you don't need the equals.
  3. IN for mysql combined with implode() for PHP while creating the query.
  4. You can't really understand how bad it is until you watch an entire server and database disappear because someone used eval. It really should never ever be used for anything unless you're: 1) A genius 2) Just testing something locally 3) Performing code reviews/unit tests on a non-public box If you want to get into it with your professor, ask him "isn't it really insecure to use eval() without any kind of security involved? Should we be using this?" See what (s)he says.
  5. You want either floor() or round() (note that ceil() also exists)
  6. If you're taking a course where the professor recommended eval, drop the course. I'm not even kidding. Your original piece of code accepted data into the $_SERVER value and ran it through eval(). If a malicious user ever discovers this, they can put PHP code into the $_SERVER variable and literally delete your entire website. eval is for testing and for very very high-level coding, it cannot ever be used for functionality, even as an example. There is always a way to do it without running user-generated strings back through as PHP function calls.
  7. We don't have a profanity filter on these boards because we trust our members to not act like children. Clearly some need to be watched. This thread is closed and OP has been placed on the watch list.
  8. The error comes from the fact that $this->member['avatar_size'] does not contain a lowercase 'x'. That line you posted simply takes $this->member['avatar_size'], and says "the item before the x is the width, and the item after the x is the height." It assumes an x will be there, producing two items.
  9. You need a friends table, yes. It will link two userIDs and probably have a "friends since" field, maybe even a "relationshipType" field for relatives and partners.
  10. Ok I'm glad you did this when you're first learning, because: never ever use eval() ever. Now that that's out of the way: <?php # Set text/plain instead of text/html header('Content-type: text/html'); $html = file_get_contents("page.html"); # Function that gets and prints all enviroment variables function loop(){ $string = ''; foreach ($_SERVER as $name=>$value ) { $string .= "$name: $value\n"; } return $string; } # Prints the contents of page.html and replaces ---insert--- with number of hits echo str_replace('---insert---', nl2br(loop()), $html); ?> I've altered your loop() function to return a string, rather than echoing directly. I've also used the nl2br function to change the newlines in loop()'s output to HTML line breaks. Since your assignment specifies not using HTML in PHP, I didn't want to stick a "<br>" in that output. I think removed your seriously dangerous eval() line and replaced it with a safer and saner str_replace. -Dan
  11. Most of them just use google ads, which do that for you. An "impression" is just whether or not you showed the ad. If you show it, count it in the database or whatever. Outbound clicks are harder, you need an intermediary page that accepts their click, records it, and then forwards them to where they're going.
  12. "Name Server" should be "1and1 name server" then you'll have another option where you can set the IP address for your domain. The 1and1 help file has more.
  13. You can set the name servers? That's not the right word. Ok, this is what happens: The domain registrars maintain databases of "this domain points to this IP." Those database form the domain name service. There are master DNS servers and regional ones, you don't really need to know how that network is set up. When a user types "www.yoursite.com" into his browser, his computer checks the local DNS server to determine what IP he should use. So what you need to do is edit where the domain name resolves (or "points") to. If you're editing something that says "DNS Server" you're probably editing where your computer looks for new addresses.
  14. There wouldn't be anything about DNS at the VPS service. You're renting a domain name from DomainNamesInc. You're renting a VPS with 7 IPs from VPSInc. You need to call DomainNamesInc and say "please route my domain name to this IP which points to my VPSInc server."
  15. Do you already own a domain?
  16. Call the people you bought the domain from, they're the ones who handle the routing to your IP.
  17. $value in your bottom loop is another array. You have to foreach through it or use implode() or something to get the values out. Attempting to echo an array just prints "Array".
  18. We have to stop giving this poor girl such horrible ideas.
  19. You totally shouldn't do it...but you could. You should have seen my face when I was trying to debug a perl module and realized that the window was too narrow to show me the "unless" clauses off on the right side of the lines. I was so confused.
  20. Pika, you may be interested to learn that the && can be used as a quick shorthand IF: strpos($off, ';') !== FALSE && $off = substr( $off, strpos( $off, ";" ) + 1 ); It's sloppy and perl-like and will cause any code reviewers to punch you, but it's valid. I think it's fun.
  21. That doesn't work for me, am I missing some ironic joke?
  22. That code is definitely the problem, I just ran your code with and without it: php > $offer = array('Free 3 Year On-Site Warranty'); php > php > if ( isset( $offer[ 0 ] ) ) php > { php { $off = strip_tags( $offer[ 0 ] ); php { $off = substr( $off, strpos( $off, ";" ) + 1 ); php { $off = str_replace("'", "", $off ); php { $off = trim( $off ); php { } else { php { $off = "0"; php { } php > php > echo $off; ree 3 Year On-Site Warranty php > php > php > php > $offer = array('Free 3 Year On-Site Warranty'); php > php > if ( isset( $offer[ 0 ] ) ) php > { php { $off = strip_tags( $offer[ 0 ] ); php { //$off = substr( $off, strpos( $off, ";" ) + 1 ); php { $off = str_replace("'", "", $off ); php { $off = trim( $off ); php { } else { php { $off = "0"; php { } php > php > echo $off; Free 3 Year On-Site Warranty See?
  23. $off = substr( $off, strpos( $off, ";" ) + 1 ); If there is no ';' in $off, that line will trim the first letter off $off.
  24. It's probably breaking in the middle of your tag. Insert newlines yourself, don't rely on wordwrap.
  25. Some of the best food I've ever eaten has been at hole in the wall diners. I don't want to pay $140 for a 4oz steak at one of his restaurants.
×
×
  • 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.