I have 1and1 hosting. I made some files last summer and haven't touched them until I started trying to figure out the error. About two weeks ago some parts of my site stopped working, for no known reason, I hadn't touched these files in about 10 months and all of a sudden I started getting errors. I called 1and1 and as with most customer service experiences, it sucked and wasted my time, hopefully you will be of help! Below is an example of what isn't working, it is used to submit a news article, pretty simple, straight forward script, but I'm clueless!
I removed the MySQL login details, but I assure you they are correct, I've tripled checked and even someone at 1and1 said that the information was correct. The error I get is...
Access denied for user: '***@%' to database '***'
That would imply that my login credentials are wrong, but they aren't.
PHP Code:
<?php
#database connection
mysql_connect("***", "***", "***") or die;
mysql_select_db("***") or die;
$subject = $_POST['subject'];
$body = $_POST['body'];
$publisher = $_POST['publisher'];
$url = $_POST['url'];
$date = $_POST['date'];
$numdate = $_POST['numdate'];
$date = date("l " . " F " . " jS, " . " Y");
function getdays($day1,$day2)
{
return round((strtotime($day2)-strtotime($day1))/(24*60*60),0);
}
$begin = "2000/1/1"; // we set today as an example
$end = date("Y/m/d");
$numdate = getdays($begin,$end);
$result = mysql_query("INSERT INTO news (subject,body,publisher,url,date,numdate) VALUES ('$subject', '$body', '$publisher', '$url', '$date', '$numdate')");
if(mysql_affected_rows() > 0)
{
echo("News sucessfully added");
}
else
{
echo(mysql_error());
exit();
}
echo ("<br>");
include "news_submit_form.html";
?>