Jump to content

Search the Community

Showing results for tags 'oops'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (Dreamweaver, Zend, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 2 results

  1. Hi Guys, I just write the code in php but mail function is not working rest everything is working fine.. i tried other script but that also not working.. Than i came to know that my hosting server only use SMTP.. So i need help to do that.. Code Below <?php class patient_mail { function mail_send($c) { global $db; $db->fun_db(); global $img_obj; $img=array(); $time=time(); $to = 'team@concepteurs.co.in'; $fromEmail = $_REQUEST['email']; $fromName = $_REQUEST['comment_name']; $subject = $_REQUEST['contactno']; $message = $_REQUEST['comment']; $message1 = $_REQUEST['comment']; //$message.="You have receive An request from $c Page From the user/Patient $fromName"; //var_dump($_FILES); $headers = "From: $fromName"; /* GET File Variables */ if($_FILES['report']['name'][0]!=''){ foreach( $_FILES['report']['name']as $k=>$value) { $time++; $tmpName = $_FILES['report']['tmp_name'][$k]; $fileType = $_FILES['report']['type'][$k]; /* Start of headers */ $filename = stripslashes($_FILES['report']['name'][$k]); $ext = explode(".",$value); $extension = strtolower(end($ext)); $tempname = $_FILES['report']['tmp_name'][$k]; $userimg = "mail_".$time.".".$extension; $folder = "../images/mail/"; $img[]=$userimg; $newwidth = ""; $newheight = "154"; if($ext!='exe'){ move_uploaded_file($tempname,$folder.$userimg); } if (file($tmpName)) { /* Reading file ('rb' = read binary) */ $file = fopen($tmpName,'rb'); $data = fread($file,filesize($tmpName)); fclose($file); } $randomVal = md5(time()); $mimeBoundary = "==Multipart_Boundary_x{$randomVal}x"; /* Header for File Attachment */ $headers .= "\nMIME-Version: 1.0\n"; $headers .= "Content-Type: multipart/mixed;\n" ; $headers .= " boundary=\"{$mimeBoundary}\""; /* Multipart Boundary above message */ $message = "This is a multi-part message in MIME format.\n\n" . "--{$mimeBoundary}\n" . "Content-Type: text/plain; charset=\"iso-8859-1\"\n" . "Content-Transfer-Encoding: 7bit\n\n" . $message . "\n\n"; /* Encoding file data */ $data = chunk_split(base64_encode($data)); /* Adding attchment-file to message*/ $message .= "--{$mimeBoundary}\n" . "Content-Type: {$fileType};\n" . " name=\"{$value}\"\n" . "Content-Transfer-Encoding: base64\n\n" . $data . "\n\n" . "--{$mimeBoundary}--\n"; } $userimg=implode(',',$img); } $sql="insert into treatment_mail(comment_name,email,contactno,message,page_id,report1,mail_date)values('".$fromName."','".$fromEmail."','".$subject."','".$message1."','".$c."','".$userimg."','".time()."')"; mysql_query($sql); $flgchk = mail ("$to", "$subject", "$message", "$headers"); /* this code is not working*/ if($flgchk){ echo $msg="A email has been sent to: $to"; } else{ echo $msg= "Error in Email sending"; } return $msg; } } $obj_mail=new patient_mail(); ?>
  2. Q: Should instancing an object be held off until needed - or - instanced early and held in memory until (it may/or may not) be called? Here is an example of the type situation where an custom error reporting class is instanced only when some test has failed. The error reporting is for authorized users running an application from protected sub sections(RESTish solution). /* * check form input and $_FILES upload * if test fails, instance errorwrapper::factory object and call errorReport method * testfilesize function, compares file size limit, set pass1 to true on success * testfiletype function, compares file to allowed MIME types, set pass2 to true on success * svalidate returns array $filteres, sanitized input on success, error message(s) on fail * param boolean $pass[1,2], set initial test condition * param int MAX_FILE_SIZE, constant defines max file size allowed. */ $pass1 = false; $pass2 = false; if(isset($_FILES)) { $ftype = $_FILES['img_file']['type']; $fsize = $_FILES['img_file']['size']; testfilesize($pass1,MAX_FILE_SIZE,$fsize); testfiletype($pass2,$ftype); } if($pass1 == false) { $erparams=array('cat'=>3,'src'=>"addform_control",'ref'=>"addform",'fault'=>"over file size limit"); $errObj=errorwrapper::factory($erparams); $errObj->errorReport(); exit(); } elseif ($pass2 == false) { $erparams=array('cat'=>3,'src'=>"addform_control",'ref'=>"addform",'fault'=>"illegal file type"); $errObj=errorwrapper::factory($erparams); $errObj->errorReport(); exit(); } /* * process form input, all fields checked before returning filteres * could report multiple errors, mode sets level of sanitization. */ $filteres = svalidate($_POST,$mode=1); if($filteres['exit']==1) { foreach($filteres['err'] as $err) { $mes .= $err."\n"; } $erparams=array('cat'=>2,'src'=>"addfo",'ref'=>"list_viewer",'fault'=>$mes); $errObj=errorwrapper::factory($erparams); $errObj->errorReport(); exit(); } else { //continue processing here, error checking over } In this case, the object $errObj is only instanced on a failed condition. However, $errObj could be instantiated before the conditional test and only calls the method when there is a failed condition. It seems like "six to one half dozen" but these applications are large and complex, so I'm looking to squeeze out any worthwhile optimization. Thanks for considering the question.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.