Skip to main content

Posts

Showing posts with the label php

How the PHP MVC pattern works and how requests are processed within a PHP framework

 H ow the PHP MVC pattern works and how requests are processed within a PHP framework. While I can't watch the video directly, I can certainly explain the concept based on your description. In the context of a PHP MVC (Model-View-Controller) framework, here's a general explanation of how the request handling process works: Initial Request Handling: When a user makes a request to your web application, the request is usually directed to a single entry point, often referred to as index.php located in the "public" directory of your project. This entry point is responsible for initializing the framework and kicking off the request-handling process. Front Controller Pattern: The index.php file acts as a front controller, meaning that all incoming requests are directed to this single entry point. This is a common architectural pattern in web development. The front controller's responsibility is to analyze the incoming request, decide which controller should handle it, ...

OOP concept in php

Abstraction Abstraction is the key concept in OOP language. Its main goal is to handle the complexity by hiding the unnecessary details from the user. What does it mean. We drive car? Yes. For driving car is we need to know how engine works, how gear box works and how music system work? No, because these are very complex things to understand. It the mechanical engineer/ technician duty to deal with them. For end-user perspective user/driver have to focus on how to drive car / How to shift gear and how to play music using control panel. Now come in programming/coding terminology It is  high level  representation of  object and concept of what is doing rather than how it doing. In simple words abstraction help you create a simpler and easy representation of  something complex.  Let say we want to build system to manage different types of vahicle Now all vahicle a have some common characteristics like branding, manufacturer and also have specific characteristics, p...

Prepared statements, form submission, form validation and displaying errors in php

PHP Code. Insert statement Query. INSERT INTO `users`(`user_id`, `user_first`, `user_last`, `user_email`, `user_uid`, `user_pwd`) VALUES (1,'Adnan','Zaib','text@.com','Admin',1234) What are Prepared statements and how to use them //Created a sql prepare template $sql = "SELECT * FROM users WHERE user_uid=?;"; //than send to database with certain values left(unspecified parameters). //Create a prepared statement $stmt = mysqli_stmt_init($conn);   //prepare the prepared statement if(!mysqli_stmt_prepare($stmt, $sql)){ echo "sql statement failed"; }else{ //bind values to parameters and further to placeholder mysqli_stmt_bind_param(#stmt, "s",); // ‘s’ stands for datatype of parameter that you are going to pass. }   while($row = mysqli_fetch_assoc($result)){ echo $row['user_uid'] . "<br>"; } PHP form Validation   <?php // define variables and set to empty values $name = $email = $gender = $comment = ...

install and updrage php on Oracle and on CentOS 8 Linux

  ==================Upgrade php Video lisk https://www.youtube.com/watch?v=bHTv0FmvrTo DNF package manager guid for installing and enabling the php https://techglimpse.com/install-php-centos-stream/ DNF DNF is a software package manager that installs, updates, and removes packages on Fedora and is the successor to YUM (Yellow-Dog Updater Modified). DNF makes it easy to maintain packages by automatically checking for dependencies and determines the actions required to install packages. https://docs.fedoraproject.org/en-US/quick-docs/dnf/ What is remi repo ? Remi repo is a free and stable YUM repository mainly for the PHP stack. It contains packages for the latest versions of PHP. This article describes how to use Remi repo on CentOS 5/6/7 Install guide for php latest version (any version) Step 1: Enable remi-release-8.rpm Configure the  Remi repository  for installing PHP 8 on CentOS 8 # dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm Step 2: Enable EPE...

Send email in php "without less secure" restriction

 => https://www.youtube.com/watch?v=Kjn5vBbBsi8 (less secure link) https://www.youtube.com/watch?v=dNTZ8X9Xk_Q&t=259s https://www.thapatechnical.com/2020/03/how-to-send-mail-from-localhost-xampp.html LARAVEL env file setup for gmail configuration MAIL_DRIVER=smtp MAIL_HOST=smtp.gmail.com MAIL_PORT=465 MAIL_USERNAME=exampleEmail@gmail.com MAIL_PASSWORD=yourAppPassword MAIL_ENCRYPTION=ssl MAIL_FROM_ADDRESS=exampleEmail@gmail.com MAIL_FROM_NAME="Adnan Zaib" Note: for TLS use Port : 587 for SSL use Port : 465