# Problems with session vars

**URL:** <https://forum.kirupa.com/t/problems-with-session-vars/113477>\
**Category:** Uncategorized\
**Created:** [June 18, 2004, 11:28am UTC](https://forum.kirupa.com/t/problems-with-session-vars/113477 "2004-06-18T11:28:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mid\_ori](https://avatars.discourse-cdn.com/v4/letter/m/7cd45c/32.png) [@mid\_ori](https://forum.kirupa.com/u/mid_ori)\
**Post date:** [June 18, 2004, 11:28am UTC](https://forum.kirupa.com/t/problems-with-session-vars/113477/1 "2004-06-18T11:28:04Z")

</div>

Hi All

I’m really confused using these session vars can somebody help me out.

What i’m trying to accomplish is that when i click a mute button (mute the sound) in a flash movie on one page its muted then throughout the site. the code i have used is as follows:

on the timeline

ActionScript Flash:  
//session vars

createEmptyMovieClip(“mute\_ctrl”,0);  
loadVariables(“[http://www.iceni.tv/mute/mute.php","mute\_ctrl](http://www.iceni.tv/mute/mute.php%22,%22mute_ctrl)”);

mute\_ctrl.onData = function() {  
mute\_off\_btn.label = this.mute;  
}

//end session vars

on the button

ActionScript Flash:  
on (press) {  
set\_mute = \_root.mute\_ctrl.mute == “off” ? “on” : “off”;  
loadVariables(“[http://www.iceni.tv/mute/mute.php](http://www.iceni.tv/mute/mute.php)”, “\_root.mute\_ctrl”, “GET”);  
}

and this is how i get the sound (its on a flv)

ActionScript Flash:  
// take the audio out of the flv  
my\_video.attachAudio(myVideo);  
var snd = new Sound("\_root");  
snd.setVolume(100);

// mute button turn off  
mute\_off\_btn.onRelease = function(){  
if (snd.getVolume(100)){  
snd.setVolume(0);  
mute\_off\_btn.\_alpha = 50;  
}else{  
snd.setVolume(100);  
mute\_off\_btn.\_alpha = 100;  
}  
}

and the php code is

```php
<?php 

session_start(); 

//if the session index `mute` is not set, set it to `off` 
if ( !isset($_SESSION['mute']) ) 
{ 
    $_SESSION['mute'] = "off"; 
} 

//if the GET variable `set_mute` is `on` or `off` set the SESSION variable `mute` as the same 
if ( @$_GET['set_mute'] == 'off' || @$_GET['set_mute'] == 'on' ) 
{ 
    $_SESSION['mute'] = $_GET['set_mute']; 
} 

//echo the mute value for flash 
echo "mute=".$_SESSION['mute']; 

?> 

```

the web site address is [http://www.iceni.tv](http://www.iceni.tv)

this code was written for me but i just don’t understand how to get it to work so all advise/help is very much appreciated. if my explanation is unclear let me know.

cheers

iceni
