Hi,
I am fairly new to programming. I had my website designed and have been updating/modifying in Dreamweaver for about a year. The site was designed so that I could also login to a permissions page (CHMOD) that allows to change/add certain information. Recently my web hosting was bought out and since the switch this login page keeps giving me an error for lines 23 &24 of my code..which are:
$rs = mysql_query($sql, $conn);
$num_rows = mysql_num_rows($rs);
From what I have found this isn't uncommon, but I have yet to find a solution for it. I checked the code in the file manager with the original file and they are identical. Does anyone have any experience with this?
Thanks so much!!
J
Here is the index.php file (aka permissions page):
<?php
####################
#connect to server and select database
#For local hosting
#$conn = mysql_connect("localhost") or die("There is a problem with the MySQL Server connection string.");
#$rs = mysql_select_db("tymoneal", $conn) or die("There is a problem with the database selection string.");
#for tymoneal.com
$conn = mysql_connect("","","") or header("Location: ../error.html");
$rs = mysql_select_db("", $conn) or header("Location: ../error.html");
$msgError = "";
$username = $POST["requiredusername"];
$pass = $POST["requiredpassword"];
#check to see if username and pass have been submitted database
if (is_null($username) and is_null($pass)) {
#if null, do nothing
} else {
#username and pass have been submitted, query to see if db records match
$sql = "SELECT * FROM login WHERE username = \"$username\" AND password = \"$pass\"";
$rs = mysql_query($sql, $conn);
$num_rows = mysql_num_rows($rs);
#if there is a match, redirect user to webadmin homepage
if ($num_rows != 0){
header("Location: pages/index.php");
} else {
#else print error message
$msgError = "Either your username or password is invalid.<br> Please try to login again.";
}
}
?>
<html>
<head>
<title>Tymoneal.com - Admin LOGIN</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- STYLE SHEET -->
<link href="../tymonealCSS.css" rel="stylesheet" type="text/css">
<!-- JAVASCRIPT -->
<script type="text/javascript" language="JavaScript" src="validate.js"></script>
</head>
<body>
<!-- PAGE TITLE -->
<h2>Tymoneal.com <span class="title">Admin LOGIN</span></h2>
<table border="0" cellspacing="10" cellpadding="0">
<tr>
<td class="error"><?= $msgError ?></td>
</tr>
<tr>
<td>
<form name="login" method="post" action="index.php" onSubmit="return CheckForm(this)">
<table border="0" cellspacing="5" class="body" id="textContentTable">
<tr><td>name: </td> <td><input type="text" name="requiredusername"></td></tr>
<tr><td>pass: </td> <td><input type="password" name="requiredpassword"></td></tr>
<tr><td colspan="2" align="right"> <input type="submit" value=" LOG IN " class="button"></td></tr>
</table>
</form>
</td>
</tr>
</table>
<br><br
</body>
</html>