Results 1 to 2 of 2

Thread: easy counter not functioning

  1. #1
    Join Date
    Jun 2006
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking easy counter not functioning

    hey i have this easy counter that is suppose to wright to a txt file and then after the number reaches X which in my case is 100, it displays a error saying sorry bummer blabla. any who i think i am missing something becasue it is not submitting the error. i want a simple pop up error, any thoughts? also it is not wrighting to the txt file, and i have already changed the txt to 0666. thoughts?
    PHP Code:
     <!-- //////validation//////////validation////////////validation////////////validation///////////// -->
    <?php
           
    if (isset($_POST["submit"]))
             {
                
    $error = array();
                
    $message "";
                
    $validEmail "^[0-9a-z~!#$%$_-]([.]?[0-9a-z~!#$%$_-])*" "@[0-9a-z~!#$%$_-]([.]?[0-9a-z~!#$%$_-])*" ".[0-9a-z~!#$%$_-]([.]?[0-9a-z~!#$%$_-])*$";
                
    $validName "^[a-z]*" " [a-z]*$";
                
    $validZip "^([0-9]{4,5})$";


                                
                if (!
    eregi($validName$_POST["name"]))
                    {
                          
    $error[] = 'Name field incomplete, First and Last Please.';
                    }
                if (!
    eregi($validEmail$_POST["email"]))
                    {
                          
    $error[] = 'Email field incomplete.';
                    }
                if (
    $_POST["address"] == "")
                    {
                          
    $error[] = 'Address field incomplete.';
                    }
                if (
    $_POST["city"] == "")
                       {
                          
    $error[] = 'City field incomplete.';
                    }
                if (!
    eregi($validZip$_POST["zip"]))
                    {
                          
    $error[] = 'Zip code field must be 4 to 5 digits in length.';
                    }
                if (
    $_POST["phone"] == "")
                    {
                          
    $error[] = 'Phone field incomplete.';
                    }
                if (
    $_POST["state"] == "")
                    {
                          
    $error[] = 'state field incomplete.';
                    }
                if (
    count($error) == 0)
                    {
                        require 
    '0806_contestcode.php';
                        print 
    '<meta http-equiv="refresh" content="0;url=http://www.company.com/contact/contactus/thankyou.html">';
                        exit;  
                    } 
                    
    $logfile "log.txt";
                    if(
    intval( @file_get_contents($logfile) )<1){
                        
    //echo "<input type=\"submit\" name=\"submit\" value=\"submit\">";
                        
    $current intval( @file_get_contents($logfile) ); 
                        
    $current++;
                        
    fwrite($logfile$current);
                    }else{
                        echo 
    "<span style=\"color: #FF0000;\">We are sorry, but the maximum number of submit has been 
                        reached for now. Please wait for an administrator to reset the submit count.</span>"
    ;
                        echo 
    "<input type=\"submit\" name=\"submit\" value=\"submit\" disabled=\"disabled\">";    
                    }
                    
    //alert to us that number has been reached
                    
    if(intval( @file_get_contents($logfile) )<1){
                        
                    }else{
                        
    $headers "From: company\n";
                        
    $headers .= "Reply-to: company\n";
                        
    $message .= "just a friendly note we have reached our goal of whatever it is";
                        
    mail("g@g.com""number has been reached: "$message$headers);   
                    }
                
             }
    ?>
    Last edited by pkcidstudio; 08-03-2006 at 05:13 PM.

  2. #2
    Join Date
    Jun 2006
    Posts
    78
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking

    figured out with help from everyone thankx everyone.
    PHP Code:
    <?php
    if (isset($_POST["submit"]))
    {
        
    $expire "<b>Thank you for your interest. Due to overwhelming response compnay compnay compnay compnay Samples are no longer available. Watch for future opportunities in upcoming issues of compnay compnay compnay E-Newsletter.</b> ";
        
    $logfile 'log.txt';
          
        
    $current intval( @file_get_contents($logfile) );
        
        if (
    $current 101)
        {
            print 
    '<meta http-equiv="refresh" content="0;url=http://www.compnay.com/contact/contactus/errormessage.html">';
            echo 
    $expire;
            exit();
        }
        else
        {
             
    $current++;
             
             
    $fp fopen($logfile'w');
             
    fwrite($fp$current);
             
    fclose($fp);
        }
        
        
    //////////validation//////////validation////////////validation////////////validation///////////// 
       
          
    $error = array();
          
    $message "";
        
    $validEmail "^[0-9a-z~!#$%$_-]([.]?[0-9a-z~!#$%$_-])*" "@[0-9a-z~!#$%$_-]([.]?[0-9a-z~!#$%$_-])*" ".[0-9a-z~!#$%$_-]([.]?[0-9a-z~!#$%$_-])*$";
           
    $validName "^[a-z]*" " [a-z]*$";
        
    $validZip "^([0-9]{4,5})$";
                        
        if (!
    eregi($validName$_POST["name"]))
            {
                  
    $error[] = 'Name field incomplete, First and Last Please.';
            }
        if (!
    eregi($validEmail$_POST["email"]))
            {
                  
    $error[] = 'Email field incomplete.';
            }
        if (
    $_POST["address"] == "")
            {
                  
    $error[] = 'Address field incomplete.';
            }
        if (
    $_POST["city"] == "")
               {
                  
    $error[] = 'City field incomplete.';
            }
        if (!
    eregi($validZip$_POST["zip"]))
            {
                  
    $error[] = 'Zip code field must be 4 to 5 digits in length.';
            }
        if (
    $_POST["phone"] == "")
            {
                  
    $error[] = 'Phone field incomplete.';
            }
        if (
    $_POST["state"] == "")
            {
                  
    $error[] = 'state field incomplete.';
            }
        if (
    count($error) == 0)
            {
                require 
    '0806_contestcode.php';
                print 
    '<meta http-equiv="refresh" content="0;url=http://www.compnay.com/contact/contactus/thankyou.html">';
                exit;  
            }  

     }
    ?>

Bookmarks

Posting Permissions

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