From database selected option value wont insert its value in other table

I have been struggling with option value for some time already. Have checked a lot of stuff on here, but nothing helps in my situation. So, basically I am trying to get an option value from one table and insert it in another one, but it just inserts “0” in the column.

Code:

<select name="driver_id" id="driver_id" class="form-control" required="">
<option value="">Choose driver</option>
<?php
    $sql = "SELECT * FROM `league_driver` `u`
            INNER JOIN `calendar_dates` `c` ON `c`.`league_id` = `u`.`league_id`
            WHERE `c`.`id` =".$_GET['id'] ;
    $result = $con->query($sql);
    if ($result) {
        while ($row = $result->fetch_assoc()) {?>
            <option value="<?=$row['driver_id'];?>"><?=$row['driver_id'];?>  -  <?=$row['team_id'];?></option>
  <?php }
    }
?>
</select>

I thought maybe something is messing up with WHERE clause, tried to remove it, same thing happens.

do you know the equivalent in java [duplicate]

I want the equivalent in java, please.

public function soapDeviceConfig(){
    $this->soap_param['location'] = $this->url. 'deviceconfig';
    $this->soap_param['uri'] = $this->uri. 'DeviceConfig:1';

    return new SoapClient(null, $this->soap_param);
}

foreach using array multidimensional

I have a problem that I want to make a multidimensional array by the list array below:

    $barang=array(
        [
            'id_barang' => 01,
            'nama_barang' => "laptop",
            'merk' => 'lenovo'
        ],
        [
            'id_barang' => 02,
            'nama_barang' => "RAM",
            'merk' => 'lenovo'
        ],
        [
            'id_barang' => 03,
            'nama_barang' => "Keyborad",
            'merk' => 'lenovo'
        ],
    );
    $harga=array(
        [
            'id_barang' => 01,
            'harga' => 2000000,
        ],
        [
            'id_barang' => 02,
            'harga' => 100000,
        ]
        );

I have tried to make a multidimensional array. but my code is still wrong. the code I have tried like below:

    $result=array();
    foreach ($barang as $value) {
        foreach ($harga as $k => $val) {
            $result[$value['id_barang'] = $val["id_barang"]] = [
                'harga' => $val["harga"]
            ];
        }
    }
    echo "<pre>";
    echo print_r($result);

the output of code like below, but it is still wrong code

 Array
 (
   [1] => Array
    (
        [harga] => 2000000
    )
   [2] => Array
    (
        [harga] => 100000
    )
 )

what I want the output of multidimensional array like below :

 Array
  (
  [0] => Array
  (
    [id_barang] => 01
    [nama_barang] => laptop
    [merk] => lenovo
    [dataharga] => Array
            (
                [0] => Array
                    (
                        [id_barang] => 01
                        [harga] => 2000000
                    )
            )
  )
  [1] => Array
  (
    [id_barang] => 02
    [nama_barang] => RAM
    [merk] => lenovo
    [dataharga] => Array
            (
                [1] => Array
                    (
                        [id_barang] => 02
                        [harga] => 100000
                    )
            )
  )
  [2] => Array
  (
    [id_barang] => 03
    [nama_barang] => Keyboard
    [merk] => lenovo
    [dataharga] => Array
            (
                [2] => Array
                    (
                        [id_barang] => ""
                        [harga] => ""
                    )
            )
  )
 )

Thanks in advance and sorry for occasional english mistakes

Call to undefined function in PHP login system

I am following this tutorial: https://youtu.be/gCo6JqGMi30 to make a login system using PHP and mySQL database.

However, when I try to signup to the “website” i have created, it throws this error:

Fatal error: Uncaught Error: Call to undefined function emptyInputSignup() in C:xampphtdocsPROJECTS-2022login-system-20-6-22includessignup.inc.php:24 Stack trace: #0 {main} thrown in C:xampphtdocsPROJECTS-2022login-system-20-6-22includessignup.inc.php on line 24

enter image description here

I have 2 seperate files needed for the signup process:

signup.inc.php (the file that calls some functions from the file functions.inc.php)

<?php


//If the user actully submitted the form the proper way then we want to run the php code inside this file here.
if (isset($_POST["submit"])) {

require_once 'dbh.inc.php'; 
require_once 'functions.inc.php';

$name = $_POST["name"]; 
$email = $_POST["email"];
$username = $_POST["uid"];
$pwd = $_POST["pwd"];
$pwdRepeat = $_POST["pwdrepeat"];

/*ERROR HANDLERS*/ 


/*1st type of error: If the user left any inputs empty (forgot to put username, passowrd or name etc.)*/
 if (emptyInputSignup($name, $email, $username, $pwd, $pwdRepeat) !== false) {
header("location: ../signup.php?error=emptyinput"); // "error=emptyinput" : the error message
exit(); //it is going to stop the script from running entirely
 }

 /*2nd type of error: If the user has sybmitted a username that is not proper*/
 if (invalidUid($username) !== false) {
    header("location: ../signup.php?error=invalidUid");
    exit(); 
     }

 /*3rd type of error: If the user has submited an email that is not proper (e.g forgot the @ symbol)*/
 if (invalidEmail($email) !== false) {
    header("location: ../signup.php?error=invalidEmail");
    exit(); 
     }

 /*4th type of error: If the repeated password the user has submited, doesnt match the original password)*/
 if (pwdMatch($pwd, $pwdRepeat) !== false) {
    header("location: ../signup.php?error=passwordsdontmatch");
    exit(); 
     }

  /*5th type of error: If the username and email already exists in the database (the user tries to signup with a username that is already taken) */
 if (uidExists($conn, $username, $email) !== false) {
    header("location: ../signup.php?error=usernametaken");
    exit(); 
     }

  //to this point, the user made no mistakes so we are gonna sign the user into the website:
     createUser($conn, $name, $email, $username, $pwd);

}
//If the user didnt get to this signup.inc.php page the proper way then we want to send them back to the signup.php page.
else {
    header("location: ../signup.php");
    exit();
}

functions.inc.php (the file that contains the functions)

    <? php

/* 1ST TYPE OF ERROR AT THE signup.inc.php FILE */
function emptyInputSignup($name, $email, $username, $pwd, $pwdRepeat) {
  $result;
  //if ANY of these are empty:
  if (empty($name) || empty($email) || empty($username) || empty($pwd) || empty($pwdRepeat)) {
    $result = true;
  }
  //if there are no empty fields:
  else {
    $result = false;
  }
  return $result;
}

/*2ND TYPE OF ERROR AT THE signup.inc.php FILE */
function invalidUid($username) {
  $result;
  //If the username is invalid:
  if (!preg_match("/^[a-zA-Z0-9]*$/", $username)) {
    $result = true;
  }
  //if the username is valid:
  else {
    $result = false;
  }
  return $result;
}

/*3RD TYPE OF ERROR AT THE signup.inc.php FILE */
function invalidEmail($email) {
  $result;
  //if the email is not proper:
  if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
    $result = true;
  }
  //if the email is proper:
  else {
    $result = false;
  }
  return $result;
}

/*4TH TYPE OF ERROR AT THE signup.inc.php FILE */
function pwdMatch($pwd, $pwdRepeat) {
  $result;
  if ($pwd !== $pwdRepeat) {
    //if the password doesnt match the repeated password:
    $result = true;
  }
  //if the password matched the repeated password:
  else {
    $result = false;
  }
  return $result;
}

/*5TH TYPE OF ERROR AT THE signup.inc.php FILE */
function uidExists($conn, $username, $email) {
  //we check if the username and the email as well have been taken
  $sql = "SELECT * FROM users WHERE usersUid = ? OR usersEmail = ?;"; // SQL STATEMENT
  $stmt = mysqli_stmt_init($conn); //PREPARED STATEMENT

  if (!mysqli_stmt_prepare($stmt, $sql)) {
    //if the prepared statement fails it sends the user back to the signup page:
    header("location: ../signup.php?error=stmttaken");
    exit();
  }
  //if the prepared statement succeeds then we pass the data from the user
  mysqli_stmt_bind_param($stmt, "ss", $username, $email);

  //EXECUTE THE PREPARED STATEMENT
  mysqli_stmt_execute($stmt);
  $resultData = mysqli_stmt_get_result($stmt); //RESULT STATEMENT

  //checking if there is a result from the results statement. See if anything uses $resultData
  //If we get results from the database it returns as true, if not it returns as false
  if ($row = mysqli_fetch_assoc($resultData)) {
    //return all the data from the database if this user exists inside the database:
    return $row;

  } else {
    $result = false;
    return $resut;
  }
  mysqli_stmt_close($stmt);
}

//FUNCTION TO SIGN THE USER UP 
function createUser($conn, $name, $email, $username, $pwd) {
  $sql = "INSERT INTO users (usersName, usersEmail, usersUid, usersPwd) VALUES (?, ?, ?, ?);"; //SQL STATEMENT

  $stmt = mysqli_stmt_init($conn); //PREPARED STATEMENT

  if (!mysqli_stmt_prepare($stmt, $sql)) {
    header("location: ../signup.php?error=stmtfailed");
    exit();
  }
  $hashedPwd = password_hash($pwd, PASSWORD_DEFAULT); //include the password submitted by the user which is $pwd and then hash it

  //include the $hashedPwd instead of the $pwd:
  mysqli_stmt_bind_param($stmt, "ssss", $username, $email, $username, $hashedPwd);
  mysqli_stmt_execute($stmt);
  mysqli_stmt_close($stmt);
  header("location: ../signup.php?error=none");
  exit();
}

It says that that the error is on this line at the signup.inc.php:

if (emptyInputSignup($name, $email, $username, $pwd, $pwdRepeat) !== false) {

But I can’t find a solution. I have included the functions.inc.php inside the signup.inc.php file and I don’t seem to have forgotten any closing bracket on the functions.

ci4 data table server side with hermawan library change to raw sql

How to change my code get data table from builder method to raw sql in ci4 :

Original code :

$db = db_connect();
    $builder = $db->table('customers')->select('firstName, lastName, phone, address, city, 
               country');
    return DataTable::of($builder)
        ->addNumbering()
        ->toJson();

I tried change to code below but i get an error :

$db = ConfigDatabase::connect();
    $sql = "SELECT firstName, lastName, phone, `address`, city, country FROM customers";
    $data = $db->query($sql)->getResult();

    return DataTable::of($data)
        ->addNumbering()
        ->toJson();

Thank you.

Getting error “Call to undefined function catchException()” in php chunk of code

I am making a class in php whose definition is given below.


<?php
    // A PHP class to log every exception on bugsnag account.
    // All classes that make 3rd party request must extend this class

    // importing all the dependencies
    require_once realpath('bugsnag.phar');
    require_once realpath('guzzle.phar');
    require_once realpath('vendor/autoload.php');

    class BugSnagLogger {
        
        private $bugsnag;
        private $bugSnagAPIKey;

        // Initializing the BugSnag Instance in the constructor itself.
        public function __construct($bugSnagAPIKey) {
            $this->bugSnagAPIKey = $bugSnagAPIKey;
            $this->$bugsnag = BugsnagClient::make($this->bugSnagAPIKey);
            BugsnagHandler::register($this->$bugsnag);
        }

        // Method to catchExceptions.
        public function catchException(Exception $exception) {
            $this->bugsnag->notifyException($exception);
        }
    }

    $logger = new BugSnagLogger('a7ce9f54025c3873c34775e8a7001e6e');
    $logger.catchException(new Exception('Custom Exception by Sparsh.'));
?>

On Executing the above code I am getting the error Call to undefined function catchException(). I don’t know what I am doing wrong in this case, can someone please help me with this ?.

permission denied on laravel.log file laravel 9 using Docker

I installed laravel using composer inside of my docker container, however, i get this error when i try to access the index page

The stream or file "/var/www/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied The exception occurred while attempting to log:

I am using laravel 9, i have tried all possible solution i could find and it doesn’t work.
I run on windows 10.

Here is my Dockerfile

FROM php:8.0.2-fpm

# Install dependencies for the operating system software
RUN apt-get update && apt-get install -y 
    git 
    curl 
    zip 
    unzip 

# Install extensions for php
RUN docker-php-ext-install pdo_mysql

# Install composer (php package manager)
RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer

# Set working directory
WORKDIR /var/www

I have adding the below code to my Dockerfile

# Assign permissions of the working directory to the www-data user
RUN chown -R www-data:www-data 
    /var/www/storage 
    /var/www/bootstrap/cache

but when try to build the image again with the code in it, i get an error message saying

directory doesn’t exist

Here is my docker-compose.yml file

version: '3.8'

services:
  php:
    build:
      context: ./
      dockerfile: Dockerfile
    container_name: jaynesis-php
    restart: always
    working_dir: /var/www
    volumes:
      - ../src:/var/www
  nginx:
    image: nginx:latest
    container_name: jaynesis-nginx
    restart: always
    ports:
      - "8000:80"
    volumes:
      - ../src:/var/www
      - ./nginx:/etc/nginx/conf.d
  mysql:
    container_name: jaynesis-db
    image: mysql:8.0
    volumes:
      - ./storage/mysql:/var/lib/mysql
    restart: always
    environment:
      MYSQL_ROOT_PASSWORD: root
    ports:
      - 3306:3306

XAMPP VM is not opening on MacOS 13 beta (Ventura)

I have updated to MacOS 13 Ventura and after that XAMPP VM app is not opening at all. I have tried several solutions for problems associated with XAMPP crash on previous MacOS versions (e.g. Updating bitnami hyperkit) but XAMPP VM still doesn’t work. Also I tried to reinstall XAMPP, but even XAMPP VM installer in not opening as the XAMPP VM app itself.

Console app report:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               stackman [9276]
Path:                  /Applications/xampp-osx-8.1.5-0-vm.app/Contents/MacOS/stackman
Identifier:            stackman
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        Exited process [9271]
User ID:               501

Date/Time:             2022-06-25 14:24:40.2887 +0500
OS Version:            macOS 13.0 (22A5286j)
Report Version:        12
Bridge OS Version:     7.0 (20P50320f)
Anonymous UUID:        E41A4C2D-3B98-3F27-492A-3E5FECB194E1


Time Awake Since Boot: 9900 seconds

System Integrity Protection: enabled

Crashed Thread:        4

Exception Type:        EXC_GUARD (SIGKILL)
Exception Codes:       GUARD_TYPE_MACH_PORT
Exception Codes:       0x0000000000000d5a, 0x0000000000000000

Termination Reason:    Namespace GUARD, Code 2305843022098599258 

Thread 0::  Dispatch queue: com.apple.main-thread
0   libsystem_pthread.dylib             0x7ff806b391ce _pthread_create + 586
1   stackman                                 0x44b9a82 _cgo_try_pthread_create + 66 (gcc_libinit.c:100)
2   stackman                                 0x44b98d6 _cgo_sys_thread_start + 118 (gcc_darwin_amd64.c:98)
3   stackman                                 0x4058d1d runtime.asmcgocall + 173 (asm_amd64.s:718)
4   stackman                                 0x4033589 runtime.newm + 153 (proc.go:1853)
5   stackman                                 0x4033c28 runtime.startm + 312 (proc.go:1997)
6   stackman                                 0x4033d75 runtime.handoffp + 85 (proc.go:2024)
7   stackman                                 0x4034191 runtime.stoplockedm + 257 (proc.go:2092)
8   stackman                                 0x403588a runtime.schedule + 730 (proc.go:2488)
9   stackman                                 0x4035a16 runtime.park_m + 182 (proc.go:2599)
10  stackman                                 0x405746b runtime.mcall + 91 (asm_amd64.s:351)

Thread 1:
0   libsystem_pthread.dylib             0x7ff806b33ecc start_wqthread + 0

Thread 2:
0   libsystem_pthread.dylib             0x7ff806b33ecc start_wqthread + 0

Thread 3:
0   stackman                                 0x405b455 runtime.usleep + 69 (sys_darwin_amd64.s:418)
1   stackman                                 0x40399f3 runtime.sysmon + 211 (proc.go:4216)
2   ???                               0x7469622d343620 ???

Thread 4 Crashed:
0   stackman                                 0x405b56a runtime.mach_msg_trap + 42 (sys_darwin_amd64.s:510)
1   stackman                                 0x402bdc9 runtime.machcall + 137 (os_darwin.go:279)
2   stackman                                 0x402bf22 runtime.mach_semcreate + 162 (os_darwin.go:374)
3   stackman                                 0x405593b runtime.semacreate.func1 + 43 (os_darwin.go:45)
4   stackman                                 0x402b556 runtime.semacreate + 70 (os_darwin.go:44)
5   stackman                                 0x40134e2 runtime.lock + 114 (lock_sema.go:46)
6   stackman                                 0x4033b21 runtime.startm + 49 (proc.go:1974)
7   stackman                                 0x4034068 runtime.wakep + 72 (proc.go:2078)
8   stackman                                 0x40353d1 runtime.resetspinning + 113 (proc.go:2449)
9   stackman                                 0x40356d5 runtime.schedule + 293 (proc.go:2543)
10  stackman                                 0x403252e runtime.mstart1 + 158 (proc.go:1232)
11  stackman                                 0x4032476 runtime.mstart + 118 (proc.go:1188)
12  stackman                                 0x44b9c9d crosscall_amd64 + 12 (gcc_amd64.S:35)
13  libsystem_pthread.dylib             0x7ff806b384d1 _pthread_start + 125
14  libsystem_pthread.dylib             0x7ff806b33eef thread_start + 15


Thread 4 crashed with X86 Thread State (64-bit):
  rax: 0x000000000000002e  rbx: 0x0000000000000100  rcx: 0x000070000f33dc20  rdx: 0x0000000000000028
  rdi: 0x000070000f33dcc8  rsi: 0x0000000000000003  rbp: 0x000070000f33dc58  rsp: 0x000070000f33dc20
   r8: 0x0000000000001d03   r9: 0x0000000000000000  r10: 0x0000000000000100  r11: 0x0000000000000206
  r12: 0x0000000000000000  r13: 0x0000000000000000  r14: 0x0000000004032400  r15: 0x0000000000000000
  rip: 0x000000000405b56a  rfl: 0x0000000000000206  cr2: 0x00000000049a1948
  
Logical CPU:     0
Error Code:      0x0100001f 
Trap Number:     133


Binary Images:
    0x7ff806b32000 -     0x7ff806b3dff7 libsystem_pthread.dylib (*) <840e0b9f-85dc-392d-b3b1-3d1dbbd68c5d> /usr/lib/system/libsystem_pthread.dylib
         0x4000000 -          0x49a2fff stackman (*) <06c5a0bd-e3f8-3c99-8b48-01bd427e156a> /Applications/xampp-osx-8.1.5-0-vm.app/Contents/MacOS/stackman
               0x0 - 0xffffffffffffffff ??? (*) <00000000-0000-0000-0000-000000000000> ???

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=398.2M resident=0K(0%) swapped_out_or_unallocated=398.2M(100%)
Writable regions: Total=561.8M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=561.8M(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
Activity Tracing                   256K        1 
Kernel Alloc Once                    8K        1 
MALLOC                           165.2M       18 
MALLOC guard page                   24K        5 
MALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)
STACK GUARD                       56.0M        5 
Stack                             10.5M        6 
Stack Guard                          4K        1 
VM_ALLOCATE                      528.5G        9 
__DATA                            15.2M      276 
__DATA_CONST                      13.1M      172 
__DATA_DIRTY                       625K       97 
__FONT_DATA                        2352        1 
__LINKEDIT                       167.4M        5 
__OBJC_RO                         64.1M        1 
__OBJC_RW                         1965K        2 
__TEXT                           230.8M      297 
dyld private memory                512K        2 
mapped file                       29.1M        3 
shared memory                       72K        7 
===========                     =======  ======= 
TOTAL                            529.6G      910 
TOTAL, minus reserved VM space   529.2G      910 



-----------
Full Report
-----------

{"app_name":"stackman","timestamp":"2022-06-25 14:24:40.00 +0500","app_version":"","slice_uuid":"06c5a0bd-e3f8-3c99-8b48-01bd427e156a","build_version":"","platform":1,"share_with_app_devs":1,"is_first_party":1,"bug_type":"309","os_version":"macOS 13.0 (22A5286j)","roots_installed":0,"incident_id":"60060CF6-9765-4AF9-9013-F7A265545B8B","name":"stackman"}
{
  "uptime" : 9900,
  "procRole" : "Unspecified",
  "version" : 2,
  "userID" : 501,
  "deployVersion" : 210,
  "modelCode" : "Macmini8,1",
  "coalitionID" : 1516,
  "osVersion" : {
    "train" : "macOS 13.0",
    "build" : "22A5286j",
    "releaseType" : "User"
  },
  "captureTime" : "2022-06-25 14:24:40.2887 +0500",
  "incident" : "60060CF6-9765-4AF9-9013-F7A265545B8B",
  "pid" : 9276,
  "cpuType" : "X86-64",
  "roots_installed" : 0,
  "bug_type" : "309",
  "procLaunch" : "2022-06-25 14:24:40.2662 +0500",
  "procStartAbsTime" : 9978992971986,
  "procExitAbsTime" : 9979015264514,
  "procName" : "stackman",
  "procPath" : "/Applications/xampp-osx-8.1.5-0-vm.app/Contents/MacOS/stackman",
  "parentProc" : "Exited process",
  "parentPid" : 9271,
  "coalitionName" : "com.bitnami.stackman",
  "crashReporterKey" : "E41A4C2D-3B98-3F27-492A-3E5FECB194E1",
  "responsiblePid" : 9271,
  "bridgeVersion" : {"build":"20P50320f","train":"7.0"},
  "sip" : "enabled",
  "exception" : {"port":3418,"signal":"SIGKILL","guardId":0,"codes":"0x0000000000000d5a, 0x0000000000000000","violations":["INVALID_OPTIONS"],"message":"mach_msg_trap() called with msgh_id 3418. The trap is not allowed on this platform.","subtype":"GUARD_TYPE_MACH_PORT","type":"EXC_GUARD","rawCodes":[3418,0]},
  "termination" : {"namespace":"GUARD","flags":2,"code":2305843022098599258},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 4,
  "threads" : [{"id":138818,"queue":"com.apple.main-thread","frames":[{"imageOffset":29134,"symbol":"_pthread_create","symbolLocation":586,"imageIndex":0},{"imageOffset":4954754,"sourceLine":100,"sourceFile":"gcc_libinit.c","symbol":"_cgo_try_pthread_create","imageIndex":1,"symbolLocation":66},{"imageOffset":4954326,"sourceLine":98,"sourceFile":"gcc_darwin_amd64.c","symbol":"_cgo_sys_thread_start","imageIndex":1,"symbolLocation":118},{"imageOffset":363805,"sourceLine":718,"sourceFile":"asm_amd64.s","symbol":"runtime.asmcgocall","imageIndex":1,"symbolLocation":173},{"imageOffset":210313,"sourceLine":1853,"sourceFile":"proc.go","symbol":"runtime.newm","imageIndex":1,"symbolLocation":153},{"imageOffset":212008,"sourceLine":1997,"sourceFile":"proc.go","symbol":"runtime.startm","imageIndex":1,"symbolLocation":312},{"imageOffset":212341,"sourceLine":2024,"sourceFile":"proc.go","symbol":"runtime.handoffp","imageIndex":1,"symbolLocation":85},{"imageOffset":213393,"sourceLine":2092,"sourceFile":"proc.go","symbol":"runtime.stoplockedm","imageIndex":1,"symbolLocation":257},{"imageOffset":219274,"sourceLine":2488,"sourceFile":"proc.go","symbol":"runtime.schedule","imageIndex":1,"symbolLocation":730},{"imageOffset":219670,"sourceLine":2599,"sourceFile":"proc.go","symbol":"runtime.park_m","imageIndex":1,"symbolLocation":182},{"imageOffset":357483,"sourceLine":351,"sourceFile":"asm_amd64.s","symbol":"runtime.mcall","imageIndex":1,"symbolLocation":91}]},{"id":138819,"frames":[{"imageOffset":7884,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":0}]},{"id":138820,"frames":[{"imageOffset":7884,"symbol":"start_wqthread","symbolLocation":0,"imageIndex":0}]},{"id":138821,"frames":[{"imageOffset":373845,"sourceLine":418,"sourceFile":"sys_darwin_amd64.s","symbol":"runtime.usleep","imageIndex":1,"symbolLocation":69},{"imageOffset":236019,"sourceLine":4216,"sourceFile":"proc.go","symbol":"runtime.sysmon","imageIndex":1,"symbolLocation":211},{"imageOffset":32766967684544032,"imageIndex":2}]},{"triggered":true,"id":138822,"threadState":{"r13":{"value":0},"rax":{"value":46},"rflags":{"value":518},"cpu":{"value":0},"r14":{"sourceLine":1170,"value":67314688,"sourceFile":"proc.go","symbol":"runtime.mstart","symbolLocation":0},"rsi":{"value":3},"r8":{"value":7427},"cr2":{"value":77207880},"rdx":{"value":40},"r10":{"value":256},"r9":{"value":0},"r15":{"value":0},"rbx":{"value":256},"trap":{"value":133},"err":{"value":16777247},"r11":{"value":518},"rip":{"value":67482986,"matchesCrashFrame":1},"rbp":{"value":123145557367896},"rsp":{"value":123145557367840},"r12":{"value":0},"rcx":{"value":123145557367840},"flavor":"x86_THREAD_STATE","rdi":{"value":123145557368008}},"frames":[{"imageOffset":374122,"sourceLine":510,"sourceFile":"sys_darwin_amd64.s","symbol":"runtime.mach_msg_trap","imageIndex":1,"symbolLocation":42},{"imageOffset":179657,"sourceLine":279,"sourceFile":"os_darwin.go","symbol":"runtime.machcall","imageIndex":1,"symbolLocation":137},{"imageOffset":180002,"sourceLine":374,"sourceFile":"os_darwin.go","symbol":"runtime.mach_semcreate","imageIndex":1,"symbolLocation":162},{"imageOffset":350523,"sourceLine":45,"sourceFile":"os_darwin.go","symbol":"runtime.semacreate.func1","imageIndex":1,"symbolLocation":43},{"imageOffset":177494,"sourceLine":44,"sourceFile":"os_darwin.go","symbol":"runtime.semacreate","imageIndex":1,"symbolLocation":70},{"imageOffset":79074,"sourceLine":46,"sourceFile":"lock_sema.go","symbol":"runtime.lock","imageIndex":1,"symbolLocation":114},{"imageOffset":211745,"sourceLine":1974,"sourceFile":"proc.go","symbol":"runtime.startm","imageIndex":1,"symbolLocation":49},{"imageOffset":213096,"sourceLine":2078,"sourceFile":"proc.go","symbol":"runtime.wakep","imageIndex":1,"symbolLocation":72},{"imageOffset":218065,"sourceLine":2449,"sourceFile":"proc.go","symbol":"runtime.resetspinning","imageIndex":1,"symbolLocation":113},{"imageOffset":218837,"sourceLine":2543,"sourceFile":"proc.go","symbol":"runtime.schedule","imageIndex":1,"symbolLocation":293},{"imageOffset":206126,"sourceLine":1232,"sourceFile":"proc.go","symbol":"runtime.mstart1","imageIndex":1,"symbolLocation":158},{"imageOffset":205942,"sourceLine":1188,"sourceFile":"proc.go","symbol":"runtime.mstart","imageIndex":1,"symbolLocation":118},{"imageOffset":4955293,"sourceLine":35,"sourceFile":"gcc_amd64.S","symbol":"crosscall_amd64","imageIndex":1,"symbolLocation":12},{"imageOffset":25809,"symbol":"_pthread_start","symbolLocation":125,"imageIndex":0},{"imageOffset":7919,"symbol":"thread_start","symbolLocation":15,"imageIndex":0}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 140703241019392,
    "size" : 49144,
    "uuid" : "840e0b9f-85dc-392d-b3b1-3d1dbbd68c5d",
    "path" : "/usr/lib/system/libsystem_pthread.dylib",
    "name" : "libsystem_pthread.dylib"
  },
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 67108864,
    "size" : 10104832,
    "uuid" : "06c5a0bd-e3f8-3c99-8b48-01bd427e156a",
    "path" : "/Applications/xampp-osx-8.1.5-0-vm.app/Contents/MacOS/stackman",
    "name" : "stackman"
  },
  {
    "size" : 0,
    "source" : "A",
    "base" : 0,
    "uuid" : "00000000-0000-0000-0000-000000000000"
  }
],
  "sharedCache" : {
  "base" : 140703237689344,
  "size" : 19473252352,
  "uuid" : "91e491f1-9bed-38cf-a767-49e103932dd5"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=398.2M resident=0K(0%) swapped_out_or_unallocated=398.2M(100%)nWritable regions: Total=561.8M written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=561.8M(100%)nn                                VIRTUAL   REGION nREGION TYPE                        SIZE    COUNT (non-coalesced) n===========                     =======  ======= nActivity Tracing                   256K        1 nKernel Alloc Once                    8K        1 nMALLOC                           165.2M       18 nMALLOC guard page                   24K        5 nMALLOC_NANO (reserved)           384.0M        1         reserved VM address space (unallocated)nSTACK GUARD                       56.0M        5 nStack                             10.5M        6 nStack Guard                          4K        1 nVM_ALLOCATE                      528.5G        9 n__DATA                            15.2M      276 n__DATA_CONST                      13.1M      172 n__DATA_DIRTY                       625K       97 n__FONT_DATA                        2352        1 n__LINKEDIT                       167.4M        5 n__OBJC_RO                         64.1M        1 n__OBJC_RW                         1965K        2 n__TEXT                           230.8M      297 ndyld private memory                512K        2 nmapped file                       29.1M        3 nshared memory                       72K        7 n===========                     =======  ======= nTOTAL                            529.6G      910 nTOTAL, minus reserved VM space   529.2G      910 n",
  "legacyInfo" : {
  "threadTriggered" : {

  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "61fd92db295c182621ececc3",
      "factorPackIds" : {
        "SIRI_DIALOG_ASSETS" : "62a62539b6983a616949a0f1"
      },
      "deploymentId" : 250000076
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 250000156
    }
  ],
  "experiments" : [

  ]
}
}

Now I using regular XAMPP and I recovered data from VM files using qcow2 mount tools, BUT there some damaged projects and this is the reason I want to actually fix the XAMPP VM on MacOS 13 Ventura.

best way to save money transaction table in mysql [closed]

hey guys I’m going to create a tourism agency management system. the customers can ask for changes to the programs that they get from the agency so the total amount can be changed and all the tour, rent car, hotel prices ( all this has different tables and has its own price all of These prices are summed up and the sum saved in financial_transaction table ) so what the data that have to be saved in financial_transaction and what the best way to handle and display all of these changes

I need advice on structuring the table (the best way to do it)

Laravel 8.x Is there any way to bind CustomLogger using monolog with DateTimeZone set via Service Providers

I’d like to override all of Laravel logger’s dateTimeZone to ‘Asia/Tokyo’, but not changing config/app.php => timezone.

Laravel comes with monolog library by default, and basically IlluminateLogLogManager is doing all the work to instantiate MonologLogger objects.

We can pass DateTimeZone object to MonologLogger constructor’s 4th argument, but there is no way we can pass that to LogManager via config/logging.php or anything.

I know that there’s a way to create custom logger object with full control and register to custom channel.
https://laravel.com/docs/8.x/logging#creating-custom-channels-via-factories

One way is that I’ll create & use AppLoggingCreateCustomLoggerWithTokyoTimeZone::class and modify all of the default existing channels.

The other way is that I’ll somehow override LogManager and bind it to service container ‘s log service. (override log service, but it’s a singleton)

Any good ideas? Anything is appreciated.

WordPress PHP Contact form – problem with displaying message about sent mail

I’m trying to develop a contact form for a language school website that runs on WordPress.
Disclaimer: I’m about 6 months into coding, so please forgive me for being new to this. I’m developing my own theme and I wanted to limit usage of plugins to bare minimum for safety reasons – I prefer to learn how to write stuff myself instead on relying on updates of a third-party plus the courses I follow on WordPress dev listed it as a good practice to avoid unnecessary plugins.
Update: I tried implementing plugins, but they either broke my page or didn’t work anyway.

The problem is listed below in bold.

What I want to achieve:

  1. Simple contact form that takes following info: name, email, course, phone (optional) and a message.
  2. Validate the form if user provided correct info – I can’t make the
    user provide valid info, but at least I want to lock number into
    numbers only range and check if email is correct.
  3. Check if user is human (Captcha).
  4. Send the email to my address and provide a copy to the sender.
  5. Inform the user whether the action was a success or a failure.

What I succeeded with:

  • Mail gets sent.
  • Captacha seems to be working and filtering out attempts that do not click on it.

What ‘kinda works’:

  • The PHP doesn’t seem to validate the form. I used HTML type and require instead, but I’ve read that solution is not ideal. I tried to use JS to write some functions that would prevent unwanted input, but I couldn’t get it to work properly. I decided to ask the question first in case it might be a dead end. JS seems to be working on my WordPress as I’m using Bootstrap and some custom JS for certain features so I’m pretty sure the code gets executed, but I wanted to ask first if that’s the correct way of approach it before I invest my time in it.

What I have a problem with:

It is imperative to me that the user gets feedback from the page whether the email has been sent or not for obvious business-client communication reasons. I tried two solutions found on SO:

  • Injecting JS alert into PHP’s echo inside conditional (JS doesn’t get executed)
  • Using header method to redirect into thank-you.page that informs about success or error.page that
    informs about a failure and recommends another avenue of contact

What went wrong: the second solution got executed properly, the user gets redirected to site.com/thank-you or site.com/error, however the browser crashes due to ‘too many redirects’.

I tried googling, I tried different solutions from tutorials. What would be your recommendation?

My code:

<?php 
$nameErr = $emailErr = $courseErr = $phoneErr = "";
$name = $email = $course = $comment = $phone = "";
$thank_you = wp_redirect( '"'.home_url().'/thank-you"', 301 );
$error = wp_redirect( '"'.home_url().'/error', 301 );

if ($_SERVER["REQUEST_METHOD"] == "POST") {
    if (empty($_POST["name"])) {
      $nameErr = "Give name";
    } else {
      $name = test_input($_POST["name"]);
      // check if name only contains letters and whitespace
      if (!preg_match("/^[a-zA-Z-' ]*$/",$name)) {
        $nameErr = "Only letters allowed";
      }
    }
    
    if (empty($_POST["email"])) {
      $emailErr = "Need email";
    } else {
      $email = test_input($_POST["email"]);
      // check if e-mail address is well-formed
      if (!filter_var($email, FILTER_VALIDATE_EMAIL)) {
        $emailErr = "Email incorrect";
      }
    }
  
if (empty($_POST["phone"])) {
  $phone = "";
} else {
  $phone = test_input($_POST["phone"]);
  // check if URL address syntax is valid (this regular expression also allows dashes in the URL)
  if (!is_numeric($number)) {
    $phoneErr = "Bad number";
  }
}

if (empty($_POST["comment"])) {
  $comment = "";
} else {
  $comment = test_input($_POST["comment"]);
}

if (empty($_POST["course"])) {
  $courseErr = "Pick course";
} else {
  $course = test_input($_POST["course"]);
}
  }
 function test_input($data) {
    $data = trim($data);
    $data = stripslashes($data);
    $data = htmlspecialchars($data);
    return $data;
  }
    if(!empty($_POST['g-recaptcha-response']))
    {
          $secret = 'mySecretKey';
          $verifyResponse = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret='.$secret.'&response='.$_POST['g-recaptcha-response']);
          $responseData = json_decode($verifyResponse);
if($responseData->success)
              $message = "g-recaptcha verified successfully";
              if(isset($_POST['submit'])){
                $to = "[email protected]"; // this is your Email address
                $from = $_POST['email']; // this is the sender's Email address
                $name = $_POST['name'];
                $course = $_POST['course'];
                $phone = $_POST['phone'];
                $comment = "Form submission";
                $comment2 = "Copy of your form submission";
                $message =  "Name:" . $name . "Interested in " . $course. " Number" . $phone . " " . " Wrote" . "nn" . $_POST['comment'];
                $message2 = "Copy " . $name ."nn" . "Interested in:" . $course . "nn" . $_POST['comment'];
                $headers = "From:" . $from;
                $headers2 = "From:" . $to;
                mail($to,$comment,$message,$headers);
                mail($from,$comment2,$message2,$headers2);
                 // sends a copy of the message to the sender
                 header($thank_you);
                // This redirects to page thanking for contact.
                }
          else 
          header($error);
// This redirects to page informing about failure.
              $message = "couldn't verify Captcha. Email not sent.";
         echo '<script type="text/javascript">mailNotSent();</script>';
     }
?>
<section id="contact" class="contact">
    <div class="container pseudonest">
        <div class="pseudonest contact__head--nest">
            <h1 class="display-5 lh-1 mb-2 contact__head--pseudocircle contact__head--header mx-auto">Enroll now</h1>
        </div>
        <div class="container m-auto">
             <div class="d-flex justify-content-center contact__form">
                <div class="col-md-7 col-lg-8">
                    <form action="" method="post">
                        <form class="needs-validation" novalidate>
                            <div class="row g-3">
                                <div class="col">
                                    <label for="name" id="nameHeader" class="form-label">Name</label>
                                    <input type="text" class="form-control radio__margin" id="name" name="name"
                                        placeholder="" value="<?php echo $name;?>" required>
                                    <div class="invalid-feedback">
                                        <?php echo $nameErr;?>
                                    </div>
                                    <label for="email" class="form-label">Email</label></label>
                                    <input type="email" class="form-control radio__margin" id="email" name="email"
                                        placeholder="[email protected]" value="<?php echo $email;?>" required>
                                    <div class="invalid-feedback">
                                        <?php echo $emailErr;?>
                                    </div>
                                    <label for="phone" class="form-label">Phone</label></label>
                                    <input type="number" class="form-control radio__margin" id="phone" name="phone"
                                        pattern="[0-9]+" placeholder="+48 111 222 333" value="<?php echo $phone;?>">
                                    <div class="invalid-feedback">
                                        <?php echo $phoneErr;?>
                                    </div>
                                </div>
                                <div class="col radio__col">
                                    <label for="firstName" class="form-label">Course?</label>
                                    <div class="row radio__section">
                                        <label class="radio__container">English
                                            <input type="radio" name="course"
                                                <?php if (isset($course) && $course=="English") echo "checked";?>
                                                value="English">
                                            <span class="radio__checkmark"></span>
                                        </label>
                                        <label class="radio__container">
                                            <input type="radio" name="course"
                                                <?php if (isset($course) && $course=="Polish") echo "checked";?>
                                                value="Polish">
                                            <span class="radio__checkmark"></span>Polish
                                        </label>
                                        <label class="radio__container">
                                            <input type="radio" name="course"
                                                <?php if (isset($course) && $course=="Italian") echo "checked";?>
                                                value="Italian">
                                            <span class="radio__checkmark"></span>Italian
                                        </label>
                                        <span class="error"> <?php echo $courseErr;?></span>
                                    </div>
                                </div>
                            </div>
                            <div class="col-12 mb-5">
                                <label for="email-content" class="form-label">Content</label>
                                <div class="input-group has-validation">
                                    <textarea class="form-control" rows="5" name="comment"
                                        cols="30"><?php echo $comment;?></textarea>
                                    <div class="invalid-feedback">
                                    </div>
                                </div>
                            </div>
                            <form id="frmContact" action="varify_captcha.php" method="POST" novalidate="novalidate">
                                <div class="g-recaptcha my-3" data-sitekey="mySiteKey">
                                </div>
                                <input type="submit" name="submit" value="Send" id="submit"
                                    class="btn btn-primary contact__form--btn">
                                <div id="fakeSubmit" class="btn btn-primary contact__form--btn hidden">Fill the form
                                </div>
                            </form>
                        </form>
                </div>
            </div>
</section>

Laravel Action Route not Define

I have unique problem. I already create Route on web.php, on Controller, and Blade. and working on my localhost. but after publish to real server, I jus got error Action urlcontroller@function not define. this is my code.

Route::get('/timetableschedule', 'ManagementController@EmployeeTimeTable');

this is my web.php

public function EmployeeTimeTable(Request $request){
    $session = $request->session()->get('user.id');
    $companysession = $request->session()->get('user.location');
    $locationdata = DB::table('company')
    ->join('companyrole','companyrole.company_id','=','company.Company_id')
    ->join('users','users.id','=','companyrole.user_id')
    ->where('users.id',$session)
    ->get();

    $userlist = db::table('users')
    ->join('companyrole','users.id','companyrole.user_id')
    ->where('companyrole.company_id',$companysession)
    ->whereNotNull('users.NPK')
    ->select('users.id','users.name','users.NPK')
    ->orderby('users.name')
    ->get();

    $timesetting = db::table('time_leaving')
    ->where('company_id',$companysession)
    ->get();

    $leaveschedule = db::table('employee_leaving')
    ->join('users','employee_leaving.user_id','users.id')
    ->where('employee_leaving.company_id',$companysession)
    ->select('employee_leaving.leaving_date','users.name')
    ->get();

    return view('Management.employeetimetable',['location'=>$locationdata,'UserList'=>$userlist,'ListTimeSet'=>$timesetting,'LeavingSchedule'=>$leaveschedule]);
}

this is my controller

<li>
          <a href="{{action('ManagementController@EmployeeTimeTable')}}" class="dropdown-item">
            <p>Employee Timetable</p>
          </a>
        </li>

and this is code on blade to call controller@function

this step same as another controller, web, and blade.php. but, just for this rout get me a trouble. thank you