ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

Sessions Question

June 07, 2011 3:45pm

Subscribe [3]
  • #1 / Jun 07, 2011 3:45pm

    dodgson

    120 posts

    Hi there, I’m working on a site that is pulling in 1 piece of data from an external server. I have it working on the homepage, but I can’t figure out how to start a session to pass this piece of data from page to page.

    Any help would be greatly appreciated. I’m way over my head.

    Mark

  • #2 / Jun 07, 2011 3:54pm

    Mark Bowen

    12637 posts

    Hi Mark

    The Session Variables plugin might be of help here on this one. If you can’t use it directly then you should at least be able to see how sessions are created and handled as the plugin is just PHP inside it.

    Hope that helps a bit.

    Best wishes,

    Mark

  • #3 / Jun 07, 2011 4:06pm

    dodgson

    120 posts

    Once Again…. Thanks Mark. I’m going to give it a try. I’ll post back soon.

    Thanks again.

  • #4 / Jun 08, 2011 4:47pm

    dodgson

    120 posts

    Hi Mark, I hope things are going well. I have been trying to figure out this session thing. I downloaded and installed the plugin you recommended, but I’m not really sure how to implement it. Any advice would be greatly appreciated.

    I’m receiving a piece of data called “dcode” from the following PHP script. I would like to create a session on all pages to insure that this variable is passed from page to page.

    I’m not even sure where to place the plugin code, do templates need to have PHP enabled, etc.

    <?php
                    $found = "0";
     
                    if (isset($_GET['dcode'])) { 
    
                         $convention_credit = "";
                                         $dcode = $_GET["dcode"];
                                         mysql_connect("IP Address", "my password", "database name") or die(mysql_error());
                                         mysql_select_db("my password") or die(mysql_error());
                                         $query_string1 = "SELECT dealerkey, convcredits FROM `convcredits` WHERE dealerkey = '" . trim($dcode) . "' LIMIT 1";
                                         $result = mysql_query($query_string1) or die(mysql_error());  
                                                                           
                                         while($row = mysql_fetch_array( $result )) {
                                         $found = "1";
    //                                   echo "ConvCreditTotal: ";
    //                                   echo $row['convcredits'];
                                         $cctotal = $row['convcredits'];
                                         }
      
                    }
     
                    if ( $found == 1 ) {
                                echo "Convention Credit Total:<h1> " . $cctotal . "</h1>";
                            }
                            else {
                                 echo "You are not a dealer";
                            }
                           
                         
                                                               
                           ?>

    Thanks again mark

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases