Jump to content

0riole

Members
  • Posts

    6
  • Joined

  • Last visited

    Never

About 0riole

  • Birthday 06/19/1972

Contact Methods

  • Website URL
    http://

Profile Information

  • Gender
    Not Telling
  • Location
    Australia

0riole's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi, I'm useing the following script to force users to authenticate by including the below script, and I keep getting erors in line 9, but I don't see any, may be just lack of experence login.php <?include"vars.php";?> <?php function authenticate() { Header("WWW-Authenticate: Basic realm=\"secure login\""); echo "Authentication Failed!"; exit(); } if(!isset($PHP_AUTH_USER)) {h authenticate(); echo "Authorization Failed\n"; exit; } else { $checkLogin = "SELECT ID FROM $userTable WHERE $userField='$PHP_AUTH_USER' AND $passField='$PHP_AUTH_PW'"; $db = mysql_pconnect($dbHost, $dbUser, $dbPass); mysql_select_db($dbName, $db); $result = mysql_query($checkLogin, $db); $numrows = mysql_num_rows($result); $myrow = mysql_fetch_array($result); if ($numrows == 0) { authenticate(); } else { setcookie("UserID", $myrow["ID"]); $UserID = $myrow["ID"]; } } ?> And here is my vars.php <? $dbHost = "localhost"; $dbUser = "AdminUser"; $dbPass = "Password"; $dbName = "dbname"; $userTable = "Users"; $userField = "Username"; $passField = "Password"; ?> Thanks in advance, Chris
  2. Thanks, All happy now
  3. <? $usr = "username"; $pwd = "password"; $db = "database"; $host = "localhost"; //Setup Veribales $id = $_GET['id']; $task = $_GET['task']; $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } if ($task=="del") { $sql = "DELETE FROM venues WHERE id = '$id' name='$name'"; mysql_db_query($db, $sql, $cid); } ?> <HTML> <HEAD> <TITLE>Manage Links</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" > <H1>Edit Links</H1> <? $sql = " SELECT * FROM venues "; $retid = mysql_db_query($db, $sql, $cid); if (!$retid) { echo( mysql_error()); } else { echo ("<P><TABLE CELLPADDING=4>\n"); while ($row = mysql_fetch_array($retid)) { $name = $row['name']; $id = $row['id']; echo ("<TR>"); echo ("<TD>$name</TD>\n"); echo ("<TD><A HREF=\"manage_edit.php?id=$id\">Edit</A></TD>"); echo ("<TD><A HREF=\"manage.php?id=$id&task=del\">Delete</A></TD>"); echo ("</TR>"); } echo ("</TABLE>"); } ?> </BODY> </HTML>
  4. OK Done all that and still no joy, what else could be going wrong?
  5. Tried that, also suggested by a user on an Australian forum, but still no good also had suggested putting in the id and name in that querry, but not shure how to go about this
  6. The script below, should from my BASIC knowledge, retrieve the records stored in the table "venues" display the value "name" along with a link to modify the record on a separate page (manage_edit.php) or delete the record and reload this page (manage.php). The problem is that it dose not delete just reloads. Where have I gone wrong? Thanks, Chris ----------------------------------------------------------------- <? $usr = "--username--"; $pwd = "--password--"; $db = "--MySQL_Database--"; $host = "localhost"; //Setup Veribales $id = $_POST['id']; $name = $_POST['name']; $cid = mysql_connect($host,$usr,$pwd); if (!$cid) { echo("ERROR: " . mysql_error() . "\n"); } if ($task=="del") { $sql = "DELETE FROM venues WHERE id = '$id'"; mysql_db_query($db, $sql, $cid); } ?> <HTML> <HEAD> <TITLE>Manage Links</TITLE> </HEAD> <BODY BGCOLOR="#FFFFFF" > <H1>Edit Links</H1> <? $sql = " SELECT * FROM venues "; $retid = mysql_db_query($db, $sql, $cid); if (!$retid) { echo( mysql_error()); } else { echo ("<P><TABLE CELLPADDING=4>\n"); while ($row = mysql_fetch_array($retid)) { $name = $row['name']; $id = $row['id']; echo ("<TR>"); echo ("<TD>$name</TD>\n"); echo ("<TD><A HREF=\"manage_edit.php?id=$id \">Edit</A></TD>"); echo ("<TD><A HREF=\"manage.php?id=$id&task=del \">Delete</A></TD>"); echo ("</TR>"); } echo ("</TABLE>"); } ?> </BODY> </HTML>
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.