if it didnt work , ill have to try the script myself that way will be easy to fix
you can link me the script in pm if its private
This is a discussion on MySQL // .php help :S within the Tech Support forums, part of the Knight Online (ko4life.com) category; if it didnt work , ill have to try the script myself that way will be easy to fix
you ...
Page: 2
if it didnt work , ill have to try the script myself that way will be easy to fix
you can link me the script in pm if its private
Should work, haven't coded PHP in years. Also, please don't use public scripts, they're easily bypassed. Notice how I called Mysql_Real_Escape_String for the username? This is because the script in its current state (had it worked) would have been SQL Injectible. Give me a PM if this doesn't work or if you have any other needs.[/b]Code:<?php //Database Information $dbhost = "EDITED OUT"; $dbname = "EDITED OUT"; $dbuser = "EDITED OUT"; $dbpass = "EDITED OUT"; //Connect to database mysql_connect( $dbhost, $dbuser, $dbpass) or die("Could not connect: ".mysql_error()); mysql_select_db($dbname) or die(mysql_error()); session_start(); $username = mysql_real_escape_string(addslashes($_POST['username'])); $password = md5($_POST['password']); $query = "select * from users where username='$username' and password='$password'"; $result = mysql_query($query); if (mysql_num_rows($result) != 1) { $error = "Bad Login"; ****include("login.html"); } else { ****$_SESSION['username'] = "$username"; ****include("memberspage.php"); } ?>
wow thanks man this one worked now you wouldn't happen to know how i can protect pages on my website so that you have to be logged in to view that page?
nvm, this did nothing :S now any id and psw you enter workswow thanks man this one worked now you wouldn't happen to know how i can protect pages on my website so that you have to be logged in to view that page?[/b]
EDIT: figured out problem, fixed now
PM me if there are any other questions.
pm'ed ^.^PM me if there are any other questions.[/b]
Bookmarks