如何在wordpress中的function.php中获取会话值

Here I attached my function.php code

add_action('paypal_ipn_for_wordpress_payment_status_completed','process_payment', 10, 1);
function process_payment( $posted )
{    
$email12= $_SESSION['email12'];
$id1=$_SESSION['id'];
$date=$_SESSION['date'];
// Parse data from IPN $posted[] array
$first_name = isset($posted['first_name']) ? $posted['first_name'] : '';
$last_name = isset($posted['last_name']) ? $posted['last_name'] : '';
$payment_amount = isset($posted['mc_gross']) ? $posted['mc_gross'] : '';
$recurring_payment_id = isset($posted['recurring_payment_id']) ? $posted['recurring_payment_id'] : '';
$payer_email = isset($posted['payer_email']) ? $posted['payer_email'] : '';
$txn_id = isset($posted['txn_id']) ? $posted['txn_id'] : '';
$receiver_email= isset($posted['receiver_email']) ? $posted['receiver_email'] : '';   
    $mail_From    = $payer_email;
    $mail_To      = $receiver_email;
$mail_Subject = "VERIFIED IPN";
    $mail_Body    = "Hello Secretary,
                 New registration for the event: 
                     Name: $first_name $last_name";
 mail($mail_To, $mail_Subject, $mail_Body, $mail_From);   
$mail_From    = $receiver_email;
    $mail_To      = $payer_email;
    $mail_Subject = "VERIFIED IPN";
    $mail_Body    = "Thank you for registration. Your registration has been successfully done.";
mail($mail_To, $mail_Subject, $mail_Body, $mail_From);                                                              require_once('wp-config.php');
 global $wpdb;                  
$id12 = $wpdb->get_results("SELECT * FROM wp_nonmembersdetail where Email= '$email12'  ");
foreach($id12 as $row1)
 {
$wpdb->insert( wp_checkoutnonmembersdetails, array( 
                            'Event_Name' => $row1->Event_Name,
            'First_Name' => $row1->First_Name,
            'Last_Name' => $row1->Last_Name, 
            'Address' => $row1->Address, 
            'Email' => $row1->Email, 
            'cellphone' => $row1->cellphone, 
            'quantity' => $row1->quantity,
                            'payment_amount' => $payment_amount
    ) );
 }  
$id22 = $wpdb->get_results("SELECT * FROM wp_tmpmembersdetail where  id = '$id1' ");
foreach($id22 as $row2)
{
$wpdb->insert( wp_checkouttmpmembersdetail, array( 
                            'Event_Name' => $row2->Event_Name,
            'First_Name' => $row2->First_Name,
            'Last_Name' => $row2->Last_Name, 
            'Address' => $row2->Address, 
            'Email' => $row2->Email, 
            'cellphone' => $row2->cellphone, 
            'quantity' => $row2->quantity,
                            'payment_amount' => $payment_amount
    ) );
    }}

I found that there is no proble in function.php I think there is a problem in IPN hook. bcz I already get session value in my another hook code which is also in function.php and also working perfectly. Above I attached IPN hook code. In that I want to get session value of email12. please anyone help me.