Jump to content

rythemton

Members
  • Posts

    107
  • Joined

  • Last visited

Posts posted by rythemton

  1. I was just informed (by a former employee of BlueHost) that because GoDaddy is so successful, that all of the other hosting companies they own will begin following GoDaddy's model.

     

    Well, that's scary.

    He lost his job because he refused to Upsell during Tech Support Calls. He didn't feel that Upselling to people who are having problems with their current service was a good idea!

  2. If you have the resources to run your own server, do it!!!

     

    Nearly all of the big web hosting companies are now owned by 5 major companies. These are probably the same parent companies that own most of the television stations: http://theeconomiccollapseblog.com/archives/who-owns-the-media-the-6-monolithic-corporations-that-control-almost-everything-we-watch-hear-and-read

     

    I've been with HostMonster for years, but I'm not sure how much longer I will be with them. They (and several others including BlueHost) were recently purchased by the same company that owns GoDaddy. I was just informed (by a former employee of BlueHost) that because GoDaddy is so successful, that all of the other hosting companies they own will begin following GoDaddy's model. They are blind to the fact that GoDaddy is so big because of advertisement!

     

    Further reason not to use GoDaddy, is their Domain Resell services. If you look up a Domain Name on GoDaddy's web site, if you don't purchase it right away, you'll find that the Domain has gone to one of GoDaddy's Domain Resellers. A friend lost 3 domains this way, and lost 2 more test domains that were looked up just to prove that GoDaddy was doing this on purpose!

     

    I say it again, if you have the resources, run your own server!!

  3. But back to my OP, do you think I should leave Empty Strings as is, or convert them to NULLs?

     

    It seems to me it would be better to convert things to NULL's, since that more accurately represents what an unanswered field really is.

     

    Then again, a lot of people say that a table with a lot of NULL's in it is a sign of poor database design?!  :shrug:

     

    The Form I am currently working on is User Details, so a lot of the fields are "optional"...

    I'm afraid you are asking a very opinionated question here. It is really personal preference. As long as you're consistent on a per field basis, it really doesn't matter, IMHO.

     

    If your scripts expect NULL, and are getting NULL from the database, it will work. If your scripts expect Empty Strings, and are getting Empty Strings from the database, it will work. If your scripts expect NULL, and get Empty Strings, or vice versa, you'll have issues.

  4. This is actually a problem with your encapsulation type in the form itself. You need to set the form to be a multipart encapsulation:

     

    <form enctype="multipart/form-data" action="yada.php" method="post">
    

     

    The multipart is needed because you are dealing with binary data.

  5. The problem is that you are returning a value before the next check. As soon as you return a value, the function ends. Try setting a default value, and changing it. Then you return it at the end, only once:

    function sampleFunction() {
        checkValue = true;
        if(form.aut_make.value==""){
            document.getElementById("id_aut_make").innerHTML = "You must enter the make";
            checkValue = false; // Here we are changing the check value because there are errors, but not 'return'ing anything yet.
        }else{
            document.getElementById("id_aut_make").innerHTML = "";
        }
        // Add the rest of the checks here. Setting the check value more than once won't hurt anything.
        
        return checkValue;
    }

  6. The data is showing properly in the database. A BLOB is a Binary Object, so it will not be human readable. All you have to do to display it is set the header to the proper type, and echo the contents of the retrieved field. Don't output anything else, just the contents of that field.

     

    Here is an example that stores and outputs a BLOB stored in MySQL: http://www.anyexample.com/programming/php/php_mysql_example__image_gallery_(blob_storage).xml

  7. Okay I see now... and last questions I have. What is the difference between initializing variables before an initial if statesmen or after an if statement , like the first example on my first post. 

    Initializing before the initial 'if' statement works well if you might have a lot of nested 'if' statements. You might miss an 'else' statement somewhere, and initializing before will still have the value set.

     

    On the other hand, you may want it to not be initialized so that you know that you missed something (isset comes back false, so you know you missed something.)

     

    It also may occur that you don't bother initializing the variable in the 'else' component or before the if statement because you know you'll never use that variable, which could happen if you exit() because of a failure.

     

    It's just personal preference.

  8. $isAdmin = false;

    $isAdmin = "";

    $isAdmin = NULL

     

    Which method is considered good practice and why?

    What are you using it for?

     

    Boolean, set it to FALSE.

    Numbers, I set to 0, or if 0 might be used, NULL.

    Strings, set it to "".

    Arrays, set it to an empty array or to NULL.

    etc...

     

    I think you get the idea.

  9. Can anyone send me a link or enter some info about doctypes?

     

    As time has gone by, the rules of how to display a web page have changed and become more consistent. In the beginning each browser decided on their own how to display the HTML provided. Rather than make everyone update every web site in the internet when new rules came out (good luck on that one) they just created the DOCTYPE syntax to tell the browser what version of HTML you are using.

     

    In HTML 4 and XHTML 1, you have the choice of transitional (you can use old deprecated syntax) or strict (use of deprecated syntax is forbidden.) Also, if you declare that you are using HTML 4 or XHTML 1, it is assumed that you are using CSS 2 (though some web browsers will still accept CSS 3 features.) If no DOCTYPE is declared, I believe it defaults to HTML 4 transitional, but I'm not sure.

     

    If you are new to HTML, just skip straight to learning HTML 5 and CSS 3. It's my understanding that HTML 5 does not officially support deprecated code, so there is no transitional version, but some browsers will display deprecated code anyways. In DreamWeaver, you should be able to tell it what version of HTML to use, and it should change the DOCTYPE for you.

  10. Hi,

     

    Just to pitch in here: you don't necessarily need captcha to prevent spam.

     

    What I usually do is:

    1. Give a random name (e.g. kifer32w39) to email field. Validate this field as email.

    2. Create email field and hide it. When the form is submitted check that this field is not filled. If it is, don't submit the form.

     

    Pretty efficient against spam bots since most of them fill out most used email field names. Of course this doesn't eliminate manual spam, nor does captcha for that matter.

     

     

     

    Seconded.

    I'll give this a third. I've never created a fake email field before, but like the idea.

     

    I check the domain in the email to make sure there is a valid MX record for that domain. checkdnsrr( $host, 'MX' )

    Most spam bots fill in fields they don't recognize with random stuff.

     

    As for Manual Spam, a notice stating that all SPAM will be deleted without being read, or something to that effect, will have most manual spammers moving on to another site.

  11. My guess is that connect.php has some whitespace before <?php or after ?>

    This would be my guess as well. If you have a DOCTYPE declaration, any white-space before this declaration can cause the type to be ignored, which throws some browsers into HTML 4/quirks mode. This will completely mess with your CSS.

     

    IE is notorious for finding any flaw as an excuse to mess with you! Declare XHTML, but have any flaw in your code, it will throw IE into HTML 4/quirks mode. White space before the DOCTYPE, quirks mode. Use HTML 5, quirks mode (j/k, but it seems like it sometimes!)

  12. Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /public_html/cron.php on line 98

    It means the $query is returning FALSE rather than a query resource. Change the line to read:

    if( $query && mysql_num_rows($query) > 0)

    See if that makes a difference.

  13. You can use the first-child and last-child pseudo classes.

    #nav ul li:first-child a {
      border-left: none;
    }
    
    #nav ul li:last-child a {
      border-right: none;
    }
    

    The last-child pseudo class is CSS 3, but first-child is CSS 2, so test it in many browsers to make sure it is doing what you want it to do.

  14. For most PHP pages, once the script is done running, it should be producing a pure HTML page. PHP is just being used to dynamically generate some of the HTML content.

     

    The reason I put 'most PHP pages', is because I've used PHP to generate HTML, JavaScript, CSS, XML, JSON, and others. The output just needs to be what the client is expecting, and for most pages that is HTML.

  15. If you use the variables without setting them, you will get a WARNING, but your script will run anyways. Rather than fill your log with WARNING messages, it's better practice to just set them to empties.

     

    I usually set them to empty before the initial if statement.

    $username = "";
    $password = "";
    if (isset($_POST['submit'])) {
      // Form has been submitted.
    }

    Now I don't have to worry about the 'else' segment.

     

    This habit for me actually came from my C++ programming days, where the scope of a variable was much more restricted - anything initialized within curly brackets was unavailable outside those brackets.

×
×
  • 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.