Jump to content

Help with passing variables


RobRocker

Recommended Posts

Howdy everyone.

I am having trouble passing a $_GET variable. It is "getting" it correctly but it wont pass it to next site.

Here is my code that I am trying to get to work. Now when I pass this I get a error that says.

[quote]You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1[/quote]

[code]$id = $_GET['id_eve'];
$MM_redirectLoginSuccess = "calenderedit.php?id_eve=$id";[/code]

Here is the scenario...

I have a dynamic calendar view page, it loads id_eve and grabs the correct information from the database. I have a "Login to Edit" form at the bottom of the page. Which is what the redirectLoginSuccess variable is for. Now when I hit the sumbit form information button it send me to the site but it just has "calenderedit.php?id_eve=" in the address bar but no variable....

Can you help? BTW I have all my code like this above the html tags.
Link to comment
Share on other sites

No that didnt work. *sigh*

Here is my whole code.

[code]<?php require_once('Connections/calendar.php'); ?>
<?php
$colname_Recordset1 = "-1";
if (isset($_GET['id_eve'])) {
  $colname_Recordset1 = (get_magic_quotes_gpc()) ? $_GET['id_eve'] : addslashes($_GET['id_eve']);
}
mysql_select_db($database_calendar, $calendar);
$query_Recordset1 = sprintf("SELECT * FROM rsCalendar WHERE id_eve = %s", $colname_Recordset1);
$Recordset1 = mysql_query($query_Recordset1, $calendar) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}
$id = $_GET['id_eve'];
$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['email'])) {
  $loginUsername=$_POST['email'];
  $password=$_POST['password'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "calenderedit.php?id_eve=".$id;
  $MM_redirectLoginFailed = "calender.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_calendar, $calendar);
 
  $LoginRS__query=sprintf("SELECT user_email, user_pass FROM rsCalendar_users WHERE user_email='%s' AND user_pass='%s'",
    get_magic_quotes_gpc() ? $loginUsername : addslashes($loginUsername), get_magic_quotes_gpc() ? $password : addslashes($password));
 
  $LoginRS = mysql_query($LoginRS__query, $calendar) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  if ($loginFoundUser) {
    $loginStrGroup = "";
   
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];
    }
    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>[/code]
Link to comment
Share on other sites

Ok, Well since that is giving me trouble. I had another idea.

I know in PHP you can have modules that are shown depending on certain situations. Can I make a module that after the person logs in, it "unlocks" a module so the person can access that module?

If that is possible can anyone give me resources on how to do it?
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.