Results 1 to 7 of 7
  1. #1
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Fetch user email address from database

    Hello,

    I have a web page that needs to fetch the current users email address from the database and put it in a form.

    How can I do this?

  2. #2
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Re: Fetch user email address from database

    I was thinking that since the users login name is his email address I could just capture that login name, set it as a cookie
    something like setcookie( "username", $this->customer['email_address']); and then retrieve the cookie into the form on the static page.
    Cant figure out how to capture the login name though.

    Im not sure how zen cart stores current logged in user status. Does it have the user login in a global variable of some sort i can access it from?

  3. #3
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Fetch user email address from database

    Quote Originally Posted by hoehnt View Post
    Hello,

    I have a web page that needs to fetch the current users email address from the database and put it in a form.

    How can I do this?
    Is this "web page" a Zen Cart page? If so, just use $_SESSION['customers_email_address']
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  4. #4
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Re: Fetch user email address from database

    Quote Originally Posted by DrByte View Post
    Is this "web page" a Zen Cart page? If so, just use $_SESSION['customers_email_address']
    Its a static page inserted into my Zen Cart custom template.

  5. #5
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Re: Fetch user email address from database

    Shouldnt I be able to do something like:

    <INPUT name="useremail" type= "hidden" value="<?=$_SESSION['customers_email_address']?>">

  6. #6
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: Fetch user email address from database

    While I wouldn't recommend using short-tags, yes the concept is correct, as long as you're in a Zen Cart page.

    Or, rather than using some 3rd-party tool for collecting form data, why not use Zen Cart's own forms? Or maybe an addon such as the one discussed here: http://www.zen-cart.com/forum/showthread.php?t=4855
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  7. #7
    Join Date
    Dec 2009
    Posts
    13
    Plugin Contributions
    0

    Default Re: Fetch user email address from database

    Tried putting this in tpl_header_default.php and at the top of the static page where it should be loaded (first page after user logs in)
    Doesnt appear to do anything.
    I am checking the cookies by entering javascript:alert(document.cookie); in my browser address bar.
    What zen cart file would you recommend putting it in?

    <?php
    if ($_SESSION['customer_id'])
    {
    $var = $_SESSION['customer_id']);
    setcookie( "useremail", $var);
    }
    ?>

 

 

Similar Threads

  1. v154 Fetch next row from database query
    By kalastaja in forum General Questions
    Replies: 11
    Last Post: 11 Aug 2016, 12:09 PM
  2. "Email Address (sent FROM)" wants only an email address
    By drziegler in forum General Questions
    Replies: 1
    Last Post: 26 Oct 2012, 05:36 PM
  3. Help - how do I change admin user email address?
    By huaxu22 in forum Installing on a Windows Server
    Replies: 2
    Last Post: 11 May 2009, 09:58 AM
  4. Displaying user's email address on confirm page
    By dsided in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 21 Sep 2008, 11:07 PM
  5. login - create account - user's email address
    By canadianwebstar in forum Templates, Stylesheets, Page Layout
    Replies: 2
    Last Post: 8 Jun 2006, 01:59 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg