Reason why include() or require() could fail?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
gladzooks
Forum Newbie
Posts: 2
Joined: Wed Sep 10, 2003 2:40 pm

Reason why include() or require() could fail?

Post by gladzooks »

I have a page that adds a task to a message board type thingamajig.
if all of the variables are passed correctly, it adds the message and sends an email to all people subscribed to that task. Probably 80% of the time everything works perfectly, the other 20% the MIME.class file required for the sending of the email messages fails to load.

error:
Warning: Failed opening 'MIME.class' for inclusion (include_path='') in /usr/www/users/tealab/fus/lib/mailsubscribers.php on line 21

Fatal error: Cannot instantiate non-existent class: mime_mail in /usr/www/users/tealab/fus/lib/mailsubscribers.php on line 82

What are the causes of this? I don't get it.

Thanks for any help.
User avatar
JayBird
Admin
Posts: 4524
Joined: Wed Aug 13, 2003 7:02 am
Location: York, UK
Contact:

Post by JayBird »

could you show us your code?

Thanks

Mark
gladzooks
Forum Newbie
Posts: 2
Joined: Wed Sep 10, 2003 2:40 pm

Post by gladzooks »

<?php
function mail_subscribers($task_id,$creator,$task_or_comment){
# Type="MYSQL"
# HTTP="true"
$query = "SELECT * FROM tasks WHERE id='{$task_id}'";
$results = mysql_query($query) or die(mysql_error());
$row_results = mysql_fetch_array($results);
mysql_close();
$addresses = $row_results['subscribers'];
//$subscribers = explode(" ", $row_results['subscribers']);
if(!empty($addresses)){
require("MIME.class");
$sendere= "fus@tealab.com";
$to = $addresses;
if($task_or_comment == 0){
$str = "A new task has been added to the Fox Update System by " . $creator;
$internal_comment = "A new task has been added to FUS entitled: ";
} else {
$str = "A comment has been added to the Fox Update System by " . $creator;
$internal_comment = "A comment has been added to: ";
}
$html_data = '<html><style type="text/css">
<!--
body {
background-color: #EBEBEB;

}
.text {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}

td {
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
color: #000000;
}

A:link {
COLOR: ##FF6600; TEXT-DECORATION: none
}
A:visited {
COLOR: #cccccc; TEXT-DECORATION: none
}
A:hover {
COLOR: #CCFF33; TEXT-DECORATION: none
}
A:active {
COLOR: #000000; TEXT-DECORATION: none
}

TABLE, TH, TR, TD, BLOCKQUOTE, DIV, SPAN, DD, U, UL, DL, H4, H5, INPUT, A, BR, CENTER, I, B, LI, OL, TEXTAREA, FORM, P, SELECT, STRONG { font-family: Arial, Helvetica, sans-serif; font-size: 12px; color: #000000; background-color: #FFFFFF; }
-->
</style><title>'.$str.'</title>
</head>
<link href="styles.css" rel="stylesheet" type="text/css">
<body bgcolor="#ffffff">
<table width="600" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td align="center">
<table width="600" align="center" valign="middle" cellpadding="10" cellspacing="0" border="0"<tr><td>
'.$internal_comment.'<br><a href="http://www.tealab.com/fus/content_viewt ... ow_results['title'].'</a><br><br>
</td></tr>
</table>
</td>
</tr>
</table>
</body>
</html>';
$mime = new MIME_mail($sendere, $to, $str);
$mime->attach($html_data, "", HTML, BASE64);
$mime->send_mail();
?>
<link href="styles.css" rel="stylesheet" type="text/css">
<body bgcolor=#FFFFFF background="images/bg.jpg" leftmargin=0 topmargin=0 marginwidth=0 marginheight=0>
<table width="600" border="0" align="center" cellpadding="6" cellspacing="0" class="listtable">
<tr>
<td>All subscribers have been notified.</td>
</tr>
</table>
<?php } else { ?>
<table width="600" border="0" align="center" cellpadding="6" cellspacing="0" class="listtable">
<tr>
<td> There was an error notifying subscribers. You may want to add a comment to notify them of any changes. Sorry for the inconvenience </td>
</tr>
</table>
<?php }
}
?>
Unipus
Forum Contributor
Posts: 409
Joined: Tue Aug 26, 2003 2:06 pm
Location: Los Angeles, CA

Post by Unipus »

You need to include the file with the class AND instantiate the class:

Code: Select all

$blah = new MIME.class;
Post Reply