Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php require_once("wp-load.php"); session_start();
- function add_cart($kas=0,$type,$type2,$plotis,$kiekis,$aukstis,$type3=0) {
- $id=time();
- $all=$kas."_".$type."_".$type2."_".$plotis."_".$kiekis."_".$aukstis."_".$type3;
- $_SESSION['skaiciuokle_'.$id] = $all;
- }
- function del_cart($id) {
- foreach($_SESSION as $key=>$val) {
- $mas = explode("_", $key);
- if($mas[1] == $id) {
- unset($_SESSION[$key]);
- }
- }
- }
- function get_cart() {
- $cart = array();
- if($_SESSION){
- foreach($_SESSION as $key=>$val) {
- $mas = explode("_", $key);
- if($mas[0] == "skaiciuokle" && $mas[1] > 0) {
- $cart[]=$mas[1]."_".$val;
- }
- }
- }
- return $cart;
- }
- if($_POST["job"]=="add"){
- add_cart($_POST["kas"],$_POST["type"],$_POST["type2"],$_POST["plotis"],$_POST["kiekis"],$_POST["aukstis"],$_POST["type3"]);
- }
- if($_POST["job"]=="del"){
- del_cart($_POST["id"]);
- }
- if(($_POST["job"]=="add" or $_POST["job"]=="del" or $_POST["job"]=="view") and count(get_cart())>0){
- foreach(get_cart() as $k=>$c){
- $one=explode("_",$c);
- $i=$k+1;
- echo $i.". ";
- if($one[1]==0){
- echo "Dører: ";
- if($one[2]==0){echo "Innerdører, ";}else{echo "Ytterdører, ";}
- }else{
- echo "Vinduer: ";
- if($one[2]==0){echo "Nordline, ";}else{echo "Euroline, ";}
- }
- if($one[3]==0){echo "PVC";}elseif($one[3]==1){echo "TRE";}elseif($one[3]==2){echo "TRE-ALUMINIUM";}else{echo "ALUMINIUM";}
- if($one[1]==1){ echo ", ";
- if($one[7]==0){echo "Sidehengte vindu";}elseif($one[7]==1){echo "Toppsving vindu";}elseif($one[7]==2){echo "Toppstyrte vindu";}
- elseif($one[7]==3){echo "Sprosse vindu";}elseif($one[7]==4){echo "Side hung";}elseif($one[7]==5){echo "Side swing 180";}
- elseif($one[7]==6){echo "Side swing 90";}elseif($one[7]==7){echo "Top hung";}elseif($one[7]==8){echo "Top sliding";}
- else{echo "Top turn 180";}
- }
- echo "<br /><small>Bredde: ".$one[4]." mm,;";
- ?>
- <?
- echo "Høyde: ".$one[5]." mm,
- Stk. ".$one[6]."</small>
- <a href='#' class='del' rel='".$one[0]."'><big><b>X</b></big></a>
- <hr></hr>";
- }
- echo "<br /><a href='#' class='go'>Gå videre</a>";
- }elseif($_POST["job"]=="mini" and count(get_cart())>0){
- foreach(get_cart() as $c){
- echo $c."|";
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement