When executing SQL query in PHP, no errors are shown but no data can be seen in the database. What should I check?

I am trying to add data into a MySql Database using PHP.

The code:

<?php
    session_start();
    include('config.php');


    if(isset($_POST['Submit'])) {
        $city = $_POST['city'];
    
        $from_station = $_POST['from_station'];
        $from_date = $_POST['from_date'];

        // Prepare and execute the SQL query
        $sql = "INSERT INTO journeys (city, from_station, from_date) VALUES ('$city', '$from_station', '$from_date')";
        $result = $conn->query($sql);

        if (mysqli_query($conn, $sql)) {
            echo "New record created successfully";
        } else {
                echo "Error: " . $sql . "<br>" . mysqli_error($conn);
        }

    }
?>



<!DOCTYPE html>
<html lang="pt_PT">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>IR PLANNER</title>
        <link rel="stylesheet" href="Stylesgeneral_styles.css">
        <link rel="stylesheet" href="Stylescitymanager_styles.css">
    </head>


    <body>        
        <form class="modal" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
            <label for="city">City:</label>
            <input type="text" name="city" id="city">
            <label for="from_station">From Station:</label>
            <input type="text" name="from_station" id="from_station">
            <label for="from_date">From Date:</label>
            <input type="date" name="from_date" id="from_date">
            <input type="submit" value="Submit" id="Submit">
        </form>
       
    </body>

</html>

When the submit button is pressed no error is displayed. However, when the database table is checked nothing appears.

I have read articles and the sql connection (config.php) is working perfectly (in other pages and files is working) and the sql query is also good.

Is anyone facing this problem?

how to select some post(s) from one page and show selected post(s) on another page in wordpress

I create a custom post type named it ‘en-ads’ and taxonomy ‘en-ads-cat’.

I create a ajax search and it showed wanted post. each of these items has a check box that if user check it that item is added to something like woocommerce cart in another page. and when click the show cart button. user can see all selected items on that cart page.
also if user wants to come back and add something new to the cart, past cart items should stored and exclude douplicate posts. also user can delete an item in cart and add new in first page.

my search page is ‘site/ooh’ and cart page is ‘site/ooh-cart’

this is the html that I get from search result:

    <ul class="ajax_filter_search_results__list">
        <li id="ad-1230" class="ad-item">
            <img src="billboard title 1.jpg" class="ad-item__image--img">
            <div class="ad-item__info">
                <h4 class="ad-item__info--billboard">billboard title 1</h4>
                <div class="ad-item__info--list">
                    <p class="ad-item__info--item">billboard title 1 state</p>
                    <p class="ad-item__info--item">billboard title 1 city</p>
                    <p class="ad-item__info--item">billboard title 1 light : yes</p>
                    <p class="ad-item__info--item">billboard title 1 size: 10x2</p>
                    <p class="ad-item__info--item">billboard title 1 date: 2023-08-10</p>
                    <p class="ad-item__info--item">billboard title 1 price: 30000$</p>
                    <label class="ad-item__info--item ad-item__info--item-label">
                        <input type="checkbox" value="[object Object]" class="ad-item__info--add-to-pdf">
                    </label>
                </div>
            </div>
        </li>
        <li id="ad-1230" class="ad-item ad-item--add-to-cart">
            <img src="billboard title 2.jpg" class="ad-item__image--img">
            <div class="ad-item__info">
                <h4 class="ad-item__info--billboard">billboard title 2</h4>
                <div class="ad-item__info--list">
                    <p class="ad-item__info--item">billboard title 2 state</p>
                    <p class="ad-item__info--item">billboard title 2 city</p>
                    <p class="ad-item__info--item">billboard title 2 light : no</p>
                    <p class="ad-item__info--item">billboard title 2 size: 50x3</p>
                    <p class="ad-item__info--item">billboard title 2 date: 2023-09-10</p>
                    <p class="ad-item__info--item">billboard title 2 price: 40000$</p>
                    <label class="ad-item__info--item ad-item__info--item-label">
                        <input type="checkbox" value="[object Object]" class="ad-item__info--add-to-pdf">
                    </label>
                </div>
            </div>
        </li>
        <li id="ad-1230" class="ad-item ad-item--add-to-cart">
            <img src="billboard title 3.jpg" class="ad-item__image--img">
            <div class="ad-item__info">
                <h4 class="ad-item__info--billboard">billboard title 3</h4>
                <div class="ad-item__info--list">
                    <p class="ad-item__info--item">billboard title 3 state</p>
                    <p class="ad-item__info--item">billboard title 3 city</p>
                    <p class="ad-item__info--item">billboard title 3 light : yes</p>
                    <p class="ad-item__info--item">billboard title 3 size: 50x3</p>
                    <p class="ad-item__info--item">billboard title 3 date: 2023-12-10</p>
                    <p class="ad-item__info--item">billboard title 3 price: 7000$</p>
                    <label class="ad-item__info--item ad-item__info--item-label">
                        <input type="checkbox" value="[object Object]" class="ad-item__info--add-to-pdf">
                    </label>
                </div>
            </div>
        </li>
    </ul>
<a href="site/ohh-cart" class="cart-page">view cart</a>

when checkbox checked that li item get class ‘ad-item–add-to-cart’. only these items must export to cart page.

how can I achieve this? Any useful help is appreciated.

Laravel eloquent and a simple database query

Laravel 9. PHP 8.0.

The task is to write an array line by line. Can you tell me why writing with eloquent in this form does not work, while writing as DB select works fine. What is my problem?

Original code

$task = $request['task'];
$datetask = $request['datetask'];
$timetask = $request['timetask'];
        
for ($i = 0; $i < count($task ); $i++) {
    DB::insert('insert into tasks (task,datetask,timetask,)values(?,?,?)',
                [$task[$i],$datetask[$i],$timetask[$i]]);
};

and Eloquent code:

for ($i = 0; $i < count($task); $i++) {
    $task= new Task;
    $task->task = $request['task'];
    $task->datetask = $request['datetask'];
    $task->timetask = $request['timetask'];
    $task->save();
}

Error:

Array to string conversion.

Line:: $task->save();

Euro (€) symbol in php array displayed as question mark

I have a very annoying problem with the euro symbol in my PHP-array.
I would like to split strings of different lengths by every character into arrays.
E.g.: “Hi guys” ==> array(“H”, “i”, ” “, “g”, “u”, “y”, “s”)

This works great except with the € symbol.
As soon as a “€” is in the string it is output as “�”. I have already tried a lot, but unfortunately I can’t get any further.

UTF-8 is set as default-charset in php.ini.

Do you have a tip for me?

This is a simple example:

<?php 
  $euro = "€";
  $split = str_split($euro);
  echo $split[0]; // Ouput in browser: �
?>

Thanks a lot!

I have already researched for hours on the Internet and tested the various functions…

Change WooCommerce product gallery thumbnails to squares

I want to change the image gallery on a product page to squares. without the need to upload all images with a square format.

like in the image:
Optimal situation

So it wont look like this:
Current situation

If its possible to do this with CSS on the elemetor “Custome CSS” or with PHP into the functions.php file, also if its possible to do it with and without cropping the image so i can decide whats looks better.

Thanks 🙂

I tried adding codes i found on stackoverflow but nothing really worked

Unable to save/upload files to a folder on server with Dio and File_picker flutter packages & I am doing this with PHP

The problem I am facing is that the files I upload ta server are not being uploaded inside a folder but the filename is submitting into the database. I am providing all data related to selecting a file and then uploading it to the server

My flutter code is:

Dio dio = Dio(); // Initialize Dio instance
String? filePath;

Future<String> getFile() async {
  FilePickerResult? file = await FilePicker.platform.pickFiles(
    type: FileType.custom,
    allowedExtensions: ['pdf', 'docx', 'jpeg'],
  );

  if (file != null && file.files.isNotEmpty) {
    List<String> paths = file.files.map((file) => file.path!).toList();
    print("Selected file paths: $paths");
    return paths[0]; // Return the first selected file path
  }
  return ''; // Return an empty string if no file is selected
}

Future<void> _uploadFile(String filePath) async {
  if (filePath.isNotEmpty) {
    String originalFileName = basename(filePath);
    String randomFileName =
        '${DateTime.now().millisecondsSinceEpoch}_$originalFileName';

    FormData formData = FormData.fromMap({
      "file":
          await MultipartFile.fromFile(filePath, filename: randomFileName),
    });

    try {
      Response response = await dio.post(
        "path-to-my-file-uploading-php-code",
        data: formData,
      );
      print("file upload response status code: ${response.statusCode}");
      print("file upload response data: ${response.data}");
      ScaffoldMessenger.of(context).showSnackBar(
        const SnackBar(content: Text('File Uploaded!')),
      );
    } catch (e) {
      print("exception caught: $e");
    }
  } else {
    print("No file selected.");
  }
}

This is the UI for selecting and submitting file:

    Center(
     child: ElevatedButton(
     onPressed: () async {
      String filePath =
          await getFile(); // Get the selected file path
      if (filePath.isNotEmpty) {
        _uploadFile(
            filePath); // Call the _uploadFile function with the file path
      } else {
        print("No file selected.");
      }
    },
    child: Text('SUBMIT FORM'),
    style: ElevatedButton.styleFrom(
        minimumSize: Size(150, 50),
        primary: Color(0xffcc493f),
        shape: RoundedRectangleBorder(
            borderRadius: BorderRadius.zero)),
     ),
    ),

This is my PHP code for uploading file to the folder:

        <?php 

        $db = mysqli_connect('localhost','database-username','database-password','database');
        if(!$db){
            echo "Database connection failed!";
        }

        if (!file_exists('uploaddata')) {
            mkdir('uploaddata', 0777, true); // Create folder with full permissions recursively
        }

        $files = $_FILES['file']['name'];

        $file_path = '../uploaddata/'.$files;
        $temp_name = $_FILES['file']['temp_name'];

        if (move_uploaded_file($temp_name, $file_path)) {
            // File moved successfully, proceed with database insertion
            $db->query("INSERT INTO filesupload(files) VALUES('".$files."')");
        } else {
            echo "File upload failed.";
        }
        echo "File path: " . $file_path;

        $db->query("INSERT INTO filesupload(files)VALUES('".$files."')");

        ?>

The attachment file indicating the error I am receiving in Debug Console:

How do I get XMLHttpRequest to respond with the HTML and expand any nested includes within the HTML?

I have tried to search this in many ways before asking this question. Anyways.
For example I have a directory structure that is like this:

project
 |-index.php
 |components
  |-welcome.php
 |scripts
  |-xmlfuncs.js
 |forms
  |-loginForm.php
 ...

Ok so lets say index.php is the starting point and looks something like this:

(ignoring the html headers and css + scripts linking)
<div class="body">
  <div class="header">SITE NAME</div>
  <div class="navigation">
    <li class="eventNav"><a>event</a></li>
    <li class="announceNav"><a>announcements</a></li>
    ...
  </div>
  <div class="viewport" id="viewport">
    <php include './components/welcome.php'; ?>
  </div>
</div>

The idea here is I am going to be able to click one of the li elements and a XMLHttp
function called through javascript via an eventListener attached to each nav item and will fetch the component and set the #viewport innerHTML to the response. As you can see initially index.php includes the welcome “component” more like page.

Anyways here is an example of what the welcome.php file looks like in a brief manner:

<div class="welcomeBody">
  <div class="wa_container">
    <div class="welcomeContainer">
      <h1>Welcome</h1>
      <div class="welcomeContent">
      lorem ipsum lorem ipsum...
      </div>
    </div>
  </div>
  <div class="loginContainer">
    <php include './forms/loginForm.php'; ?>
  </div>
</div>

Ok so upon page load of index.php it includes welcome.php which in turn includes loginForm.php (just a simple form) all is well here but as soon as I click one of the

  • navItem elements and change the viewport innerHTML then try and do an XMLHttpRequest to load the response of welcome.php back into the viewport it doesn’t expand the loginForm.php include statement within the HTML.
    function XMLviewportChange(page, element, stateOpt){
        const viewport = document.getElementById('viewport');
        let XMLVPC = new XMLHttpRequest();
        XMLVPC.onreadystatechange = function(){
            if(XMLVPC.readyState == 4 && XMLVPC.status == 200){
                viewport.innerHTML = XMLVPC.responseText;
                if(stateOpt == 0) {
                    navelems.forEach((item) => {
                        item.style.backgroundColor = 'black';
                        item.firstElementChild.style.color = 'white';
                    });
                    welcmBtn.style.color = 'white';
                    element.style.backgroundColor = 'white';
                    element.firstElementChild.style.color = 'black';
                }
                if(stateOpt == 1) {
                    element.style.color = 'gold';
                    navelems.forEach((item) => {
                        item.style.backgroundColor = 'black';
                        item.firstElementChild.style.color = 'white';
                    });
                }
            };
        };
        console.log(page);
        XMLVPC.open('GET', page, true);
        XMLVPC.send();
        XMLVPC.DONE;
    

    here are some photo examples to better illustrate my issue just in case my explanation doesn’t make sense.

    initial page load welcome.php contents within viewport of index.php

    initial page load welcome.php contents within viewport of index.php

    I click the events button (responds with loginForm.php as a test)

    I click the events button (responds with loginForm.php as a test)

    I return to the welcome page (doesn’t include the loginForm.php or another form)

    I return to the welcome page (doesn't include the loginForm.php or another form)

  • WP Query with multiple taxonomies returns 0 results

    The aim is to return 3 posts from 2 separate taxonomies.

    Taxonmies Post 1 Post 2 Post 3
    ld_lesson_category low-seated low-seated low-seated
    ld_lesson_tag week1 week2 week3-test

    My query:

    $weeks = new WP_Query([
    
        //Weeks post type
        'post_type' => 'sfwd-lessons',
        'tax_query' => [
            'relation' => 'AND',
    
            //Intensity Level Category
            [
                'taxonomy' => 'ld_lesson_category',
                'field' => 'slug',
                'terms' => ['low-seated']
            ],
    
            //Week nos tags
            [
                'taxonomy' => 'ld_lesson_tag',
                'field' => 'slug',
                'terms' => ['week1', 'week2', 'week2-test'],
                'operator' => 'IN'
            ]
        ]
    
    ]);
    

    If I remove the tax query, all posts are returned. With the tax_query, no posts. It should return 3 posts.

    Check if a date is within the 1st, 2nd, 3rd, 4th, 5th week of the month PHP [duplicate]

    I’m really struggling with this, I’ve looked at other threads but haven’t really found anything that helps.

    If I had a list of dates for example.
    2023-08-01
    2023-08-03
    2023-08-12
    2023-08-13
    2023-08-15
    2023-08-23
    2023-08-28
    2023-08-31

    How can I check each date to see whether the date is within week1, week2, week3, week4 or week5 of the current month, where the first day of a week is a monday, and the last day of a week is a sunday?

    If the first day of the week is not a monday, for example the first week of the month it could be a tuesday, it should treat tuesday as the first day of the week just for that week.

    Expected output
    2023-08-01 – first week
    2023-08-03 – first week
    2023-08-12 – second week
    2023-08-13 – third week
    2023-08-15 – third week
    2023-08-23 – fourth week
    2023-08-28 – fifth week
    2023-08-31 – fifth week

    mysqli_insert_id() through functions file [duplicate]

    Hello i have build a PHP file which is adding entries in a mysql database.
    My php call an include function file to add data (function sqlQuery)

    I’m using incermental ID and i’d like to get the Id number just created.
    i’m trining unsing mysqli_insert_id() but it did not reply anything

    my php file :

    $query = "INSERT into publis (entry, bibTex";
      
    foreach($fields as $field)
        if (isset($_GET["$field"]))
            $query .= ", $field";
    
        $query .= ") VALUES ('$_GET[entry]', '$bibTex'";
        foreach($fields as $field)
            if (isset($_GET["$field"]))
                $query .= ", '".LaTeXToIso(addslashes($_GET["$field"]))."'"; // Ajout de addslashes par Vincent le 26 juillet 2017
        $query .= ")";
        
        debug($query);
        sqlQuery($query);
        $id = mysqli_insert_id();
    

    my function “sqlQuery” (in an other file funtions.php)

    function sqlQuery($query)
    {
        $database="basilic";
        $host="localhost";
        $name="xxx";
        $password="xx";
      
        if (!$link = mysqli_connect($host, $name, $password)){
            $msg = "Unable to connect to mySQL servernHost=$host, Name=$namen";
            sendMessage($msg);
            die($msg . "Administrator has been warnedb prb connexion.");
        }
      
        if (!mysqli_select_db($link, $database)) {
            sendMessage("Unable to select $database mySQL database");
            echo("Unable to select mySQL database. Administrator has been warned.");
            die("</body>n</html>n");
        }
        
        if ($result = mysqli_query($link,$query))
            return $result; 
        else {
            sendMessage("Invalid sql query : $query");
            echo("Invalid Sql query. Administrator has been warnedn");
            echo("Debug : Invalid Sql query : <br />n<code>$query</code>n");
            die("</body>n</html>n");
        }
    }
    

    the entry is well created in the database
    Can you help me to get this ID
    thanks a lot and sorry for my english

    try to get the last ID created

    How to use LiipTestFixturesBundle 2.6 and DoctrineFixturesBundle 3.4 in Symfony 6.3.3 with panther 2.1?

    I would like to write end to end tests in symfony. Before running the test, I would like to load data into the database using fixtures. The code executes well however, the data is not persisted in the database. We notice all the same that the indexes of the tables affected by the fixtures have changed.

    How do I keep data loaded by fixtures in my test database? Or m’I missing something on how it should work ?

    Here is my code :

    • An abstract class for all tests :
    abstract class AbstractWebTestCase extends WebTestCase
    {
        use TraitJsonSerializer, PantherTestCaseTrait;
    
        protected AbstractDatabaseTool $databaseTool;
        protected Client $client;
        protected EntityManager $entityManager;
    
        protected function setUp(): void
        {
            parent::setUp();
            self::stopWebServer();
            $this->client = self::createPantherClient();
            $this->databaseTool = static::getContainer()->get(DatabaseToolCollection::class)->get();
            $this->entityManager = static::getContainer()->get('doctrine')->getManager();
        }
    
    • The test that should persist datas :
    public function testPantherConnexion() : void
        {
    
            $references = $this->getDatabaseTool()->loadFixtures([
                Fixture::class
            ], true)->getReferenceRepository();
    
            $this->client->request('GET', '/xxxxx');
            $crawler = $this->client->waitForVisibility('#ktAppBody');
            $this->client->submit(ConnexionForm::CREATE_FORM($crawler));
    
            $lastInsertedId = $this->entityManager->getRepository(CompteUtilisateur::class)
                ->createQueryBuilder('a')
                ->select("MAX(a.id) as maxId")
                ->getQuery()
                ->getSingleResult()['maxId'];
    
    
    
            $compte = $this->entityManager->getRepository(CompteUtilisateur::class)->findOneById($lastInsertedId);
    
    // Trigger an error to stop the panther process and debug the view
    // pause() doesn't exist
            $this->client->pause();
        }
    

    Here, the $compte inserted by the fixture is present, but when i look into my database using phpMyAdmin, there is none.

    • My .env.test file :
    # define your env variables for the test env here
    KERNEL_CLASS='AppKernel'
    APP_SECRET='$ecretf0rt3st'
    SYMFONY_DEPRECATIONS_HELPER=999999
    PANTHER_APP_ENV=test
    PANTHER_ERROR_SCREENSHOT_DIR=./var/error-screenshots
    DATABASE_URL="pdo_mysql://root:[email protected]:3306/xxxxxxxx?serverVersion=15&charset=utf8mb4"
    PANTHER_CHROME_DRIVER_BINARY=%kernel.project_dir%/root/drivers
    PANTHER_NO_HEADLESS=1
    PANTHER_NO_SANDBOX=1
    PANTHER_ERROR_SCREENSHOT_DIR=%kernel.project_dir%/root/var/error-screenshots
    
    • dama configuration :
    #config/packages/test/dama_doctrine_test_bundle.yaml
    dama_doctrine_test:
        enable_static_connection: true
        enable_static_meta_data_cache: true
        enable_static_query_cache: true
    
    • liip configuration :
    #config/packages/test/liip_fixtures.yaml
    liip_test_fixtures:
      keep_database_and_schema: true
      cache_metadata: true
      cache_db: ~
    
    • framework configuration :
    #config/packages/framework.yaml
    # see https://symfony.com/doc/current/reference/configuration/framework.html
    framework:
        secret: '%env(APP_SECRET)%'
        csrf_protection: true
        http_method_override: false
        profiler:
            only_exceptions: false
    
        # Enables session support. Note that the session will ONLY be started if you read or write from it.
        # Remove or comment this section to explicitly disable session support.
        session:
            handler_id: null
            cookie_secure: auto
            cookie_samesite: lax
            storage_factory_id: session.storage.factory.native
    
        #esi: true
        #fragments: true
        php_errors:
            log: true
    
    when@test:
        framework:
            test: true
            session:
                storage_factory_id: session.storage.factory.mock_file
    
    • doctrine configuration
    doctrine:
      dbal:
        #url: '%env(resolve:DATABASE_URL)%'
        dbname: '%env(resolve:DBNAME)%'
        charset: '%env(resolve:CHARSET)%'
        user: 'root' #'%env(resolve:LOGIN)%'
        password: 'root' #'%env(resolve:PASSWORD)%'
        driver: '%env(resolve:DRIVER)%'
        host: '%env(resolve:HOST)%'
        # IMPORTANT: You MUST configure your server version,
        # either here or in the DATABASE_URL env var (see .env file)
        #server_version: '15'
      orm:
        dql:
         string_functions:
          YEAR: DoctrineExtensionsQueryMysqlYear
          MONTH: DoctrineExtensionsQueryMysqlMonth
          DAY: DoctrineExtensionsQueryMysqlDay
          NOW: DoctrineExtensionsQueryMysqlNow
        auto_generate_proxy_classes: true
        enable_lazy_ghost_objects: true
        naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
        auto_mapping: true
        mappings:
          #      gedmo_translatable:
          #        type: annotation
          #        prefix: GedmoTranslatableEntity
          #        dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Translatable/Entity"
          #        alias: GedmoTranslatable # (optional) it will default to the name set for the mapping
          #        is_bundle: false
          #      gedmo_translator:
          #        type: annotation
          #        prefix: GedmoTranslatorEntity
          #        dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Translator/Entity"
          #        alias: GedmoTranslator # (optional) it will default to the name set for the mapping
          #        is_bundle: false
          gedmo_loggable:
            type: attribute
            prefix: GedmoLoggableEntity
            dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Loggable/Entity"
            alias: GedmoLoggable # (optional) it will default to the name set for the mapping
            is_bundle: false
          #      gedmo_tree:
          #        type: annotation
          #        prefix: GedmoTreeEntity
          #        dir: "%kernel.project_dir%/vendor/gedmo/doctrine-extensions/src/Tree/Entity"
          #        alias: GedmoTree # (optional) it will default to the name set for the mapping
          #        is_bundle: false
          Entity:
            is_bundle: false
            dir: '%kernel.project_dir%/src/Entity'
            prefix: 'Entity'
            alias: Entity
          RelationalEntity:
            is_bundle: false
            dir: '%kernel.project_dir%/src/Entity/RelationalEntity'
            prefix: 'RelationalEntity'
            alias: RelationalEntity
    
    when@test:
      doctrine:
        dbal:
          # "TEST_TOKEN" is typically set by ParaTest
          dbname_suffix: '_test%env(default::TEST_TOKEN)%'
    
    when@prod:
      doctrine:
        orm:
          auto_generate_proxy_classes: false
          proxy_dir: '%kernel.build_dir%/doctrine/orm/Proxies'
          query_cache_driver:
            type: pool
            pool: doctrine.system_cache_pool
          result_cache_driver:
            type: pool
            pool: doctrine.result_cache_pool
    
      framework:
        cache:
          pools:
            doctrine.result_cache_pool:
              adapter: cache.app
            doctrine.system_cache_pool:
              adapter: cache.system
    

    I tried to insert data in my test database in a panther test case. I expect to find my data into the database DURING the test and eventually after the test but i know that liip purge the database after the test. However, i have inserted by hand some data in the database and they aren’t purged at all.

    Thanks in advance for your help 🙂

    App store server library use in PHP/Laravel Project

    Apple officially release “App store server” library to decode the the “app store server APIs” endpoints response.

    the official library are only in four language
    1.java
    2.python
    3.nodeJs
    4.swift

    I want to use “app store server APIs” and decode the response by library in PHP/Laravel

    So, There is any “App store server” library for PHP or How can i use java library or other library in PHP/Laravel

    HTML email is not working, Plain text Email working in CI

    I am send an Email in CodeIgniter Email library with GOOGLE SMPT from my subdomain with following configuration.

    $this->load->library('email'); 
    $config['protocol']  = 'SMTP';
    $config['smtp_host'] = 'ssl://smtp.googlemail.com';
    $config['smtp_crypto'] = 'ssl';
    $config['smtp_user'] = '[email protected]';
    $config['smtp_pass'] = 'passowrd';
    $config['smtp_port'] = '587';
    $config['mailtype'] = 'html';
    $config['newline'] = '"rn"';
    
    $this->email->initialize($config);
    $this->email->from('[email protected]', 'Smarty');
    $this->email->to('[email protected]');
                
    $sub=addslashes('Order Placed');
    eval("$subject= "$sub";");
    $this->email->subject($subject);
    $data['data']  = $somedata;
    $this->email->message(render_emailview('email',$data));
    $bool=$this->email->send();
    

    When i send an Email i received following message in inbox.

    enter image description here

    But when i send plain text email then it works.

    Can any one tell me is there any configuration required to send email?

    Laravel 8 API how to check if user has valid token in controller without auth middleware in routes file?

    How to check if user has valid token in controller without auth middleware in routes file? I try to do it this way in Basecontroller but it always return false:

    protected function isAuthenticated()
    {
        $isAuth = auth('api-web-app')->check();
    
        Log::info($isAuth);
    
        if( $isAuth ) {
            Log::info(auth('api-web-app')->check());
        }
        else {
    
            Log::info(auth('api-web-app')->check());
        }
    }
    

    There is api-web-app guard in auth.php config file

        'api-web-app' => [
            'driver' => 'jwt',
            'provider' => 'customers',
            'hash' => false,
        ],
    

    so I expected it will run the same logic as auth middleware, but it seem it is not.

    File uploading Laravel

    Good morning everyone
    I have a task to add a feature to a website that allows the client to upload a document and let him open his document later
    Now l have two questions
    I let him open the document by the decument link (Storage location)…is it secure?? Bz he can knew the storage location

    The second question is that if the file contain tables or Arabic words when i try to open it on the browser after uploading it a strange symbols appears not the file content….

    I created a button and put the decument link in it to let the client open his decument….but l don’t know if it the best practice or not