Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 15 of 15
  1. #1
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts

    Arrow needing feedback on contact form

    hey all, a while back i made a contact form for moss2076 and i ended up making a release of it on my website. Im trying to get feedback and comments of the script, and of the coding.

    The most current release of it is on my website at http://www.owt200x.us/contactform

    Thanks,
    Barry "OwT"

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by owt200x View Post
    hey all, a while back i made a contact form for moss2076 and i ended up making a release of it on my website. Im trying to get feedback and comments of the script, and of the coding.

    The most current release of it is on my website at http://www.owt200x.us/contactform

    Thanks,
    Barry "OwT"
    where is the code?

    regards

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    This belongs in the PHP snippet forum, so I'm moving it. I didn't look through the whole thing, but a few things to note:
    You should always use the full PHP open tag("<?php") when distributing code(really, all the time), because people might be on servers that don't have the short_open_tag option on.
    You use echo and print both, when you only need one. You don't really need to use print, so stick with echo as it's slightly faster.
    In a few places you use logic to check if something is true, but then you leave the execution section blank, and use the else section. You don't need to, and shouldn't, specify both if you don't need them. For instance:
    PHP Code:
    <? if ( == filesize "contact.motd.txt" ) ) { } else { ?><br><? include( "contact.motd.txt" );?></font><br><? ?>
    Becomes:
    PHP Code:
    <?php
    // Change the logic to match your else condition
    if (filesize('contact.motd.txt') > 0)
    {
        include(
    'contact.motd.txt');
    }

    ?>
    Move the extra HTML into your txt file so you don't have to drop in and out of PHP.
    Also, you should only use single quotes for strings unless you have a variable or special character in them so the PHP interpreter doesn't have to interpolate the string.

  • #4
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,638
    Thanks
    2
    Thanked 404 Times in 396 Posts
    Quote Originally Posted by oesxyl View Post
    where is the code?

    regards
    It's on the website. I forgot to mention: owt200x, please post the code here instead of directing people elsewhere.

  • #5
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    the code can be downloaded from my website, i would post it here, but i might make changes in a few hours so i always have it posted on my website

    http://www.owt200x.us/contactform

  • #6
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    heres the code for contact.php
    PHP Code:
    <?php
    // Contact file for the contact form by OwT200x. Please donate at http://www.owt200x.us
    include_once( "contact.config.php" );
    include_once( 
    "contact.functions.php" );
    ?>
    <html>
    <head>
    <title><? echo $businessname?> - <? echo $formtitle?></title>
    <meta http-equiv="Content-Language" content="en-us">
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
    </head>
    <link href="contact.css" rel="stylesheet" type="text/css">
    <? if ($background == "COLOR" or $background == "color") { ?><body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" oncontextmenu="return false"  ondragstart="return false" onselectstart="return false" bgcolor="<? echo $backgroundcolor?>">
    <? } elseif ($background == "IMAGE" or $background == "image") { ?><body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" oncontextmenu="return false"  ondragstart="return false" onselectstart="return false" background="<? echo $backgroundimage?>">
    <? } else { ?><body marginheight="0" marginwidth="0" leftmargin="0" topmargin="0" oncontextmenu="return false"  ondragstart="return false" onselectstart="return false"><? ?>

    <meta http-equiv="content-type" content="text/html; charset=">

    <!-- Begin Form Page Header -->

    <table border="0" width="75%" height="228">
    <tr><td>
    <p align="center">
    <? if (empty ($logo)) {} else { ?><a title ="<? print $businessname?>"><img src="<? echo $logo?>"></a><? ?></p>
    </td>
    <td width="371">
    <table border="0" width="100%" height="123">
    <tr><td>
    <p align="center"><font class='form_title'><? echo $businessname?></font></p>
    </td></tr>
    <tr><td>
    <p align="center"><font class='form_title'><? echo $formtitle?></font></p>
    </td></tr>
    <tr><td>
    <p align="center"><font class='form_title'><? if ( == filesize "contact.motd.txt" ) ) { } else { ?><br><? include( "contact.motd.txt" );?></font><br><? ?><br><a title="<? echo $requiredtitle?>"><img src="<? echo $requiredimage?>" width="16" height="16"></a> <font size="2">Denotes required field.<br><br><noscript>For best form performance, please enable Javascript.</noscript></font></p>
    </td></tr></table>
    </td></tr></table>

    <!-- End Form Page Header -->
    <!-- Begin Form -->

    <?php
        
    if( !$isHideForm ): 
            global 
    $sErr ;
            if( 
    $sErr ) print "<br><a name='error'></a><center><font class='form_error' >$sErr</font></center><br>"

            
    $starColor $sErr "#ff0000" "#000000";
            
    $style=" class='form_text' ";

     
    ?>

    <form onClick="highlight(event)" onSubmit="submitonce(this)" name="<? echo $formname?>" action="<?php print PHP_SELF ?>" method='post' enctype='multipart/form-data'>
    <input type='hidden' name='formmail_submit' value='Y'>
    <input type='hidden' name='esh_formmail_recipient' value="<? echo $safename; echo $atsymbol; echo $safedomain?>">
    <input type='hidden' name='esh_formmail_cc' value="<? echo $safeccname; echo $ccemailat; echo $safeccdomain?>">
    <input type='hidden' name='esh_formmail_return_subject' value="<? echo $autorespondsubject?>">
    <input type='hidden' name='esh_formmail_return_msg' value="<? echo $autorespondmessage?>">
    <input type='hidden' name='esh_formmail_charset' value="">
    <table cellspacing='12' cellpadding='0' border='0' width="617">

        <tr>
            <td class="form_field" valign='top' width="289">
            <p align="right">Name</td>
            <td width='16'  align='right' valign='top'><a title="<? echo $requiredtitle?>"><img src="<? echo $requiredimage?>" width="16" height="16"></a></td>
            <td class="form_text" width="264">
    <p align="right">
    <input type="text" onBlur="stripHTML(<? echo $formname?>.Name)" name="Name"  value="<?php  print HtmlSpecialChars$HTTP_POST_VARS"Name" ] ); ?>" class='text_box' size="18" maxlength="20"><a class="hintanchor" onMouseover="showhint('<? echo $namehint?>', this, event, '200px')"><img src="help.png" width="16" height="16"></a>
            </td>
        </tr>
        
        <tr>
            <td class="form_field" valign='top' width="289">
            <p align="right">Email Address</td>
            <td width='16'  align='right' valign='top'><a title="<? echo $requiredtitle?>"><img src="<? echo $requiredimage?>" width="16" height="16"></a></td>
            <td class="form_text" width="264">
    <p align="right">
    <input onBlur="stripHTML(<? echo $formname?>.Email_Address)" type="sender's email" name="Email_Address"  value="<?php  print HtmlSpecialChars$HTTP_POST_VARS"Email_Address" ] ); ?>" class='text_box' size="18" maxlength="20"><a class="hintanchor" onMouseover="showhint('<? echo $emailadresshint?>', this, event, '200px')"><img src="help.png" width="16" height="16"></a>
            </td>
        </tr>
        
        <tr>
            <td class="form_field" valign='top' width="289">
            <p align="right">Subject<td width='16'  align='right' valign='top'><a title="<? echo $requiredtitle?>"><img src="<? echo $requiredimage?>" width="16" height="16"></a></td>
            <td class="form_text" width="264">
    <p align="right">
    <input type="text" onBlur="stripHTML(<? echo $formname?>.esh_formmail_subject)" name='esh_formmail_subject' value="<?php  print HtmlSpecialChars$HTTP_POST_VARS"esh_formmail_subject" ] ); ?>" class='text_box' size="18" maxlength="20"><a class="hintanchor" onMouseover="showhint('<? echo $subjecthint?>', this, event, '200px')"><img src="help.png" width="16" height="16"></a>
            </td>
        </tr>
        
        <tr>
            <td class="form_field" valign='top' width="289">
            <p align="right">Message</td>
            <td width='16'  align='right' valign='top'></td>
            <td class="form_text" width="264">
    <p align="right">
    <textarea onBlur="stripHTML(<? echo $formname?>.Message)" wrap="soft" name="Message" rows=4 cols=22><?php  print HtmlSpecialChars$HTTP_POST_VARS"Message" ] ); ?></textarea><a class="hintanchor" onMouseover="showhint('<? echo $messagehint?>', this, event, '200px')"><img src="help.png" width="16" height="16"></a>
            </td>
        </tr>
        
        <tr>
            <td class="form_field" valign='top' width="289">
            <p align="right"></td>
            <td width='16' align='right' valign='top'></td>
            <td class="form_text" width="264">
    <p align="right">
    <center><font size ="1"><a href="http://opencaptcha.com/" target="_blank">OpenCaptcha</a><br>Please enter the code you see below in the<br>text field below to prove your human.</font></center>
    <?
    $date 
    date("Ymd");
    $rand rand(0,9999999999999);
    $height "80";
    $width  "240";
    $img    "$date$rand-$height-$width.jpgx";
    ?>
    <input type="hidden" name="img" value="<? echo $img?>">
    <img src="http://www.opencaptcha.com/img/<? echo $img?>" height="<? echo $height?>" width="<? echo $width?>"><br>
    <center><input type="text" onBlur="stripHTML(<? echo $formname?>.Captcha)"name="Captcha" size="10"><br><br>
    <input type="submit" value="Submit"></center></td></tr>
    </table>
    </form>
    <!-- End Form -->
    <?php
            
    if( $sErr ) print "<script language='javascript' type='text/javascript'>location.href='#error';</script>";;; 

    else: 
    //!$isHideForm
        
    print( "<center><b>$thankyoumessage</b></center>" );
    endif; 
    //!$isHideForm

    /**
     * Please do not remove of Modify the footer tag before. I do not make a profit for this script.
     * All of the money that is donated is going to build and run a homeless shelter.
     *                                     Thank you OwT200x
     */
    ?>
        <td width="10%">
            &nbsp;
            </td>
            </tr>
            <tr>
        <td colspan="3">&nbsp;
            </td>
            </tr>
    </table>
        <table width="100%" border="0" cellpadding="0" cellspacing="0">
            <tr>
                <td align="center" style="font-size:10px">
                <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
                <input type="hidden" name="cmd" value="_s-xclick">
                <input type="hidden" name="hosted_button_id" value="981828">
                <font size="2"><font face="Verdana"><a href="http://www.owt200x.us/contactform/" target="_blank">Contact Form<?php if (empty ($version)) { } else { ?>&nbsp;v<?echo $version; } ?></a>&nbsp;Designed by <a href="http://www.owt200x.us/" target="_blank">OwT200x</a>&nbsp;|&nbsp;Although it's free, donations to my <input type="image" src="http://www.owt200x.us/shelterlink.png" border="0" name="submit" alt=""> are appreciated.
                </form>
                </td>
            </tr>
        </table>
    </body>
    </html>

  • #7
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by owt200x View Post
    the code can be downloaded from my website, i would post it here, but i might make changes in a few hours so i always have it posted on my website

    http://www.owt200x.us/contactform
    apologise, I was not clear.
    I see the download link on the site but I don't use rar/unrar so I can't decompress.
    On the other hand I think is better to be posted here.

    best regards

  • #8
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    can i attach the script here in a zip file? would that be ok?
    Attached Files Attached Files
    Last edited by owt200x; 11-10-2008 at 12:03 AM.

  • #9
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    I'm agreed with Inigoesdr and I add two observation:
    - I'm not sure but I guess html part is invalid, validate and fix, put a doctype
    - it's very hard to read and probably hard to maintain because of identation and how is mixed html with php.

    I will come back later with another things if I wll find.

    best regards

  • #10
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by owt200x View Post
    can i attach the script here in a zip file? would that be ok?
    I think is better zip, and if you consider that is ok a second link for a gzip version.

    Edit: I talk about download links from your site not about attachemnt on cf,

    best regards
    Last edited by oesxyl; 11-10-2008 at 12:08 AM.

  • #11
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    i added both rar and zip downloads to my website, you you sayin i should put a gzip one up also?

  • #12
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by owt200x View Post
    i added both rar and zip downloads to my website, you you sayin i should put a gzip one up also?
    this could be too much,
    the "polite" version from may site is to have a zip for windows users and gzip for others, I don't know how many people use rar, usualy on any system you can find a zip, or gzip decompressor( gzip know also to decompress a normal zip).
    short version, I guess the zip will be enought for anybody,

    best regards

  • #13
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    i added a zip and tar gzip download option on my website, i made some updates, changed the <? to <?php and the HTTP_POST_VARS to _POST

    i plan to keep it html and php for a while, its easier for me to update and change like that.

    I also added an option to either use the subject field on the form, or not have the field and use a subject you can define in the config file.

    I made a few other updates as well.

  • #14
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    Quote Originally Posted by owt200x View Post
    i added a zip and tar gzip download option on my website, i made some updates, changed the <? to <?php and the HTTP_POST_VARS to _POST

    i plan to keep it html and php for a while, its easier for me to update and change like that.

    I also added an option to either use the subject field on the form, or not have the field and use a subject you can define in the config file.

    I made a few other updates as well.
    I apologise for late feedback.
    I like that you change the coding style, it's more easy to read and understand.
    I don't think that you can separate html from php without redesign everything and from my point of view is more simple to keep all this in a file, like now.
    Try to avoid to use global.

    best regards

  • #15
    Regular Coder
    Join Date
    Sep 2008
    Location
    Oklahoma
    Posts
    249
    Thanks
    11
    Thanked 13 Times in 13 Posts
    thank you all for yoru feedback, I'm trying to make a better version of the code, to make it small and more readable.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •