Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6247831
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T12:56:50+00:00 2026-05-24T12:56:50+00:00

I have 2 scripts/pages, both using session data. Page 1 is a table with

  • 0

I have 2 scripts/pages, both using session data.

Page 1 is a table with some data, one of the pieces of data is an email address. This page is only accessible if $_SESSION['email'] == 'myEmail@email.com'. There is a button on page 1 in each row of the table that sends an AJAX call to script/page 2 which emails that corresponding email address.

In page 2 there is another check for $_SESSION['email'] == 'myEmail@email.com'.

Then it sets $email = $_POST['email'] and calls a mail() function. After this script executes it automatically changes $_SESSION['email'] to be equal to $email.

I’ve changed the variable name from $email to $sendToEmail and this fixes the issue.

My question is why does it do this? Is this a bug or a feature?

EDIT:

This is the mail.php code in it’s entirety.

<?php
session_start();
define("_VALID_PHP", true);
require_once('init.php');

if ($_SESSION['email'] == 'email@gmail.com') {
    if (isset($_POST['iid'])) {
        $iid = $_POST['iid'];
        if (isset($_POST['email'])) {
            $sendToEmail = $_POST['email'];
            $query = $db->query("SELECT id FROM esns WHERE iid='$iid' AND status=0");
            if (mysql_num_rows($query) > 0) {
                $data['success'] = false;
                $data['msg'] = "Email cannot be sent until all ENS's are checked for this invoice.";
            }
            else {
                $query = $db->query("SELECT uid, md5 FROM invoice WHERE id='$iid'");
                $row = $db->fetch($query);
                $uid = $row['uid'];
                $md5 = $row['md5'];
                $query = $db->query("SELECT email FROM users WHERE id='$uid'");
                $row = $db->fetch($query);
                if ($row['email'] == $email) {
                    $clean = array();
                    $bad = array();
                    $invalid = array();
                    $query = $db->query("SELECT esn, status, carrier FROM esns WHERE iid='$iid'");

                    $headers = "From: email@site.com";
                    $subject = "New Message from site.com";

                    $body = "Hello";

                    $mail = mail($sendToEmail,$subject,$body,$headers);

                    if (!$mail) {
                        $data['success'] = false;
                        $data['msg'] = "There was an error sending the email."; 
                    }
                    else {
                        $query = mysql_query("UPDATE invoice SET paid=2 WHERE id='$iid'");
                        $data['success'] = true;
                    }
                }
                else {
                    $data['success'] = false;
                    $data['msg'] = "There was an mismatch with the emails. The posted email does not belong to this invoice.";  
                }
            }
        }
        else {
            $data['success'] = false;
            $data['msg'] = "Post data not sent/recieved correctly: `email` is no set.";
        }
    }
    else {
        $data['success'] = false;
        $data['msg'] = "Post data not sent/recieved correctly: `iid` is no set.";
    }
}
else {
    $data['success'] = false;
    $data['msg'] = "Your are not logged in as an administrator.";
}
echo json_encode($data);
?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-24T12:56:51+00:00Added an answer on May 24, 2026 at 12:56 pm

    You have probably register_globals on? That might be your core of problem, because when it is on, it’ll set $_SESSION automatically when setting $email

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm using jquery-1.4.2.min.js and jquery-ui-1.8.1.custom.min.js. According to Firebug, both minimized scripts have been loaded.
I have some script in my default page that redirects users to language specific
I have tested the below script on a demo page which is not using
I have a database table containing scripts for plays/dramas. The scripts can be categorized
I have the following snippet in one of my html pages : <div class=inputboximage>
I have two autocomplete scripts, one of them makes use of (A) php/mysql/html/jquery and
I have a vbscript using the InternetExplorer object to navigate to a few pages
i have been trying to get the source of a page in php using
I have two PHP scripts. One acts as a backend, and contains a class
Not just faster but better both in speed and using resources/memory. I have an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.