Forum Moderators: coopster
I believe the problem is going to be the end of the script where it starts the email process and not the actual scan process. Any help would be grateful.
$result = mysql_query("SELECT urls,emails FROM sites");
while ($row = mysql_fetch_array($result)) {
$link=$row['url'];
$email=$row['email'];
//check for port number, default is 80
$s_link = str_replace("::", ":", $link);
}
list($addr,$port)= explode (':',"$s_link");
if (empty($port)){
$port = 80;
}
//Test the server connection
$churl = @fsockopen(server($addr), $port, $errno, $errstr, 20);
if (!$churl){
//echo $errstr;
header("Location: $dead");
}
else {
header("Location: $live");
}
function server($addr){
if(strstr($addr,"/")){$addr = substr($addr, 0, strpos($addr, "/"));}
return $addr;
}
$to = $email;
$from ="Site Monitor";
$subject = "$link Is Down";
$body = "MY Message";
if ($errstr)
mail($to, $subject, $body)
while ($row = mysql_fetch_array($result)) {
$link=$row['url'];
$email=$row['email'];
//check for port number, default is 80
$s_link = str_replace("::", ":", $link);
}
This just runs through the results and replaces $email and $link each time. In other words you aren't saving anything but the last row.
<?php
include 'includes/opendb.php';
$result = mysql_query("SELECT * FROM sites");
while ($row = mysql_fetch_array($result)) {$link=$row["url"];
$email=$row["email"];
$port="80";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
//Test the server connection
$churl = fsockopen($link,$port,$errno,$errstr, 20);
} if (!$churl){
$to = $email;
$from ="Site Monitor";
$subject = "$link Is Down";
$body = "My Message";
mail($to, $subject, $body);
}
else
die ()
?>
$link=$row["url"];
$email=$row["email"];
$port="80";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
//Test the server connection
$churl = fsockopen($link,$port,$errno,$errstr, 20);
} <--you closed out the loop right here if (!$churl){
Cheers
<?php
include 'includes/opendb.php';
$result = mysql_query("SELECT * FROM sites");
while ($row = mysql_fetch_array($result)) {
$link=$row["url"];
$email=$row["email"];
$port="80";
$s_link = str_replace("::", ":", $link);
list($addr,$port)= explode (':',"$s_link");
//Test the server connection
$churl = fsockopen($link,$port,$errno,$errstr, 20);
if (!$churl)
$to = $email;
$from ="Site Monitor";
$subject = "$link Is Down";
$body = "My Message";
mail($to, $subject, $body);
}
?>