scusate la lunghezza dello script ma e' necessario per farvi capire il problema....

ho queto script per l'invio di dati tuttavia se nel form se scrivo l'email tutto ok se non la scrivo parte lo stesso se la scrivo male si blocca avvisandomi di inserirne una valida......

questo direi che non ha molto senso... come posso correggere in modo che si blocchi anche se non si mette l'email??
che cosa vuol dire quel file badip.txt?
che senso ha $email = '';?

grazie


purtroppo devo dividere in due lo script
Codice PHP:
<?php


/***************************************
** Security.
***************************************/
        
$security      0;
        
$servername[]  = 'www.miosito.com';
        
$servername[]  = 'www.miosito.com';
        
$bad_addresses 'badip.txt';
        
$check_email   1;

/***************************************
** Templates.
***************************************/
        
$use_templates 1;
        
$tpl_thankyou  'thankyou.html';
        
$tpl_email     'email.template.txt';

/***************************************
** Non-template redirections.
***************************************/
        
$required_error 'error.required.html';
        
$bad_referer    'error.referer.html';
        
$bad_address    'error.address.html';
        
$invalid_email  'error.email.html';
        
$thankyou_page  'thankyou.html';
    
/***************************************
** Some defaults.
***************************************/
        
$email     '';
        
$recipient 'miamail@miosito.com';
        
$subject   'Form';
        
$addhostip 0;




########################################
# Nothing to change below here.        #
########################################



        
class html_mime_mail{

                var 
$headers;
                var 
$body;
                var 
$multipart;
                var 
$mime;
                var 
$parts = array();

                function 
html_mime_mail($headers ''){
                        
$this->headers $headers;
                }

                function 
add_attachment($file$name ''$c_type 'application/octet-stream'){
                        
$this->parts[] = array( 'body'   => $file,
                                                
'name'   => $name,
                                                
'c_type' => $c_type );
                }

                function 
add_body_text($body){
                        
$this->body $body;
                }

                function 
build_body(){
                        
$body  'Content-Type: text/html'."\n";
                        
$body .= 'Content-Transfer-Encoding: base64'."\n\n";
                        
$body .= chunk_split(base64_encode($this->body))."\n";
                        return 
$body;
                }

                function 
build_part($i){
                        
$message_part '';
                        
$message_part.= 'Content-Type: '.$this->parts[$i]['c_type'];
                        if(
$this->parts[$i]['name'] != '')
                                
$message_part .= '; name="'.$this->parts[$i]['name']."\"\n";
                        else
                                
$message_part .= "\n";

                        
$message_part.= 'Content-Transfer-Encoding: base64'."\n";
                        
$message_part.= 'Content-Disposition: attachment; filename="'.$this->parts[$i]['name']."\"\n\n";
                        
$message_part.= chunk_split(base64_encode($this->parts[$i]['body']))."\n";
                        return 
$message_part;
                }

                function 
build_message(){
                        
$boundary '=_'.md5(uniqid(time()));

                        
$this->headers.= "MIME-Version: 1.0\n";
                        
$this->headers.= "Content-Type: multipart/mixed;".chr(10).chr(9)."boundary=\"".$boundary."\"\n";
                        
$this->multipart '';
                        
$this->multipart.= "This is a MIME encoded message.\nCreated by html_mime_mail.class.\nSee [url]http://www.miosito.com/[/url] for a copy.\n\n";

                        
$this->multipart .= '--'.$boundary."\n".$this->build_body();

                        for(
$i=(count($this->parts)-1); $i>=0$i--){
                                
$this->multipart.= '--'.$boundary."\n".$this->build_part($i);
                        }

                        
$this->mime $this->multipart."--".$boundary."--\n";
                }

                function 
send($to_name$to_addr$from_name$from_addr$subject ''$headers ''){

                        if(
$to_name != ''$to '"'.$to_name.'" <'.$to_addr.'>';
                        else 
$to $to_addr;

                        if(
$from_name != ''$from '"'.$from_name.'" <'.$from_addr.'>';
                        else 
$from $from_addr;

                        
mail($to$subject$this->mime'From: '.$from."\n".$this->headers);
                }

        } 
// End of class.




        
class template{

                var 
$var_names = array();
                var 
$files = array();
                var 
$start '{';
                var 
$end '}';

                function 
load_file($file_id$filename){
                        
$this->files[$file_id] = fread($fp fopen($filename'r'), filesize($filename));
                        
fclose($fp);
                }

                function 
set_identifiers($start$end){
                        
$this->start $start;
                        
$this->end $end;
                }

                function 
register($file_id$var_name){
                        if(
is_long(strpos($var_name',')) == TRUE){
                                
$var_name explode(','$var_name);
                                for(
reset($var_name); $current current($var_name); next($var_name)) $this->var_names[$file_id][] = $current;
                        }else{
                                
$this->var_names[$file_id][] = $var_name;
                        }
                }

                function 
parse($file_id){
                        if(isset(
$this->var_names[$file_id]) AND count($this->var_names[$file_id]) > 0){
                                for(
$i=0$i<count($this->var_names[$file_id]); $i++){
                                        
$temp_var $this->var_names[$file_id][$i];
                                        global $
$temp_var;
                                        
$this->files[$file_id] = str_replace($this->start.$temp_var.$this->end, $$temp_var$this->files[$file_id]);
                                }
                        }
                }

                function 
parse_loop($file_id$array_name){
                        global $
$array_name;
                        
$loop_code '';
                        
$file explode(chr(10), $this->files[$file_id]);

                        
$start_pos strpos(strtolower($this->files[$file_id]), '<loop name="'.$array_name.'">') + strlen('<loop name="'.$array_name.'">');
                        
$end_pos strpos(strtolower($this->files[$file_id]), '</loop name="'.$array_name.'">');

                        
$loop_code substr($this->files[$file_id], $start_pos$end_pos-$start_pos);
                        
$this->files[$file_id] = str_replace(substr($this->files[$file_id], strpos(strtolower($this->files[$file_id]), '<loop name="'.$array_name.'">'),strlen('<loop name="'.$array_name.'">')), ''$this->files[$file_id]);
                        
$this->files[$file_id] = str_replace(substr($this->files[$file_id], strpos(strtolower($this->files[$file_id]), '</loop name="'.$array_name.'">'),strlen('</loop name="'.$array_name.'">')), ''$this->files[$file_id]);

                        if(
$loop_code != ''){
                                
$new_code '';
                                for(
$i=0$i<count($$array_name); $i++){
                                        
$temp_code $loop_code;
                                        while(list(
$key,) = each(${$array_name}[$i])){
                                                
$temp_code str_replace($this->start.$key.$this->end,${$array_name}[$i][$key], $temp_code);
                                        }
                                        
$new_code .= $temp_code;
                                }
                                
$this->files[$file_id] = str_replace($loop_code$new_code$this->files[$file_id]);
                        }
                }

                function 
parse_sql($file_id$result_name){
                        global $
$result_name;
                        
$loop_code '';

                        
$start_pos strpos(strtolower($this->files[$file_id]), '<loop name="'.$result_name.'">') + strlen('<loop name="'.$result_name.'">');
                        
$end_pos strpos(strtolower($this->files[$file_id]), '</loop name="'.$result_name.'">');

                        
$loop_code substr($this->files[$file_id], $start_pos$end_pos-$start_pos);
                        
$this->files[$file_id] = str_replace(substr($this->files[$file_id], strpos(strtolower($this->files[$file_id]), '<loop name="'.$result_name.'">'),strlen('<loop name="'.$result_name.'">')), ''$this->files[$file_id]);
                        
$this->files[$file_id] = str_replace(substr($this->files[$file_id], strpos(strtolower($this->files[$file_id]), '</loop name="'.$result_name.'">'),strlen('</loop name="'.$result_name.'">')), ''$this->files[$file_id]);

                        if(
$loop_code != ''){
                                
$new_code '';
                                
$field_names = array();
                                for(
$i=0$i<mysql_num_fields($$result_name); $i++) $field_names[] = mysql_field_name($$result_name,$i);
                                while(
$row_data mysql_fetch_array($$result_nameMYSQL_ASSOC)){
                                        
$temp_code $loop_code;
                                        for(
$i=0$i<count($field_names); $i++){
                                                
$temp_code str_replace($this->start.$field_names[$i].$this->end$row_data[$field_names[$i]], $temp_code);
                                        }
                                        
$new_code.= $temp_code;
                                }
                                
$this->files[$file_id] = str_replace($loop_code$new_code$this->files[$file_id]);
                        }
                }

                function 
print_file($file_id){
                        if(
is_long(strpos($file_id',')) == TRUE){
                                
$file_id explode(','$file_id);
                                for(
reset($file_id); $current current($file_id); next($file_id)) echo $this->files[$current];
                        }else{
                                echo 
$this->files[$file_id];
                        }
                }

                function 
return_file($file_id){
                        
$ret '';
                        if(
is_long(strpos($file_id',')) == TRUE){
                                
$file_id explode(','$file_id);
                                for(
reset($file_id); $current current($file_id); next($file_id)) $ret .= $this->files[$current];
                        }else{
                                
$ret .= $this->files[$file_id];
                        }
                        return 
$ret;
                }

        } 
// End of class