• 0

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191


File: /var/www/html/cnasolution/site/application/views/question.php
Line: 191
Function: _error_handler

File: /var/www/html/cnasolution/site/application/controllers/Questions.php
Line: 419
Function: view

File: /var/www/html/cnasolution/site/index.php
Line: 315
Function: require_once

PHP $ .post controller as follows

session_start(); date_default_timezone_set('Europe/Istanbul');  define('CONFIG' ,__DIR__ . '/../classes/config.php');  foreach (glob(__DIR__ . '/../classes/*.php') as $className){     require $className; }  require __DIR__ . '/../helper.php'; if (isset ($_POST['p'])) {     session_start ();     $Process = $_POST ['p'];     if ($process == 'atp') {         $id = $_POST[ 'id'];         atp(base64_decode_url($ id));     } }  function atp($id){     include CONFIG;     $product=$db->query('SELECT * FROM products WHERE prod_id = "' . $id .'"',PDO::FETCH_ASSOC)->fetch();     $res=Page::GetFirstImageById($id);     $resim='./da-webmaster/public/img/'.$res[0]['ResimAd'];     if(session('login')!=""){         if(session('user_type')==1&&session("admin_confirm")){             if($product['camp_active']==1&&session("user_type")==1){                 $price=$product['saler_price'];             }else{                 $price=$product['saler_price'];             }             $qty=$product['saler_qty'];         }else{             if($product['camp_active']==1){                 $price=$product['prod_camp_price'];}             else{                 $price=$product['prod_price'];             }             $qty=1;         }         if(true){             $query = $db->prepare('INSERT INTO baskets SET basket_kid =? ,prod_id =? ,prod_qty =? ,basket_kip=? ,prod_price=?,prod_name=?,total_price=?,prod_thumbnail_path=?');             $insert = $query->execute([          session('id'),$id,$qty,$_SERVER['REMOTE_ADDR'],$price,$product['prod_name'],($price*$qty),$resim]);         }else{}     }else{         if(isset($_SESSION["shopcart"])){             $shopcart=$_SESSION["shopcart"];             $products=$shopcart["products"];         }             //session i├žinde product yoksa         else{             $products=array();         }         if(array_key_exists($product['prod_id'],$products)){         }else{             $products[$product['prod_id']]=$product;             $_SESSION["shopcart"]["products"]=$products;         }     }     totalhesap(); } 

My jquery code is as follows


The purpose of my code in the index.php file, click the add-to-cart-btn button to receive the id and send the function to my user session or database according to the state to add products. My code is on the server while running wampserver localhost

failed to load resource: the server responded controller / ajax.php: 1 with a status of 500

and I get

net :: ERR_CONNECTION_CLOSED: controller / ajax.php: 1

Download script demo [LINK] [Origin]
Download script demo [LINK 2] [Onedrive] Download script demo [LINK 2] [Google drive]