I am using this page (insert.php) to insert data via a form into MYSQL:
<HTML>
<HEAD><TITLE>INSERT Data via PHP</TITLE></HEAD><BODY>
<?PHP
$connection=mysql_connect("localhost","username","userpass" or die('Could not connect to the database server');
$db = mysql_select_db("blah_blah", $connection) or die ("Unable to select database."
$sql = "insert into Dealers (UserID, DlrName, DlrAddress, DlrCity, DlrState, DlrZip, DlrPhone, DlrType, DlrEmail, DlrWeb, DlrPass, DlrAccess, DlrNumber, DlrDist) Values ('$AddID', '$AddName', '$AddAddress', '$AddCity', '$AddState', '$AddZip', '$AddPhone', '$AddType', '$AddEmail', '$AddWeb', '$AddPass', '$AddAccess', '$AddNumber', '$AddDist')";
$sql_result = mysql_query($sql,$connection) or die ('Could not insert data');
echo("<table border=\"0\" width=\"760\" height=\"300\" background=\"images/common/logoback.jpg\"> <tr><td align=\"center\" valign=\"middle\"><font face=\"verdana,arial\" size=\"3\"><b>User has been added to the database. </b></font><font face=\"verdana,arial\" size=\"2\"><br><br>Click <a href=\" to return to the Partner Area Home Page.</td></tr></table>"
?>
</BODY>
</HTML>
I want the link back to the Partner Area Home page to ... take me back to the home page, and retain the original user's access code to allow access. Here is the Partner Area Home Page PHP:
<?php
include("dbinfo.inc.php"
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database"
$sql = "SELECT *
FROM Dealers
WHERE UserID='$user' and DlrPass='$pass'";
$result = mysql_query($sql)
or die ("Unable to get results."
$num = mysql_numrows($result)
or die ("You're not authorized to be here. If you feel you have recieved this
message in error, please contact <a
href=\"mailto:custsvc@tanaka-ism.com\">Customer Service</a>"
$i=0;
while ($i < $num) {
session_register("UserID"
$UserID=mysql_result($result,$i,"UserID"
session_register("DlrName"
$DlrName=mysql_result($result,$i,"DlrName"
session_register("DlrAddress"
$DlrAddress=mysql_result($result,$i,"DlrAddress"
session_register("DlrCity"
$DlrCity=mysql_result($result,$i,"DlrCity"
session_register("DlrState"
$DlrState=mysql_result($result,$i,"DlrState"
session_register("DlrZip"
$DlrZip=mysql_result($result,$i,"DlrZip"
session_register("DlrPhone"
$DlrPhone=mysql_result($result,$i,"DlrPhone"
session_register("DlrType"
$DlrType=mysql_result($result,$i,"DlrType"
session_register("DlrEmail"
$DlrEmail=mysql_result($result,$i,"DlrEmail"
session_register("DlrWeb"
$DlrWeb=mysql_result($result,$i,"DlrWeb"
session_register("DlrPass"
$DlrPass=mysql_result($result,$i,"DlrPass"
session_register("DlrAccess"
$DlrAccess=mysql_result($result,$i,"DlrAccess"
session_register("DlrNumber"
$DlrNumber=mysql_result($result,$i,"DlrNumber"
session_register("DlrDist"
$DlrDist=mysql_result($result,$i,"DlrDist"
++$i;
}
$temp = $DlrAccess;
?>
Please Help!!!! I keep getting the 'You are not authorized to be here' error.
<HTML>
<HEAD><TITLE>INSERT Data via PHP</TITLE></HEAD><BODY>
<?PHP
$connection=mysql_connect("localhost","username","userpass" or die('Could not connect to the database server');
$db = mysql_select_db("blah_blah", $connection) or die ("Unable to select database."
$sql = "insert into Dealers (UserID, DlrName, DlrAddress, DlrCity, DlrState, DlrZip, DlrPhone, DlrType, DlrEmail, DlrWeb, DlrPass, DlrAccess, DlrNumber, DlrDist) Values ('$AddID', '$AddName', '$AddAddress', '$AddCity', '$AddState', '$AddZip', '$AddPhone', '$AddType', '$AddEmail', '$AddWeb', '$AddPass', '$AddAccess', '$AddNumber', '$AddDist')";
$sql_result = mysql_query($sql,$connection) or die ('Could not insert data');
echo("<table border=\"0\" width=\"760\" height=\"300\" background=\"images/common/logoback.jpg\"> <tr><td align=\"center\" valign=\"middle\"><font face=\"verdana,arial\" size=\"3\"><b>User has been added to the database. </b></font><font face=\"verdana,arial\" size=\"2\"><br><br>Click <a href=\" to return to the Partner Area Home Page.</td></tr></table>"
?>
</BODY>
</HTML>
I want the link back to the Partner Area Home page to ... take me back to the home page, and retain the original user's access code to allow access. Here is the Partner Area Home Page PHP:
<?php
include("dbinfo.inc.php"
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( "Unable to select database"
$sql = "SELECT *
FROM Dealers
WHERE UserID='$user' and DlrPass='$pass'";
$result = mysql_query($sql)
or die ("Unable to get results."
$num = mysql_numrows($result)
or die ("You're not authorized to be here. If you feel you have recieved this
message in error, please contact <a
href=\"mailto:custsvc@tanaka-ism.com\">Customer Service</a>"
$i=0;
while ($i < $num) {
session_register("UserID"
$UserID=mysql_result($result,$i,"UserID"
session_register("DlrName"
$DlrName=mysql_result($result,$i,"DlrName"
session_register("DlrAddress"
$DlrAddress=mysql_result($result,$i,"DlrAddress"
session_register("DlrCity"
$DlrCity=mysql_result($result,$i,"DlrCity"
session_register("DlrState"
$DlrState=mysql_result($result,$i,"DlrState"
session_register("DlrZip"
$DlrZip=mysql_result($result,$i,"DlrZip"
session_register("DlrPhone"
$DlrPhone=mysql_result($result,$i,"DlrPhone"
session_register("DlrType"
$DlrType=mysql_result($result,$i,"DlrType"
session_register("DlrEmail"
$DlrEmail=mysql_result($result,$i,"DlrEmail"
session_register("DlrWeb"
$DlrWeb=mysql_result($result,$i,"DlrWeb"
session_register("DlrPass"
$DlrPass=mysql_result($result,$i,"DlrPass"
session_register("DlrAccess"
$DlrAccess=mysql_result($result,$i,"DlrAccess"
session_register("DlrNumber"
$DlrNumber=mysql_result($result,$i,"DlrNumber"
session_register("DlrDist"
$DlrDist=mysql_result($result,$i,"DlrDist"
++$i;
}
$temp = $DlrAccess;
?>
Please Help!!!! I keep getting the 'You are not authorized to be here' error.