Jump to content
Stef's Coding Community

jstern

Member
  • Content Count

    93
  • Joined

  • Last visited

Posts posted by jstern


  1. I am a huge supporter of XDebug and find it works very very well. I like to use Netbeans IDE for my development, but XDebug doesn't play all that well with it yet.

     

    When im in Debugging mode, i switch to Eclipse IDE. Very easy setup with XDebug and i can step through code and do unit tests ect very easily.

     

    When doing simple dumps to screen - Zend_Debug::dump($var); works well for my purposes. Gives me a lot more information than a var_dump. Of course you'd need to be in the Zend Framework (im sure) for this one.


  2. I haven't tested any of this to ensure it works properly. And normally I wouldn't be throwing echo's to the screen like this, but like I said, I am used to Zend Framework where I can utilize the views a little differently, but this might be what your looking for, at least the barebones.

     

    <?php

    //php form data to email code//

     

    if (!isset($_REQUEST['first_name'] && $_REQUEST['last_name'] && $_REQUEST['email'] &&

    $_REQUEST['phone'] && $_REQUEST['radio'] && $_REQUEST['message'])) {

    $errormessage = 'Please fill in the required fields';

    echo $errormessage;

     

    } else {

     

    $first_name = $_REQUEST['first_name'];

    $last_name = $_REQUEST['last_name'];

    $email = $_REQUEST['email'];

    $phone = $_REQUEST['phone'];

    $radio = $_REQUEST['radio'];

    $message = $_REQUEST['message'];

    $headers = "From: $email";

     

    $email_message = "First Name: {$first_name}\n\rLast Name: {$last_name}\n\rEmail: {$email}\n\rPhone: {$phone}\n\rInterested In: {$radio}\n\rMessage: {$message}";

    mail('dgow@simplewebs13.com',$radio,$email_message,$headers);

     

    echo "Successfully submitted!";

    ?>


  3. in the php file where your declaring the values.

     

     

    if (!isset($_REQUEST['first_name'] && $_REQUEST['last_name'] && $_REQUEST['email'] &&

    $_REQUEST['phone'] && $_REQUEST['radio'] && $_REQUEST['message'])) {

    $errormessage = 'some generic message here about not filling all required fields'; // you can check them all separately instead for a unique error message depending on which one wasn't filled in.

     

    } else {

     

    $first_name = $_REQUEST['first_name'];

    $last_name = $_REQUEST['last_name'];

    $email = $_REQUEST['email'];

    $phone = $_REQUEST['phone'];

    $radio = $_REQUEST['radio'];

    $message = $_REQUEST['message'];

    ....

    }


  4. theres a few ways to go about something like this.

     

    I'd probably use something along the lines of

     

    if (!isset($_REQUEST['first_name'])) {

    $errormessage = "Please fill in the name field";

    } else {

    $first_name = $_REQUEST['first_name'];

    ....

     

    you could elaborate on the if statement to include the required fields by using '&&' (ex. (!isset($_REQUEST['first_name'])) && (!isset($_REQUEST['last_name'])) && ect.. , and echo out the customer error message(s) depending on what wasn't filled in.

     

    Using the '!isset' method is like saying "if (is not set) then do this or else this". I find its best to treat things as guilty before proved innocent in php.

     

    There's a much easier way to do this in the Zend Framework / Zend Forms, and that is what I am more accustomed to nowadays, so someone else might have a better way than what I have said.


  5. What I've done with jprint in the past in a similar situation, was created a hidden div in format you want the printed area to be printed.

     

    - Make your page look how it's supposed to to the person visiting.

    - Make a hidden div below all your content, but in the format (columns style) you need printed in.

     

    Noone will ever see the hidden divs (unless they inspect the page i suppose, but that's not a big deal).


  6. Can wordpress be used with something like zencart? or does it have something else already available? I will soon be starting a project that will need a simple shopping cart and I'm looking for ideas. I'd like something better than coding everything from almost scratch.


  7. im not sure how .htaccess would help. We use our dev servers so we can keep our projects 'live' and the boss man can take a look at projects as progress. I suppose we could keep move them to an internal server but thats another task altogether at the moment, and we've previously purchased domainnames for them.

     

    I think what i've decided to do was add the specific metatags during one of the site setup controllers. (Another reason i love Zend!)

     

    If (DEV) NOINDEX NOFOLLOW kinda idea.

     

    Either that or add to the dev sites robots.txt file. I think something like:

     

    User-agent: *

    Disallow: /*

     

    If i do the robots method, i run the risk of the guys overriding the file when committing a new branch to the dev servers. This way would probably quicker and easier if anyone else had this problem with no risk of override. (Anyone know a way to protect the robots.txt file? All our developers have root access.)


  8. it looks pretty malicious to me. it also looks like it will rename itself, or its directory periodically. Not sure what it does though. Possibly a attack (brute force) script?

     

    The fact that is trying to open / read to your .htaccess file ($fht = fopen("$tname/.htaccess", "w+");) tells me you should get rid of it as well.


  9. yessum

     

    if (is_string($value)) {

    $value = (str_replace(",","",$value));

    $this->_value = round($value, 2);

    }

     

    seems to be the fix i needed.

     

    I dont know why i was looking for something easier than this, this was pretty dang simple lol.

     

    (*is_string is only important due to various types being passed through my method.)


  10. Hopefully a quick Q

     

    I have a string with the value "4,120.00"

     

    I'd like to convert this to a int or a float. (Im hoping without having to strip the string of its comma myself)

     

    the value is set using:

     

    $this->_value = round($value, 2);

     

    when I use $this->_value = ((float)$value); it just returns "4" (becuase of the comma). Same thing with (int).

     

    Anyone know a quick solution?


  11. I find with older owners, they really dont know what they want for these types of things. It may be risky on your part, but just go ahead a do the site the way you want, with their content. If its 100% better than what is currently up (which really wouldnt take you much time) he'll be impressed.

     

    They honestly don't know what it CAN look like until you show them. I say this is risky because your going to spend some time creating something nice that they haven't given the go ahead for.

     

    When i was first got into designing sites (10 years ago) I looked at a lot local websites. I picked 2 of the absolute worst sites i could find, and I re-did them without even contacting the owners. I did them for free to help get a portfolio going and go gain he experience. (I think one of them actually 'tipped' me $500 for my efforts. I made him donate it to the SPCA). All im saying, is they probably dont really know what they want until you show them what it could be.

     

    Unsliced bread was good enough until someone showed it could be sliced.

×
×
  • Create New...