PHP is a widely-used, general-purpose scripting language that is especially suited for web development.
2
votes
2answers
55 views
Checking a user's emails using an ID
I'm trying to do this:
Getting user's ID based on his email name.
Using that user_id to check all his emails that have been sent for him so far.
...
3
votes
1answer
35 views
Phishing Project Error Logging
Moving on to the next steps! Previous review was here. The idea here was to implement suggestions made by @hd/@Pimgd and then implement an effective way of tracking and logging results when an ...
6
votes
2answers
635 views
Phishing Project Assessment
Coming back for another look at my project after I've reworked a few of the key points made in my previous post here.
So far, I've rewritten most of my code to address SQL Injection. I've created a ...
0
votes
1answer
34 views
Accessing Models Directly Through AJAX [on hold]
I was thinking about how to handle AJAX requests in a MVC environment in PHP in a easy way.
What I've come up is (without showing you the backend code):
...
-1
votes
0answers
11 views
PHP mysqli always returning mysqli::bind_param() error [on hold]
I'm trying to save some data from my webpage to MYSQL database, but it returning a Call to a member function bind_param() on a non-object error every time. I tried ...
2
votes
2answers
44 views
PHP Authentication Form
Drafted this up today out of the need for a very simple php based login form to protect an html page.
The app is simply included the top of index.html like this:
<...
-4
votes
0answers
19 views
How can I avoid code repetition? [on hold]
I am new in php, and i have a problem with code repetition
...
3
votes
0answers
17 views
Create archive webpage for newsletters based on nested array
I am creating a webpage for my newsletter archives. The archives are divided by year (currently there is only 1, but there could be many), then by topic, before listing each newsletter. There will ...
0
votes
0answers
19 views
Laravel Unit Test for API
I'm currently building an API with Laravel 5 and I've written some unit (or integrated?) tests for it. I've been reading a little about unit test and how to not overdo it and I would like some input ...
4
votes
2answers
189 views
LDAP Login Script
This is my first time ever having code peer reviewed! This is just the main function I'm concerned about.
Edit
Apologies for the initial vagueness of my question, this is the "login" part of my ...
3
votes
1answer
31 views
PHP & AJAX CAESAR CIPHER ENCRYPTED chat script - Slow in performance
I have made an attempt to make a chat script and its working as required but the problem is that it is slow on slower connections and sometimes even on fast connections. Sometimes while loading the ...
1
vote
0answers
23 views
Export database values as csv with a helper class
Should I be using getter and setter functions in my class nodeStruct?
I am currently using them where there is need to manipulate the input value (e.g for ...
3
votes
1answer
75 views
Is this PHP code vulnerable to some attack? [duplicate]
So I've made a PHP code for a login form. But i am not sure if this code was that safe, because i am not a security expert.
I am using PDO statements in my code, here's my code :
...
3
votes
1answer
59 views
Very basic PHP session handling
I’ve got my first real PHP web application up and running. It is working as expected, but being my first time, I’m sure there is plenty of room for improvement.
Right now, there is one particular ...
1
vote
1answer
38 views
Preventing XSS in a Symfony form to add a timetable entry
I have started to implement cross site scripting prevention (xss) within my code.
However as I am using symfony for this particular project I have read up that nothing needs to be done for xss in ...
0
votes
1answer
54 views
PHP login form with PDO
I create login form with session with four files:
connection.php
login.php
plan.php
logout.php
Please check my code and tell about any smokestack.
Database educate (create table users)
...
1
vote
2answers
44 views
Finding a word with the most occurrences of a character
I am new to PHP development. So Kindly, review my code and guide me make it better/optimize. Currently, it works well with inputs that I have tried.
...
-3
votes
0answers
26 views
A PHP backend framework [closed]
I just finished writing my own backend framework and am looking for a bit of feedback. It uses an MVC pattern and I wrote it because I couldn't find a framework that does, out of the box, what Pixull ...
1
vote
0answers
29 views
Printing many-to-many relationships in an HTML/bootstrap table
I need to print the many-to-many relation ship in my tablet. However, I don't know what to do for my case: I tried tons of ideas, however, I may have done something wrong because nothing worked.
Here ...
2
votes
1answer
31 views
PHP upload script might be vulnerable
I have written a basic PHP upload script a few years ago and recently I discovered some phishing html pages in the website's root.
This website is located in /www/sitename, while I upload the files ...
2
votes
1answer
59 views
Simple login page
Could anyone tell me if this code is well written and if it has bugs / vulnerabilities?
class.user.php:
...
0
votes
1answer
23 views
Single endpoint for ingoing mail with multiple purposes
The following code is not one of my proud moments. In its initial state, I had only a single purpose, but know I'm up to three purposes and I don't know if it would stop there.
I'm using mailin.io to ...
2
votes
4answers
51 views
PHP mysqli code for login form
Can you check my code if I wrote like a professional?
connection page.
form sign page.
plan page.
log out page.
First I create the database and tables, then the connection file, then the form sign ...
0
votes
0answers
8 views
php - strpos vs preg_match - memory and resource differences [migrated]
There have been questions asking which is faster strpos or preg_match, but I'm interested which in knowing which uses the least memory and CPU resources.
I want to check a line for one of 5 matches:
...
1
vote
1answer
25 views
Database connection in MVC model
I followed the tutorial Build a PHP MVC Application and have implemented a database connection. I made a seperate database connection class and I call it in the controller.
It works, but now I have ...
6
votes
1answer
143 views
Phishing application God class
This project is ultimately my senior thesis to graduate from college. It will end up being very long with several code reviews and redesigns. The next rubberduck perhaps?
I've been working on a ...
0
votes
0answers
37 views
2
votes
2answers
41 views
Get all members from each group
I have a table of groups, and a table of members. Each member belongs to one group. This is how it looks (more groups then 2 are possible):
Groups
...
2
votes
2answers
67 views
Setting up a database class
I am wondering the best way to setup a database class, to remove repeat code by using OOP. This way if I changed how I connect to the database (switch from PDO to sqlsrv driver) I can just change it ...
3
votes
1answer
108 views
PHP Image size recalculation function
I got a function to recalculate the image size based on two settings.
Force ratio, force the requested ratio, default the original ratio will be used.
Keepsmaller, the uploaded image may never ...
2
votes
1answer
50 views
PHP TCP socket server
I created a PHP script which will be running 24/7 as a TCP socket server and will send data from the DB back to clients. The code is working, and so far, I see no problems.
However, I can only test ...
1
vote
3answers
65 views
Selecting a table with multiple ID on MySQL using PHP PDO
I have made a MySQL script to query a table with a set of id using an IN clause and after some reading I found out that there are security issues with it like prone ...
6
votes
3answers
57 views
Running a MySQL query with an admin class
This is my admin class, DB class and how I use OOP.
I am looking for ways to improve my code to make better use of OOP. Please help me if you think I can improve my code in some way.
db.class.php
<...
1
vote
2answers
43 views
Method to get user information (OOP / MVC approach)
I coded a small user script with PHP. I'm improving the script, learning from my mistakes. I recently learned about object oriented programming and wrote 2 big god classes (user class and message ...
0
votes
1answer
39 views
2
votes
1answer
125 views
PHP web crawler
I'm working on a "nice" crawler that start with one URL, and find the other URLs to process each page, a kind of "Google" crawler, to index pages.
I worked hard on this crawler to respect many points ...
3
votes
1answer
53 views
Simple PHP MVC framework
I recently wrote this PHP MVC framework. Would like your review.
index.php
...
2
votes
1answer
24 views
Database query with Eloquent
I have got two tables articles and tags in the database. My goal was to retrieve all fields from articles table and one category field from tags table with Eloquent. I couldn't do this so instead I ...
0
votes
2answers
55 views
PHP MySQL connection class
I'm trying to build a class that connects to the database. It does the job but it is not very elegant. I also have no understanding of singleton class or dependency injection.
Is this safe? Can you ...
1
vote
3answers
42 views
Building session array from post to build search query
So I am making post requests to a page for search queries. I am turning them into a session array so I can paginate the results. The process kind of feels ugly and long winded. I need code review for ...
2
votes
1answer
38 views
Managing PostgreSQL transactions for concurrency
I have a situation where I need to use PostgreSQL's serializable isolation level for transactions. This is for a table shared among multiple concurrent PHP processes. If the database runs into any ...
3
votes
1answer
54 views
PHP Login/cookie authentication
I have an authetication api for an intranet site but I'm a little worried that my design of the authentication is bad and unsafe.
Below is the basic part of the authetication process and I hope I can ...
-1
votes
3answers
93 views
Is it good to have a method accepting an array of keys to return it's values? Does it break OOP concepts?
Here is my ValueObject example class. I wrote this example for my OOP research. I know I could use ArrayAccess interface but I am curious abobut feedbacks about this class. Does it break OOP concepts? ...
1
vote
1answer
91 views
3
votes
2answers
61 views
Checking the status of a website by hitting a PHP script
I currently have a system which loops through a bunch of my website domains and checks their status and sends me a notification letting me know if they are up or down. The stripped down version of the ...
3
votes
1answer
83 views
More efficient method to check for duplicate database entries?
I am saving company information in a database, and if repeat information is found, I want to update the overlapping rows. Some of the supported fields are emails, phone numbers, organization names, ...
2
votes
1answer
31 views
Create JSON file from WordPress ACF options
I am using a WordPress multisite network and want to pull information from options pages in Advanced Custom Fields to create a json file. I currently have this code running whenever an options field ...
1
vote
0answers
35 views
PHP how to build html in class
I am used to procedural PHP. However, I have a piece of code that needs to be repeated a lot. I was thinking of trying my hand at creating a class. All is going well and it is working, but I think ...
0
votes
2answers
48 views
PHP program which extracts attribute lists from custom tag
PHP program which extracts attribute list from the custom tag. It also strips out the single and double quote if it exists around attribute value.
...
0
votes
2answers
65 views
Logging in with multiple types of info
I'm trying to let users log in with multiple columns (e.g. ID, email, phone). If one fails, it checks the next column.
I would like to minimise my if and ...