Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Posts posted by CroNiX

  1. The site owner is ultimately responsible for content shown/available on their site, not the end users. All it takes is some lawyer to file a suite against you, whether the claim is valid or not. Nothing you do can really "prevent" you from being sued. Whether they will actually win is another story, but you will still need a lawyer to fight the charge which will cost money. You really should consult an IP (intellectual property) attorney and not take advice from the internet on this. You're talking real money here, and potentially A LOT of it. IP lawyers aren't cheap, but if you are going to be entering this realm a few thousand $$ now so you know the ins and outs of the LAW and how it pertains to what you're doing could save you 100x that in the longrun.

  2. You can use %{HTTP_HOST} in a RewriteCond to detect the domain name, and RewriteRule(s) specific to that domain name. But it seems like each WP "site" should have it's own .htaccess and not one to run them all.

     

    .htaccess files cascade.

     

    Like if you had:

    /public_html/.htaccess

    /public_html/site1

    /public_html/site2

     

    That .htaccess at the root (public_html) would affect both the /site1 and /site2 dirs. Instead you'd want a separate htaccess to be within each of the /site1 and /site2 dirs. This would be more clean with each site having it's own htaccess file, and then you wouldn't have to muck around with domain specific rules which can get very complex the more sites you're trying to control with a single htaccess file.

  3. So I'm assuming the text file you want viewed is on the server and not part of the current page? If so you'd want to use AJAX in conjunction with a MODAL window. Click the button, it fires off an ajax request to the server to retrieve the specified file, when the retrieved info is sent back to the browser display it in a MODAL popup window.

     

    This can only be done using javascript and I'd recommend using jQuery if you aren't already.

  4. Just to clarify... jQuery IS javascript. It's a javascript framework that makes code easier to write (less code needed, easier syntax) and is also cross-browser compatible and fixes missing functions for each browser. Not all browsers implement js exactly the same, so jQuery fixes that so it will work the same in all browsers so you don't have to do things like:

    if (browser is internet explorer) {
      //do it this way
    } elseif (browser is firefox) {
      //do it that way
    } elseif (browser is safari) {
      //some other hack
    }

    javascript is the only way to manipulate a page once it's sent to the browser by your php script (or anything else...pure HTML, etc)

    • Like 1
  5. You can also use the index in the foreach() instead of manually incrementing a counter

    foreach($rows as $count => $row) //Use array index called $count
    {
      $div_cls = (($count % 2) == 0) ? 'linksmen' : 'linksmen_s'; //use the $count to determine odd/even and apply classname for each
      echo '<div class="'.$div_cls.'" title="'.$row['phonemodel'].'"><a href="iphone.php?phonemodel='.$row['phonemodel'].'"><img src="images/mark.png" alt="" /> '.$row['phonemodel'].'</a></div>';
    }

    This can also be accomplished using pure css, a single classname for each of those divs (instead of 2 separate ones) and using odd/even pseudoselectors.

    http://www.w3.org/Style/Examples/007/evenodd.en.html

  6. Psycho is correct, just using a token isn't nearly enough and is only PART of the solution. All I have to do is open up my browsers developer tools and change the value in the form itself and submit it...while I'm on your site (no downloading HTML locally and altering it and submitting it). It will accept the token you added because the correct token would be present and still submit the "illegal" value that I manually altered. And since you aren't doing any data validation, your app will just accept the illegal value.

     

    So to reiterate...NEVER TRUST USER DATA without validating that it is the correct type/format/whatever that you need for each value being submitted by the user, whether it's form POST data, or GET data, or anything else.

     

    So let's say your dropdown has 3 options in it that submits either "1", "2" or "3" as the value.

    When the form is submitted, you must check to see that the value was either "1", "2" or 3 (the only legal/valid choices), whether it's a db query to see that the value exists in the db or some other way (checking against an array of acceptable values if the values are hardcoded and not coming from db). If the value was "4" or "A", you need to reject it and have an error that the user submitted an illegal value and to try again.

  7. See in your query above how most of the text is in green and some is in black? That's because you end your query by closing the double quote right after

    AND '$dataFim'"  <-- premature double quote.

     

    You have 3 double quotes in your query, so there is an extra one or one is not closed. They should always be in pairs. Remove the one after $dataFim.

  8. If you are learning PHP I would discourage you from using Dreamweaver. It encourages bad practices and produces poor code, which won't help you while learning.

     

    That said, the problem most likely is the paths used to your various assets is not correct (css/images/etc).

     

    How are you loading them? Can you show some code like where you are using an image or something?

    • Like 1
  9. I'd do it a bit differently, and not store fake data in the db.

     

    Lets say you have a "documents" page, and you are displaying 20 items on it. So you query the database to get the "documents" and let's say only 5 exist. In your view, I'd just check the quantity of results that you got back from the db and subtract it from 20, which would be 15. So display the 5 existing "documents" and then generate 15 "placeholders" just using HTML/CSS.

  10. $_SESSION is like any other variable. If you try to access it (or an index within it) without it existing, you will get an error.

    if ($_SESSION['something'])

    assumes 'something' already exists in session, which it doesn't at the point where you are trying to access it or you wouldn't be getting an error.

     

    So, you need to check if the variable isset() before trying to just blindly use it in a comparison statement - if()

    if (isset($_SESSION['something']) && $_SESSION['something'] == some_value)
×
×
  • 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.