<? ben >? Posted October 3, 2004 Share Posted October 3, 2004 hi i have ths code <?php // *** Validate request to login to this site. session_start(); $loginFormAction = $_SERVER['PHP_SELF']; if (isset($accesscheck)) { $GLOBALS['PrevUrl'] = $accesscheck; session_register('PrevUrl'); } if (isset($_POST['username'])) { $loginUsername=$_POST['username']; $password=$_POST['password']; $MM_fldUserAuthorization = ""; $MM_redirectLoginSuccess = "login.php"; $MM_redirectLoginFailed = "index.php"; $MM_redirecttoReferrer = true; mysql_select_db($database_localhost, $localhost); $LoginRS__query=sprintf("SELECT username, password FROM logon WHERE username='%s' AND password='%s'", get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password)); $LoginRS = mysql_query($LoginRS__query, $localhost) or die(mysql_error()); $loginFoundUser = mysql_num_rows($LoginRS); if ($loginFoundUser) { $loginStrGroup = ""; //declare two session variables and assign them $GLOBALS['MM_Username'] = $loginUsername; $GLOBALS['MM_UserGroup'] = $loginStrGroup; //register the session variables session_register("MM_Username"); session_register("MM_UserGroup"); if (isset($_SESSION['PrevUrl']) && true) { $MM_redirectLoginSuccess = $_SESSION['PrevUrl']; } header("Location: " . $MM_redirectLoginSuccess ); } else { header("Location: ". $MM_redirectLoginFailed ); } } ?> on the index.php and i have a update.php BUT how do i get the username varibal to carry on on the next page <?php function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") { $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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; } $editFormAction = $_SERVER['PHP_SELF']; if (isset($_SERVER['QUERY_STRING'])) { $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']); } if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "form2")) { $updateSQL = sprintf("UPDATE logon SET password=%s, age=%s, email=%s, name=%s, advtar=%s, a=%s WHERE username=%s", GetSQLValueString($_POST['password'], "text"), GetSQLValueString($_POST['age'], "text"), GetSQLValueString($_POST['email'], "text"), GetSQLValueString($_POST['name'], "text"), GetSQLValueString($_POST['advtar'], "text"), GetSQLValueString($_POST['a'], "text"), GetSQLValueString($_POST['username'], "text")); mysql_select_db($database_localhost, $localhost); $Result1 = mysql_query($updateSQL, $localhost) or die(mysql_error()); $updateGoTo = "login.php"; if (isset($_SERVER['QUERY_STRING'])) { $updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?"; $updateGoTo .= $_SERVER['QUERY_STRING']; } header(sprintf("Location: %s", $updateGoTo)); } $colname_Recordset1 = "1"; if (isset($_GET['WHAT DO I PUT HERE'])) { $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['WHAT DO I PUT HERE'] : addslashes($_GET['WHAT DO I PUT HERE']); } mysql_select_db($database_localhost, $localhost); $query_Recordset1 = sprintf("SELECT * FROM logon WHERE username = '%s'", $colname_Recordset1); $Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); ?> thats my update Bit but were do i get my verabals to account for the username thanks a lot 4 ur help Quote Link to comment https://forums.phpfreaks.com/topic/1979-login-help/ Share on other sites More sharing options...
toplay Posted October 3, 2004 Share Posted October 3, 2004 It's against forum guidelines to post the same or similar items more than once in these forums. So, I've closed your other post found here: http://www.phpfreaks.com/forums/index.php?showtopic=43715 Please read our various forum guidelines. I also deleted your other post where you had: ho do i do a varibal plz help i forgot ??? thanks Which doesn't make any sense by iteself of exactly what you mean. I assume it's regarding this post where you specify $_GET['WHAT DO I PUT HERE']. If you have PHP version 4.1.0 or higher then use $_SESSION variable instead of session_register() which requires that register_globas be turned on. Click on the PHP F.A.Q. link below: http://www.phpfreaks.com/forums/index.php?...=0entry110865 Look for the $_GET Variables section to learn more. Read the PHP session tutorial at http://www.phpfreaks.com/tutorials/41/0.php but ignore any reference to session_register(). Quote Link to comment https://forums.phpfreaks.com/topic/1979-login-help/#findComment-6487 Share on other sites More sharing options...
<? ben >? Posted October 3, 2004 Author Share Posted October 3, 2004 the first block of code is my login bit i need help sorting the varibas out coz the 2nd block of code is an update thing which updates the persons profile i need it so they can edit it becaus when they do it shows my deatils go to www.elite-commandos.co.uk and click register then u will be logged in in the topcorner of the page u will be on it says update profile see 4 ur self thanks Quote Link to comment https://forums.phpfreaks.com/topic/1979-login-help/#findComment-6488 Share on other sites More sharing options...
<? ben >? Posted October 3, 2004 Author Share Posted October 3, 2004 which 1 do i need ??# Quote Link to comment https://forums.phpfreaks.com/topic/1979-login-help/#findComment-6489 Share on other sites More sharing options...
toplay Posted October 3, 2004 Share Posted October 3, 2004 You should have let people know that you're using dreamweaver. I've moved your post to this more suitable topic area. I don't know anything about it. Why don't you just try the various options. It doesn't look that hard. I also don't know whether you're talking about get variable or session variables. Please note I've update my previous post to inlcude links to stuff for you to read and learn from. Quote Link to comment https://forums.phpfreaks.com/topic/1979-login-help/#findComment-6490 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.