So I have moved to a new host (from a free host) to Crazy Domains, and everything seemed fine, but some of the codes seem to be playing up.
Did some research, it appears to be the fetch arrays. Now, I'm lost for a solution.
The entire website was working before moving to Crazydomain hosting.
Here is an error message:
"Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/lgbtrada/public_html/login.php on line 11"
Code for it:
<?
session_start();
include("config.php");
include("clean.php");
$login = clean($_GET[login]);
if(isset($_SESSION[usr_name]) && isset($_SESSION[usr_level]) && $login!=logout)
echo('<meta http-equiv="refresh" content="0;url=main.php" />');
else {
$ip = $_SERVER['REMOTE_ADDR'];
$sqlcontent = mysql_query("select * from usr_config");
$content = mysql_fetch_array($sqlcontent);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css.css" type="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Usersystem • <? echo("$content[site]");?></title>
</head>
<body>
<div align="center">
<p> </p>
<table width="50%" border="1">
<tr>
<td><div align="center"><? echo("$content[site]");?> UserSystem </div></td>
</tr>
<tr>
<td>
<? if($login!=login){ ?>
<div align="center"><form method="post" action="admin.php?login=login">
Your Username:<br />
<input type="text" name="username" />
<br />
<br />
Password:<br />
<input type="password" name="password" />
<br />
<br />
<input type="hidden" name="ip" value="<? echo("$ip");?>" />
<input type="submit" value="Login" />
<? if($content[pwd]==1){ ?><br /><a href="lostpw.php">Forgot Password?</a> <? } ?><br />
<a href="register.php">Register</a></form></div>
<? }
elseif($login==login)
{
$username = clean($_POST[username]);
$password = md5($_POST[password]);
$date = date("Y-m-d");
$time = date("H:i:s");
$sql = mysql_query("select * from usr_users where username = '$username' AND password = '$password'");
$check = mysql_num_rows($sql);
if($check!=1)
{
echo("Invalid Username or Password!");
echo('<meta http-equiv="refresh" content="1;url=admin.php" />');
$success = "Failed";
if($content[loginlog]==1)
$sqllog = mysql_query("insert into usr_logs(user, ip, time, date, success) values('$username', '$ip', '$time', '$date', '$success')");
}
else
{
$user = mysql_fetch_array($sql);
$_SESSION[usr_name] = $user[username];
$_SESSION[usr_level] = $user[level];
$_SESSION[usr_ip] = $ip;
$success = "Success";
echo("Logged in as $username, Now redirecting..");
echo('<meta http-equiv="refresh" content="1;url=main.php" />');
if($content[loginlog]==1)
$sqllog = mysql_query("insert into usr_logs(user, ip, time, date, success) values('$username', '$ip', '$time', '$date', '$success')");
}
}
if($login==logout)
{
session_unset();
session_destroy();
echo("You are now logged out!");
}
?></td>
</tr>
<tr>
<td><? if($content[loginlog]==1){ ?>Logged: Your IP: <? echo("<b>$ip</b>");?><? } else echo("Your IP was NOT logged");?></td>
</tr>
</table>
<? } ?>
</div>
</body>
</html>
And with our news system, it returns this; "'; echo stripslashes( $myrow['title'] ); echo ''; echo ' '; echo stripslashes( $myrow['text1'] ); echo '
'; echo " "; echo ''; echo ' '.$myrow["reporter"].' | '.$myrow["dtime"].' | Comment | '.$myrow["views"].' view(s) '; }//end of loop ?>"
News display code:
<?php
// load the configuration file.
include("config.php");
//load all news from the database and then OREDER them by newsid
//you will notice that newlly added news will appeare first.
//also you can OREDER by (dtime) instaed of (news id)
$result = mysql_query("SELECT * FROM news ORDER BY newsid DESC LIMIT 7",$connect);
//lets make a loop and get all news from the database
while($myrow = mysql_fetch_assoc($result))
{//begin of loop
//now print the results:
echo '<h2>';
echo stripslashes( $myrow['title'] );
echo '</h2>';
echo '<p>';
echo stripslashes( $myrow['text1'] );
echo '</p>';
echo "<br />";
echo '<a href="https://twitter.com/share" class="twitter-share-button" ata-url="http://www.mylasuni.com/read_more.php?id='.$myrow["newsid"].'" data-text="'.$myrow["title"].'" data-via="mylasuni" data-related="mylasuni">Tweet</a>';
echo '<hr>
<span style="float:right;"><strong><a href="profile.php?user='.$myrow["reporter"].'">'.$myrow["reporter"].'</a></strong> | '.$myrow["dtime"].' | <a href="read_more.php?id='.$myrow["newsid"].'">Comment</a> | '.$myrow["views"].' view(s)</span><br><hr>';
}//end of loop
?>
Looked at the boolean argument and some tuts, any other article that can help me you know? Please help me resolve this! This site is for a good cause.