How to insert a defined php user_id variable within a Dreamweaver login
insert
pSo, I built a chat box in php, and now I am trying to build a login form
for that chat application. Right now, in the index page of the chat, I
have a session set up that changes the username, based on their user_id
(it's not secure for right now - i'm just learning). However, for the life
of me, I cannot define that $user_id variable in the Dreamweaver
template./p precodelt;?php require_once('godaddysql.php'); ?gt; lt;?php if
(!function_exists(GetSQLValueString)) { function
GetSQLValueString($theValue, $theType, $theDefinedValue = ,
$theNotDefinedValue = ) { if (PHP_VERSION lt; 6) { $theValue =
get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; } $theValue
= function_exists(mysql_real_escape_string) ?
mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) { case text: $theValue = ($theValue != ) ? ' . $theValue
. ' : NULL; break; case long: case int: $theValue = ($theValue != ) ?
intval($theValue) : NULL; break; case double: $theValue = ($theValue != )
? doubleval($theValue) : NULL; break; case date: $theValue = ($theValue !=
) ? ' . $theValue . ' : NULL; break; case defined: $theValue = ($theValue
!= ) ? $theDefinedValue : $theNotDefinedValue; break; } return $theValue;
} } ?gt; lt;?php // *** Validate request to login to this site. if
(!isset($_SESSION)) { session_start(); } $loginFormAction =
$_SERVER['PHP_SELF']; if (isset($_GET['accesscheck'])) {
$_SESSION['PrevUrl'] = $_GET['accesscheck']; } if
(isset($_POST['username'])) { $loginUsername = $_POST['username'];
$password = $_POST['password']; $MM_fldUserAuthorization = ;
$MM_redirectLoginSuccess = index.php?user=; $MM_redirectLoginFailed =
login.php; $MM_redirecttoReferrer = false;
mysql_select_db($database_godaddysql, $godaddysql); $LoginRS__query =
sprintf(SELECT username, password FROM users WHERE username=%s AND
password=%s, GetSQLValueString($loginUsername, text),
GetSQLValueString($password, text)); $LoginRS =
mysql_query($LoginRS__query, $godaddysql) or die(mysql_error());
$loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) {
$loginStrGroup = ; if (PHP_VERSION gt;= 5.1) {
session_regenerate_id(true); } else { session_regenerate_id(); } //declare
two session variables and assign them $_SESSION['MM_Username'] =
$loginUsername; $_SESSION['MM_UserGroup'] = $loginStrGroup; if
(isset($_SESSION['PrevUrl']) amp;amp; false) { $MM_redirectLoginSuccess =
$_SESSION['PrevUrl']; } header(Location: . $MM_redirectLoginSuccess); }
else { header(Location: . $MM_redirectLoginFailed); } } ?gt; /code/pre pI
tried inserting user_id into the loginusername and password field, it
never worked./p pHere is the connecting page:/p precodelt;?php #
FileName=Connection_php_mysql.htm # Type=MYSQL # HTTP=true
$hostname_godaddysql = localhost; $database_godaddysql = Site;
$username_godaddysql = root; $password_godaddysql = ; $godaddysql =
mysql_pconnect($hostname_godaddysql, $username_godaddysql,
$password_godaddysql) or trigger_error(mysql_error(),E_USER_ERROR); ?gt;
/code/pre
No comments:
Post a Comment