Well - what I meant was I changed the location to the absolute path of the common.php. Anyway - it didn't work anyhow, so...
As I wrote before - I tried to copy the entire function (which was in common.php) into the PHP-file and it seemed that the error message disappeared - yet I don't get any real output out of it (as in no mail). I'll try pasting the code for you - then maybe it might be a bit easier to figure out the problem.
Example from PHP.net - a bit modified
if ($argc != 2 || in_array($argv[1], array('--help', '-help', '-h', '-?'))) {
?>
This is a command line PHP script with one option.
Usage:
<?php echo $argv[0]; ?> <option>
<option> can be some word you would like
to print out. With the --help, -help, -h,
or -? options, you can get this help.
<?php
} else {
$file = $argv[1];
}
The above outputs the variable I set when I for example use the following execution in the command line:
C:\PHP>php.exe c:\mail.php 2345.txt-123
meaning the variable "2345.txt-123"
This is the variable I want my PHP to split up in 2 so I have 2 variables in my PHP. One with 2345.txt and one with 123. My PHP-file should then go through various scripts to determine if a mail should be sent out or not (meaning it should connect to a database - check to see if the variables already have been inserted in the database - and then send a mail if it isn't. Also - if it isn't in the database, it should be inserted, while sending the mail - that way the same variables can't be inserted nor e-mailed twice. Below I have written the code I use to determine whether the variables should be e-mailed or not.
$pieces = explode("-", $file);
$mode = $pieces[2];
$filename = $pieces[1];
$filesize = $pieces[0];
if($filesize != "0")
{
$query = "select * from files where filename = '$filename'";
$result = mysql_query($query) or die("".mysql_errno()." Error: ".mysql_error());
if (mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_array($result))
{
header("Location: mail2.php"); // This closes the browser without doing anything
exit;
}
}
else
{
$query2 = "insert into files values ('', '$filename', '$filesize')";
$result2 = mysql_query($query2) or die("".mysql_errno()." Error: ".mysql_error());
$query3 = "select * from files order by fileID desc limit 1";
$result3 = mysql_query($query3) or die("".mysql_errno()." Error: ".mysql_error());
if (mysql_num_rows($result3) > 0)
{
while($row = mysql_fetch_array($result3))
{
$filename = $row['filename'];
$filesize = $row['filesize'];
if($filename != "." && $filename != "..")
{
$to = " (e-mail addresses) "; // The person the e-mail is sent to
$subject = " (subject line) "; // E-mail subject
$from = "Content-type: text/html\r\n";
$from .= "From: (Company) "; // Name and e-mail of the sender
// The e-mail message
$message = "<html><script language=\"JavaScript\" src=\"http://www.mywebsite.com/javascript.js\"></script><link rel=\"stylesheet\" href=\"http://www.mywebsite.com/style.css\" type=\"text/css\"><body>\r\n";
$message .= "<span class=\"headline\">Headline</span>\r\n";
$message .= "<br><br><b>There is a new file uploaded for you!</b>\r\n";
$message .= "<br><br>It is called <b>$filename</b> and the filesize is <b>$filesize</b> bytes\r\n";
$message .= "</body></html>\r\n";
mail($to, $subject, $message, $from);
header("Location: mail2.php"); // This closes the browser without doing anything
exit;
}
else
{
header("Location: mail2.php"); // This closes the browser without doing anything
exit;
}
}
}
}
}
I can imagine the script should probably be modified somewhat but I don't know exactly in which way it should be modified in order to work
/// NetRoam