I'm trying to run a php file and I get two warnings, which I can't seem to place. The warnings:
PHP Warning: Directive 'safe_mode' is deprecated in PHP 5.3 and greater in Unknown on line 0
PHP Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /etc/baseconetrial2.php on line 19
The code:
<?php
//connectie database
mysql_connect('localhost','heregoestheusername','heregoesthepass');
@mysql_select_db('admin_subscriptions') or die( "Unable to select database");
$type = "proefabonnement";
$checksql = "SELECT * FROM subscriptions where (type_abonnement = '$type' AND DATE(timestamp) = DATE_SUB( CURDATE( ) , INTERVAL 26))";
$checkresult = mysql_query($checksql);
while ($check = mysql_fetch_array($checkresult)) {
$mail_ontv = "[email protected]";
$_POST['onderwerp'] = "Verlopen Trial Account";
// set datum
$datum = date("d.m.Y H:i");
// set ip
$ip = $_SERVER['REMOTE_ADDR'];
$inhoud_mail .= $_SERVER['SCRIPT_URI'] . "\n\n";
$inhoud_mail .= "Binnenkort verloopt er een trail account!\n\n\n";
$inhoud_mail .= "Bedrijfsnaam: " . $check['bedrijfsnaam'] . "\n\n";
$inhoud_mail .= "Telefoonnummer: " . $check['telefoonnummer'] . "\n\n";
$inhoud_mail .= "E-mail adres: " . $check['email'] . "\n\n";
$inhoud_mail .= "Telefoonnummer contactpersoon: " . $check['telefoonnummercontact'] . "\n\n";
$inhoud_mail .= "E-mail adres contactpersoon: " . $check['emailcontact'] . "\n\n";
$inhoud_mail .= "Hieronder de link voor de klant:\n\n\n";
$inhoud_mail .= "http://www.basecone.nl/upgrade1?key=".$check['unique']."\n\n";
$inhoud_mail .= "Verstuurd op " . $datum . " via het ip " . $ip . "\n\n";
$headers = "From: BaseconeWizard < [email protected] >";
$headers = stripslashes($headers);
$headers = str_replace("\n", "", $headers); // Verwijder \n
$headers = str_replace("\r", "", $headers); // Verwijder \r
$headers = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $headers)); // Slashes van quotes
$_POST['onderwerp'] = str_replace("\n", "", $_POST['onderwerp']); // Verwijder \n
$_POST['onderwerp'] = str_replace("\r", "", $_POST['onderwerp']); // Verwijder \r
$_POST['onderwerp'] = str_replace("\"", "\\\"", str_replace("\\", "\\\\", $_POST['onderwerp'])); // Slashes van quotes
mail($mail_ontv, $_POST['onderwerp'], $inhoud_mail, $headers);
}
?>
Thanks guys!
mysql_*functions in new code. They are no longer maintained and are officially deprecated. See the red box? Learn about prepared statements instead, and use PDO or MySQLi - this article will help you decide which. If you choose PDO, here is a good tutorial.