Jump to content


This topic is now archived and is closed to further replies.

<? ben >?

login help

Recommended Posts

hi i have ths code

// *** Validate request to login to this site.

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($accesscheck)) {
 $GLOBALS['PrevUrl'] = $accesscheck;

if (isset($_POST['username'])) {
 $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

   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

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
 $theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $theValue;

 switch ($theType) {
   case "text":
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
   case "long":
   case "int":
     $theValue = ($theValue != "") ? intval($theValue) : "NULL";
   case "double":
     $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
   case "date":
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
   case "defined":
     $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
 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



Share this post

Link to post
Share on other sites

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:



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





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:



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().

Share this post

Link to post
Share on other sites

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



Share this post

Link to post
Share on other sites

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.



Share this post

Link to post
Share on other sites


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.