Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [php]

PHP is a widely-used, general-purpose scripting language that is especially suited for web development.

-1
votes
0answers
9 views

My Website - Move Menu or Content

I've been making my menu a bit wider on my website, then I realized that the menu was too wide that it started touching the content portion of the wrapper and not reformatting itself so they do not ...
-3
votes
0answers
12 views

Taking a long time to load [on hold]

I have a php file that's taking an extremely long time to load and when it is loaded it just return a blank page (still shows all CSS and stuff, but no outcome from the queries it was executing). I ...
0
votes
0answers
12 views

Abstracting a SQL Server Table builder

I'm working with SQL Server 2012 and wanted to make table builder, similar to Laravel's migration classes. I would like to be able to expand this down the road but the main purpose of this code will ...
-2
votes
0answers
20 views

How can I use fetch to store both image and text at a same time? [on hold]

I tried using formData.append() to mix both image and JSon object, but it is not working... Only image goes to the server but not username,usereamil and userpassword, it shows empty for them This is ...
1
vote
1answer
42 views

Elegant and secure way to create a dynamic query

I want to create a dynamic query to display: all the invoices if the user has moderator rank only his invoices if the user is a simple member code ...
-3
votes
1answer
53 views

Parse header information

I parse the header information from an array like this: ...
1
vote
2answers
49 views

Combining two queries in one

What I want is getting all names (first, middle, last) of the users along with each of their total hours of work which will be calculated by the SQL statement: ...
2
votes
1answer
59 views

Using Curl/Post to execute a HTTP request

I have a loop in a php file to HTTP_Request Server Via CURL->POST. But I don't know if I'm missing any security considerations. Also, is there a better way to perform this http request? ...
1
vote
0answers
28 views

Webshop Conversion - Binary testing is not even [on hold]

Everytime a new visitor comes to my webshop I write a cookie (1d) which sets a session entry with mt_rand(1,2) to A or B group. ...
3
votes
0answers
25 views

Codeigniter models optimization

I have two tables: tableA aid name age sex ...
2
votes
1answer
44 views

OOP in PHP. Exercising on creating a blog

I am attempting to do object oriented programming in right way, and appreciate any review to see if my approach is correct. class_blogpost.php as below: ...
2
votes
1answer
36 views

PHP LDAP credentials validation and error handling

I developed this group of scripts to validate users againts a LDAP server and presenting the appropiate message to the user after sending the information. I wonder if I'm handling everything properly ...
4
votes
1answer
43 views

List of previous and upcoming months to a given date (year and month)

I need a menu with buttons of months previous and after a given month, something like this: | month | month | month | current month | month | month | month | Can this function further be improved? ...
4
votes
1answer
88 views

A small PHP library for styling terminal output

I've attempted to make a small PHP library for styling terminal output using ANSI escape sequences. The repo is located here. To be honest, I am not really satisfied with the current structure of my ...
0
votes
1answer
47 views

Register Script for a website [closed]

I'm still new in web development and I am trying to develop a website with free access to doctors listing with option of booking. This is a personal project that my local community can benefit. I ...
1
vote
0answers
10 views

List products based on slug and sidebar filters

This method shows the list of manufacturers' offered products based on the slug and sidebar filters. Most of the time I have to write the same query with only some changes: you can say I am repeating ...
1
vote
0answers
10 views

Custom WordPress SQL query to get posts and users using term_id

I have a WordPress site with multiple custom post types, that all share a common custom taxonomy. Users can also be tagged with terms from this taxonomy. After giving up on ...
-3
votes
0answers
41 views

Is $_GET['id'] vulnerable? [closed]

Is this code vulnerable inside foreach with pdo? I'm talking just about this code, not the whole code. If yes, can you show me a fix? Thanks. ...
2
votes
1answer
34 views

Secure file upload in PHP

I've coded this function as a secure file upload function in PHP. Currently I'm woking on an academic grading system (PHP script) which's really sensitive, so tell me what you think, and if you have ...
0
votes
1answer
47 views

Displaying a paginated list of forum topics using PHP PDO [closed]

Can someone tell me if this code is safe? Can be sql-injected or something else hacked? Code get some rows from db and show in pages with pagination... if i can improve let me know and show me how, ...
7
votes
1answer
115 views

Build a set of REST interfaces using Symfony framework

I have got a technical challenge from a company but they reject my code and I'm not sure how to do this challenge in a more efficient way so I'm here to get some guidance. The Technical challenge was:...
1
vote
0answers
33 views

Proper image sizes in WordPress

I wanted to create a set of functions that would allow me to easily implement images for multiple screen resolutions in my custom page templates. WordPress offers some functionality for implementing ...
3
votes
1answer
43 views

whitelist for textarea and save input to file

I'm working with product codes, so a user can only scan these type of product codes into a textarea. I don't know if my code is best way and good performance. I'm using a whitelist solution for ...
4
votes
1answer
215 views

Codeigniter 3 micro-blogging application

I am working on a basic blog application in Codeigniter 3.1.8 and Bootstrap 4. The application allows Registration (as an author), Login, adding Categories and Posts. I have created an installation ...
1
vote
0answers
42 views

correctly implement PHP OOP in blog Post Class [closed]

I would like to know the best way to setup my PHP Blog classes. I have created a Post class which creates a blog post. ...
4
votes
2answers
71 views

Building object identity in PHP

I am trying to build object identity in PHP so that when I have a collection of objects, each one can have a string as identifier and all of these identifiers are afterwards combined to form an unique ...
1
vote
2answers
30 views

Dynamically create table colmun into checkboxes

I have table which contains different permissions. Currently i am render all those permsion columns into check boxes manually. Like this ...
6
votes
3answers
224 views

Dynamically loading CSS files based on URL or URI in PHP

I have written out the following code in the head section of my document, which should load 3 separate style sheets for each page based on the URL/URI that the user is visiting. It is working as ...
4
votes
1answer
79 views

PHP program to generate random phone number

I created a PHP program to generate random phone numbers. A valid phone number: must be exactly 11 digits in length, and must start with any of the values mentioned in the ...
2
votes
0answers
47 views

Make Pagination using Ajax with Jquery, PHP [closed]

This is the first time that I have add (I mean, I try) Ajax with Jquery to PHP and Mysql (pagination). This is a link to the test page: testpage1 I think everything works, but is it done correctly? ...
1
vote
2answers
38 views

PHP unit test to confirm that a validator is being called correctly

I have a Responder class whose prepare method takes an entity, checks it with a validator, and returns a response or errorResponse based on the results of validator....
1
vote
1answer
39 views

App sends location data to website

Explaining the idea and first steps Today, I had the idea to do a website which displays my current position. I searched in the App Store for an App and found one named SendLocation. This App ...
5
votes
1answer
63 views

PHP program to validate phone numbers from a file

As part of job interview, I was asked to write a cli script that takes a list of phone numbers to validate from a file and as an option in the command line. It will then produce a CSV file with three ...
3
votes
1answer
47 views

Proper use of mysqli->close();

database.config.php ...
-3
votes
1answer
63 views

What would be the best way to accomplish this If-else check? [closed]

I have an if-else statement in a php class, which works perfectly. I want to know if there could be an any better or faster way to accomplish this? ...
0
votes
1answer
31 views

Filling in the card expiry date from transaction data

I'm integrating my app with a payment gateway, and have the following code which returns an array to populate the transaction info: ...
4
votes
1answer
158 views

PHP MVC render view method

I am working on creating a simple MVC inspired framework (for learning purposes and because i don't want to use a pre-existing framework at the moment). I have the system already set up and its ...
2
votes
0answers
17 views

Codeigniter 3 loading models in a different way

I'm currently building an application that uses the same models in different controllers. Instead of using the normal way, being loading the model in the controller I've build a "core controller" (<...
4
votes
1answer
84 views

PHP Login Class - Security and Efficiency Check

I'm hoping someone would be able to identify if my code is prone to SQL injections, and just overall see if there is anything that could be done better, faster or more efficiently Im very new to OOP ...
1
vote
1answer
38 views

Singly-linked queue in PHP 7 - follow-up

I have improved this post. Now I have this: ...
0
votes
1answer
29 views

Small project users privileges

I have small web application that need a users permissions system to access some content or add/edit it. I'm using roles given to a user to manage priviliges, and also a user custom ...
2
votes
1answer
62 views

PDO library to handle MySQL queries

This is my library class. This does not have any issues but I want to know if I have any mistakes, or ways to improve performance: variable and call (example of ...
3
votes
1answer
28 views

Singly-linked queue in PHP 7

I am learning PHP 7 and decided to implement a simple FIFO singly-linked queue in it: ...
1
vote
2answers
69 views

Simple PHP image upload with error handling

I wrote this method to upload a floor plan image: ...
1
vote
2answers
54 views

Inserting a user sign-up record using mysqli

My Code: Connectivity(php) ...
4
votes
2answers
44 views

Simple wiki with PHP, part two

Following up from part one, I've attempted to convert the largest part of my project into an MVC pattern as per suggestions from the accepted answer. I've managed to split the original ...
1
vote
0answers
21 views

PHP to cast votes on an open-to-public election

I am creating an online voting platform where users could vote on publicly-held polls. It uses Kreait Firebase library (as Google didn't create a PHP library for Firebase Admin). I am very new to PHP ...
1
vote
0answers
52 views

Check for key in two arrays in order to control flow of the program

I have a container. This container has exactly this structure: ...
0
votes
1answer
72 views

Simple wiki with PHP

I'm attempting to create a basic wiki for personal use. I've got a pretty good start, but the code is beginning to become cumbersome to modify, and some of the things I'm doing feel very fragile. I've ...
0
votes
2answers
54 views

Asynchronous query to load products from laravel controller

The following code works fine. When a user clicks on an element, an AJAX request is made, which will return the query result. The results are being displayed in a view. I read many articles where ...