Announcement

Collapse
No announcement yet.

Form Assistance

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Form Assistance

    Hi,

    I've got a client that is using your webhosting for their site and i'm not familier with your cgi setup.

    I've previously been using anouther company which provided me with a very basic script/cgi file to use for form mailers.

    <form id="form1" name="form1" method="post" action="http://public.companyabc.co.nz/cgi-bin/formmailer.cgi">
    <input type="hidden" name="to" value="emailofclient">
    <input type="hidden" name="next_url" value="http://www.website for form.co.nz/website/thankyou.html.">
    <input type="hidden" name="subject" value="Join the company Database">

    Does vodahost have a formmailer.cgi that i can replace the http://public.companyabc.co.nz/cgi-bin/formmailer.cgi with? Or do i have to host the file on the clients website?

    A company i have used previously has a setup like this:

    Register your domain name at RegisterDIRECT & activate free features including 10 POP3 accounts, Mail & URL forwarding and more! Register a range of domain names including .co.nz


    where it's a very simple global script.

    any assistance would be very helpful. If you need more information please pm me.

    Regards,

    Me....

  • #2
    Re: Form Assistance

    If the website is made with BlueVoda, it is very simple: create the form page and use the built in form wizard, as seen in http://www.vodahost.com/vodatalk/for...-tutorial.html

    It will autocreate the necessary php code to process your form through the mail() function of php.

    If you haven't used the form wizard, please follow these steps:

    1. Copy the following code:

    Code:
     
    <?php
    if($_SERVER['REQUEST_METHOD'] == 'POST')
    {
    function RecursiveMkdir($path)
    {
    if (!file_exists($path))
    {
    RecursiveMkdir(dirname($path));
    mkdir($path, 0777);
    }
    }
    $mailto = [COLOR=red][COLOR=black]'[/COLOR]you@yourdomain.com[/COLOR][COLOR=black]'[/COLOR];
    $mailfrom = isset($_POST['email']) ? $_POST['email'] : $mailto;
    $subject = [COLOR=red][COLOR=black]'[/COLOR]Website form[/COLOR][COLOR=black]'[/COLOR];
    $message = [COLOR=red][COLOR=black]'[/COLOR]Values submitted from web site form:[/COLOR][COLOR=black]'[/COLOR];
    $success_url = [COLOR=red][COLOR=black]'[/COLOR]http://www.yourdomain.com/thankyou_page.html[/COLOR][COLOR=black]'[/COLOR];
    $error_url = [COLOR=red][COLOR=black]'[/COLOR]http://www.yourdomain.com/errorpage.html[/COLOR][COLOR=black]'[/COLOR];
    // $filesize = $_POST['filesize'] * 1024;
    $max_filesize = isset($_POST['filesize']) ? $_POST['filesize'] * 1024 : 1024000;
    $upload_folder = isset($_POST['upload_folder']) ? $_POST['upload_folder'] : "uploads";
    $upload_folder = "http://" . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME'])."/".$upload_folder;
    $header = "From: ".$mailfrom."\r\n";
    $header .= "Reply-To: ".$mailfrom."\r\n";
    $header .= "MIME-Version: 1.0"."\r\n";
    $header .= "Content-Type: text/plain; charset=utf-8"."\r\n";
    $header .= "Content-Transfer-Encoding: 8bit"."\r\n";
    $header .= "X-Mailer: PHP v".phpversion();
    $prefix = rand(111111, 999999);
    $i = 0;
    while (list ($key, $val) = each ($_FILES))
    {
    if ($_FILES[$key]['name'] != "" and file_exists($_FILES[$key]['tmp_name']) and $_FILES[$key]['size'] > 0)
    {
    $upload_DstName[$i] = $prefix . "_" . str_replace(" ", "_", $_FILES[$key]['name']);
    $upload_SrcName[$i] = $_FILES[$key]['name'];
    $upload_Size[$i] = ($_FILES[$key]['size']);
    echo "Uploaded File size = ".$upload_Size[$i] ."<br>]";
    $upload_Temp[$i] = ($_FILES[$key]['tmp_name']);
    $upload_Type[$i] = ($_FILES[$key]['type']);
    $uploadlink[$i] = "$upload_folder/$upload_DstName[$i]";
    $upload_fieldname[$i] = $key;
    $upload_fieldname_final[$i] = ucwords(str_replace("_", " ", $key));
    $fieldvalue[$i] = $uploadlink[$i];
    if ($upload_Size[$i] >= $max_filesize)
    {
    $error .= "The size of $key (file: $upload_SrcName[$i]) is bigger than the allowed " . $max_filesize/1024 . " Kbytes!\n";
    }
    }
    $i++;
    }
    $crack[0] = '\n';
    $crack[1] = '\r';
    $crack[2] = "%0a";
    $crack[3] = "%0d";
    $crack[4] = "content-type:";
    $crack[5] = "to:";
    $crack[6] = "cc:";
    $crack[7] = "bcc:";
    $crack[8] = "mime-version:";
    $crack[9] = "x0a";
    $crack[10] = "x0d";
    foreach ($_POST as $key => $value)
    {
    for ($k = 0; $k < count($crack); $k++)
    {
    if (substr_count(strtolower($value), $crack[$k]))
    {
    $error .= "The field $key contained e-mail headers ($crack[$k]) in the value submitted. This seems to be a cracking attempt and the message has not been sent.!<br>";
    }
    }
    }
    if ($error)
    {
    $errorcode = file_get_contents($error_url);
    $replace = "##error##";
    $errorcode = str_replace($replace, $error, $errorcode);
    echo $errorcode;
    exit;
    }
    $uploadfolder = basename($upload_folder);
    for ($i = 0; $i < count($upload_DstName); $i++)
    {
    $uploadFile = $uploadfolder . "/" . $upload_DstName[$i];
    if (!is_dir(dirname($uploadFile)))
    {
    @RecursiveMkdir(dirname($uploadFile));
    }
    else
    {
    @chmod(dirname($uploadFile), 0777);
    }
    @move_uploaded_file($upload_Temp[$i] , $uploadFile);
    chmod($uploadFile, 0644);
    }
    $internalfields = array ("submit", "reset", "filesize", "upload_folder", "send", "captcha_code");
    $message .= "\n";
    foreach ($_POST as $key => $value)
    {
    if (!in_array(strtolower($key), $internalfields))
    {
    if (!is_array($value))
    {
    $message .= ucwords(str_replace("_", " ", $key)) . " : " . $value . "\n";
    }
    else
    {
    $message .= ucwords(str_replace("_", " ", $key)) . " : " . implode(",", $value) . "\n";
    }
    }
    }
    if (count($upload_SrcName) > 0)
    {
    $message .= "\nThe following file have been uploaded:\n";
    for ($i = 0; $i < count($upload_SrcName); $i++)
    {
    $message .= $upload_SrcName[$i] . " Link: " . $uploadlink[$i] . "\n";
    }
    }
    mail($mailto, $subject, stripslashes($message), $header);
    header('Location: '.$success_url);
    exit;
    }
    ?>
    2. Customize the code (parts in red) to suit your needs.
    3. Paste it in your Form Page, in the Start of Page tag
    4. Set the form action to be : <? echo $_SERVER['PHP_SELF'];?>

    Create and publish the Thank you page and the error page as you like them, BUT in order for the error page to be able to correctly report errors, follow the instructions at the bottom of the above tutorial.
    Navaldesign
    Logger Lite: Low Cost, Customizable, multifeatured Login script
    Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
    DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
    Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

    Comment


    • #3
      Re: Form Assistance

      Hi thanks for that...

      I've been playing with it for a bit now, and just can't get it to seam to want to work.

      The page is http://www.alkalinehealth.co.nz/shes...pintouch3.html
      that i've been playing with the code on, for some reason unbeknown to me (admitantly i'm rather hungover so i probably shouldn't be trying to figure this out) it's inserting the code as text from the $upload_DstName[$i] point.

      I've tried placing it in different area's in the code but to no avail.

      I'm using a template for the site would that matter?

      Any help would be great.

      Comment


      • #4
        Re: Form Assistance

        The code must NOT be inserted as text.

        You need to paste it in the Start of Page of your page code.
        So if the software you are using allows you to do so, you can paste it there, and publish the page, if not, open the page code with a HTML editor (even Notepad will do he job) and paste the code at the very start. Then save the file and upload it on your site.

        Please note that the form page, created this way, MUST be published as .php and not as .html

        Please note that there is NO FORM (!) in your page. The fields are there, the closing tag </form> is there, BUT the opening Tag <form>, the action, the encoding type etc. part is completely missing! So it will never work anyway, even if you fix the code part.

        So please fix your form first and then fix the code.
        Navaldesign
        Logger Lite: Low Cost, Customizable, multifeatured Login script
        Instant Download Cart: a Powerfull, Customized, in site, DB driven, e-products Cart
        DBTechnosystems.com Forms, Databases, Shopping Carts, Instant Download Carts, Loggin Systems and more....
        Advanced BlueVoda Form Processor : No coding form processor! Just install and use! Now with built in CAPTCHA!

        Comment

        Working...
        X