Questions tagged [php]

PHP (PHP: Hypertext Preprocessor) is a widely used, high-level, dynamic, object-oriented and interpreted scripting language primarily designed for server-side web development.

Filter by
Sorted by
Tagged with
0
votes
0answers
5 views

Why is this ResourceCollection not working?

ResourceCollection is not providing a ResourceCollection I'm trying to provide a collection of my tables to display for a Bulk (index) or all my tables in the database... There appears to be a bug ...
-1
votes
0answers
9 views

Ecrypted and decrypted password

I have main function class for encrypted and decrypted password. But here, I'm just can store the ecrypted password in database. Unfortunately, at javaScript also shows the ecrypted password. How do I ...
0
votes
1answer
10 views

How do I get toggle button working with php

Bootostrap Toggle button seems to refuse working with php [See Code][1] Click Departments dropdown in mobile mode to understand the issue [1]: https://pastebin.com/JncD1DfJ <div style="width:100%...
0
votes
0answers
4 views

How to do a redirect from a Slim 4 middleware?

I've been testing the new Slim 4 framework and redirects work fine for me in normal classes, but I cannot seem to get them working in middleware, where a response is dynamically generated (apparently?)...
-1
votes
0answers
13 views

Our site appears to have been breached - In the code below malicious

As previously I am new to programming. Our FIM indicated one of our Payment files may have been hacked. Please review the following code and help me understand what it does in order to determine if ...
0
votes
0answers
5 views

Sign in with Apple = invalid_client

I'm facing a very bad issue because I read so many guides and tutorials and nothing works. The result is always the same: {"error":"invalid_client"} I get the code, identityToken and everything I ...
0
votes
0answers
9 views

SQLSTATE [IM004]: [Microsoft] [ODBC Driver Manager] Driver SQLAllocHandle with SQL_HANDLE_ENV failed

I ran into this error on the rental server. I investigated a lot, but every question is a question on the local server. I can't connect to SSH and I don't have the authority to operate the control ...
0
votes
0answers
23 views

Incrementing variable based on date in PHP

I am building a schedule widget for a WordPress site and I've run into a problem. The widget allows the client to upload a .csv file, to indicate today's class, room, and instructor. Everything works ...
0
votes
2answers
16 views

PHP Variable Subclass and Accessing Parent Methods

This seems like a poor design model, but I'm going to ask anyhow. I'd like to access parent methods from a variably selected child class. In this example, $db can't be found. class car { ...
0
votes
0answers
11 views

Laravel (6.0.3) doesn't flush DB::statement commands?

Laravel (6.0.3): in my migration task I want to manually (with a custom sql) create tables and execute restore console command, so I've created the file database/migrations/...
1
vote
0answers
18 views

Running PHP Scripts in R

There's a PHP library that I'm really interested in using. However, there's no R implementation of it nor do I see an interpreter between the two. I've searched on Google but it seems like most ...
0
votes
1answer
11 views

Redirect output of Laravel installer

When I create a new project using the Laravel installer, the output always goes to my terminal, even when I redirect STDOUT and/or STDERR to a file. For example: $ .composer/vendor/bin/laravel new ...
-2
votes
1answer
33 views

Is it possible to search in multiple tables to search for “username”, “password”, “stat”?

I'm trying to create a login page where it looks for the a username, password, and stat (to redirect to their respective interface). Is there anything I could do for this? I'm on PHP 7, I've tried ...
0
votes
0answers
10 views

How can i change this string to the way i need? Regex [duplicate]

Hi i have a string which i need to change its placing but im no good in regex, can someone help? 12345678|10/21|95684552 I want the above string to be transferred to: third part~middle~first part ...
-3
votes
2answers
40 views

Are we hacked? Found the code below on our site. Very limited knowledge, please tell me what it does [on hold]

Please review the code below and let me know what it does. Qe found it in on of our payment pages. I'm afraid this may be capturing some card details $file = dirname(__FILE__) . '/' . self::...
-1
votes
0answers
11 views

I want to show an array with checkmarked entries from a mysql table and allow changes to be made on form and submitted

I have a website and database of voyages that is related to crew (list of all potential crew) and voyage_crew (crew on each voyage). When creating a new voyage I had set up a form to pull a list of ...
2
votes
1answer
24 views

Undefined variable error in Layouts (Laravel)

im trying to yield a section from a layout in laravel blade but the problem is the var is not defined when i yeild it here is my code: web.php: Route::get('/pr','[email protected]'); ...
0
votes
0answers
27 views

Generating a html table with php using 2 json objects and sorting by date

I have a JSON object with data (date, kms and duration) that I have used to make an HTML table. The data is stored in order via date so its displayed how i want. See below. Date Km's ...
0
votes
1answer
17 views

I want to add contact form 7 fields to my custom html code?

My html form source code : <div class="form-section"> <strong class="form-heading"> Your Details </strong> <div class="row"&...
1
vote
0answers
12 views

Sidebar is appearing on custom post pages without being called

I'm creating a Wordpress theme for a graphic portfolio website, and I'm utilizing the sidebar.php for a hero image on the index page that is not meant to appear on other pages. While this works for ...
0
votes
0answers
19 views

Is it possible to relate a table on a pivot one with eloquent ORM?

These are my tables many-to-many: products and suppliers, however I need to relate the pivot(product_supplier) to a table called payment_supplier. Product model public function suppliers(){ ...
0
votes
1answer
9 views

Only receive string 'admin' on controller store function Laravel 6

I want to be able to register a Laravel user from my Vue front end so i can create employee accounts. I build a data object in the front and send the ovject with a post request to my /api/v1/users ...
0
votes
0answers
10 views

Why does calling share lock before exclusive lock create dead-lock?

I am using pessimistic locking from Laravel. This code is called first (Lets label it Code A): DB::transaction(function () { $account = Balance::sharedLock()->find(1); sleep(4); $...
0
votes
1answer
41 views

Why does the PHP file not read the javascript properly? [duplicate]

I'm making a website, and have been trying to write javascript in a PHP file to create an alert, then depending on if the user clicks "ok" or "cancel", it takes them to different pages. I got a ...
0
votes
2answers
26 views

how to use one array two times in an array php?

$a = array('a','b','c','d','e','f'); $b = array('1','2'); $count = 0; $d = 0 ; $input = array('ina', 'inb','inc'); foreach ($a as $key => $v) { $count++; echo $v; echo $input[$key]; if ($count%3 == ...
-1
votes
1answer
31 views

PHP equivalent of C# SHA1 Unicode hashing

I have a running C# app with user authentication. I encrypt the passwords with the SHA1Managed class using Encoding.Unicode. Now, we are developing a new PHP web app and it seems that PHP sha1 method ...
-1
votes
0answers
13 views

Random embed don't show good on Firefox

I have a simple function that will embed a random video on my page, everything works fine on chrome but on firefox user have to ctrl+F5 to really have a randomized video, i assume that user don't ...
0
votes
1answer
23 views

Array is filled with blank value even when empty

Why is this array with empty value even though it has nothing filled? class URLDynamic { private $Parametro; private $SepURL; private function SetParametro() { if ( isset ( $_GET[...
0
votes
2answers
20 views

Return callback based on route name in Laravel

I searched the internet a lot, but couldn't find a solution. I need to return the callback registered on a route, based on the route name. Example My routes/api.php: Route::get('test', '...
0
votes
0answers
42 views

How to call percentage of a number in php variable to html/css?

I am trying to pass the percentage in css/html but I could not succeed. I am trying: <?php $myPercentage = 100; ?> Now I am trying to pass the variable in html/css. I want my progree bar will ...
-3
votes
0answers
12 views

Wpforms send data to a custom MySQL table with all the same fields [on hold]

I'm trying to send the data I collected from a Wpforms forms to a MySQL custom table that has the same fields (In the same moment users click the submit button). I saw that I can use the ...
0
votes
0answers
5 views

Laravel Twitter OAuth 'Unknown SSL protocol error in connection to api.twitter.com:443'

I host on a dreamhost VPS running php 5.6 with laravel 5.2.45 and curl 7.21.0. I have an application that I haven't really been maintaining much over the last year but got back to it today and get ...
0
votes
0answers
11 views

how to allow specific url to access my directory after Options -Indexes

how to allow specific URL to access my directory after Options -Indexes my ajax file cannot access to this directory how can I make it possible?
0
votes
0answers
8 views

WP Quiz PRO how to add score result to description

I use WP Quiz PRO plugin which helps to create quizzes in wordpress, https://demo.mythemeshop.com/s/?theme=WP%20Quiz. Unfortunately quizz option doesn't allow to share on Facebook the result of trivia ...
2
votes
0answers
33 views

Two PDO DB connections for two different MySQL servers in the same script

Until now I used one MySQL server to which I was connection through including the following code from a file like i.e. pdo-config.php <?php $host = 'server'; $db = 'db'; $user = 'user'; $pass = '...
0
votes
0answers
11 views

Laravel mailgun, multiple domains?

Sorry for my English, but I really need a help. I am trying to send massages from laravel by maigun driver. And it's work perfect when we speak about one single domain in config. But what if I want ...
0
votes
1answer
21 views

Getting only ONE URL from a “data-srcset” attribute with PHP Simple HTML DOM

I'm trying to scrape an image URL from an external website, to use as the src attribute in an image element on my own website. The issue is, that on the external website, the image URL is nested ...
0
votes
1answer
22 views

search for meta_key and get its meta_value inside stdclass

I'm using this PHP code to filter an stdclass array: function filter_callback($element) { if (isset($element->meta_key) && $element->meta_key == '_vendor_page_slug') { ...
0
votes
0answers
12 views

Why my CakePHP program doesn't save one of the inputs?

Why this code doesn't save the research field input to the database? It does save the username and the hashed password. I used this tutorial. src/Template/Users/asd.ctp <?php echo $this->...
-1
votes
0answers
22 views

How to substract and multiply using N decimals in php? [duplicate]

Is there any library function to do a custom precision N decimals operations? PHP function subMultFactorA($mayor, $minor, $mult, $digits) { return intval(( intval(($mayor * pow(10,...
0
votes
1answer
29 views

PDO query returns blank records when none should be returned

While loading a HTML page I also do database queries to fill several 'select' drop downs. I found that 1 query returns 23 blank records (at least that is what it appears to do) and adds 23 blank '...
0
votes
2answers
22 views

MYSQL SET UPDATE table from a variable

Need to be able to UPDATE a MYSQL table with string data. Get errors no matter what I try, and I have researched and nothing suggested works in this situation. '$soldout' '"$soldout"' {$soldout} '{$...
0
votes
0answers
15 views

Testable examples in the documentation

I'm creating a library in PHP. I would like to provide a nice tutorial with examples. How to make sure that the examples are correct? The library is tested with PHPUnit. I'm thinking how to mix ...
-1
votes
0answers
15 views

Not able to move file in folder in PHP

Issue is , If i move image on local server it's working but not working on live server Here is the code : <?php $target_dir = "../admin/content/"; foreach ($_FILES['file']['name'] as $key => $...
0
votes
0answers
20 views

why does my loop doesnt work inside modal?

I'm trying to display a set of buttons, that when clicked will display a table of data taken from the database. each button should display a different row, so I'm using 'for' to loop each button and '...
1
vote
0answers
9 views

Symfony 4 - Using VichUploader with Dompdf?

I use Dompdf in my symfony 4 project to generate pdf. For rendering the pdf, I make a render on a file twig. And in this twig file, I need to display images that I previously uploaded through ...
0
votes
1answer
28 views

PHP rewriting URL to remove .php extension

I am working on a project where I decided to get rid of the .php extension from the URL of my app. I am successful using the htaccess code given below. But the problem is, the page still loads using ....
0
votes
1answer
37 views

Getting the IP address of remote server in PHP

I'm in the process of building my first API driven app. I am looking for a way to retrieve the server IP address that is making the request. Here's the workflow. [User Website] => Sends Auth ...
0
votes
2answers
30 views

If Customer Has Never Bought, Add Product to Cart - Code Not Working

I am trying to implement a function that will check if a customer has ever bought ANY product from my shop before, and if not - provide them with a free "sign-up gift" on first purchase. I am able to ...
0
votes
0answers
11 views

PHPUnit - Odd behaviour (group runs)

I have some odd behavior with PHPUnit tests. What's happening is when I run them as a group, the last 5 fail. When I re-run the failed tests, they pass. When I run those failed tests by themselves, ...