Sunday, 11 June 2023

Advanve PHP-Part2

 

Q2) Attempt any Four of the following. [4×4=16]

 

1.     Explain features of Joomal/Drupal.

 

Joomla is a content management tool that allows users to create and maintain a web-based application or a website using GUI operations without writing the codes.

 

  •  Management of Content: It helps create and publish content on the web browser. The posted articles can be organized in any way the user wants; it supports WYSIWYG type of content creation, where you can see how it will look before it goes online.
  • User Management: Joomla supports the creation of multiple user accounts. These accounts have multiple user levels, so only an Admin can drastically change the site. Joomla supports OpenID, Gmail, and LDAP for authentication too.
  • Media Manager: Media Manager in Joomla allows users to skip using FTP to upload media to the site. Folders can be created to categorize the content of the media better. This media can then be embedded into the pages for easy viewing without having to be downloaded by the visitor.
  • Supports for Templates: Templates in Joomla are essential in defining your site’s appearance. You can get templates from third parties, too, and once added to the site; you can apply a template sitewide or just for one section of the site.
  • Banner Management: It supports setting up banners and other ads. Once configured, you can do several clicks, impressions and set up any special URLs if you need to.
  • RSS: RSS stands for Rich Site Summary, allowing visitors to subscribe to your website and see if there is new content on the site from an RSS Reader. It has full support for burning feeds for users and integrating feeds to post the same content on the website.

         Advantages

1.     This is easy to install and set up. You will have a much easier time than installing something like Drupal.

2.     It supports the installation of plugins to extend its feature set. You can set up both paid and free plugins from the Official Joomla repository or any of the many Joomla plugin sites.

3.     It has excellent user control options enabling you to allow or disallow site features for users.

4.     Updating the CMS does not require any special software or digging through code.

5.     These have easy options to create hierarchies so you can navigate the site easily, even if It has thousands of pages.

Disadvantages

1.     Getting to grips with Joomla is more complex than WordPress, Vix, or Blogspot.

2.     Adding more and more modules and templates increases the load on your server resources, impacting its efficiency.

3.     Compared to WordPress, the number of plugins for Joomla is low; to add insult to injury, you will find that while there may be a free WordPress plugin for your task, the Joomla counterpart is paid.

4.     It may have some plugin compatibility issues. If you face one with your site, you must spend time with the PHP code to solve it.

5.     This is the second most used CMS in the world, making it an easy target for automated attacks on websites.

 

2.     What is SOAP? Explain in detail.

 

SOAP stands for Simple Object Access Protocol is a network platform used in a web service to exchange or communicate data between two different machines on a network. It uses the XML format of data to transfer messages over the HTTP protocol. In Web services, SOAP allows the user request to interact with other programming languages. In this way, it provides a way to communicate between applications running on different platforms (Operating system), with programming languages and technologies used in web service.

  

Characteristics of SOAP

  • It is an open standard protocol used in the web service to communicate via internet.
  • It is used to broadcast a message over the network.
  • It is used to call remote procedures and exchange documents.
  • It can be used on any platform and can support multi-languages. So, it is a platform and language independent.
  • It uses the XML format to send messages over the HTTP protocol.
  • The structure of a SOAP message consists of an envelope, header, and body element.

SOAP Building Block

o    The SOAP building block describes what XML data is sent to the web service and client application. The following diagram represents the SOAP building block.



o    SOAP Envelope: Envelope is used to define the start and end of the SOAP message. It contains the details of the SOAP message. It is an important element of the XML documents.

o    SOAP Header: It is an optional element in which the header contains the credentials information such as authorization, authentication, etc. is used during the processing of a SOAP message.

o    SOAP Body: It is an important element of the SOAP message that contains request and response information in the XML format. It defines the actual content of the message to be sent between the client and the webserver.

o    SOAP Fault: The SOAP Fault element is an optional element used to display an error message encountered during the transmission of a SOAP message. It holds the status of SOAP messages and errors.

 

3.     Explain XML MVC framework.

 

MVC is a software architectural pattern for implementing user interfaces on computers. It divides a given application into three interconnected parts. This is done to separate internal representations of information from the ways information is presented to, and accepted from the user.

  • MVC stands for "Model view And Controller".
  • The main aim of MVC Architecture is to separate the Business logic & Application data from the USER interface.
  • Different types of Architectures are available. These are 3-tier Architecture, N-tier Architecture, MVC Architecture, etc.
  • The main advantage of Architecture is Reusability, Security and Increasing the performance of Application.

o    Model: Database operation such as fetch data or update data etc.

o    View: End-user GUI through which user can interact with system, i.e., HTML, CSS.

o    Controller: Contain Business logic and provide a link between model and view.

 

 

4.     Difference between GET and POST method.

 

GET vs POST Method in PHP

GET is a method that sends information by appending them to the page request.

POST is a method that transfers information via HTTP header.

URL

The form information is visible in the URL

The form information is not visible in the URL

Information Amount

Limited amount of information is sent. It is less than 1500 characters.

Unlimited amount of information is sent.

  Usage

Helps to send non-sensitive data

Helps to send sensitive data (passwords), binary data (word documents, images)and uploading files

Security

Not very secure.

More secure.

Bookmarking the Page

Possible to bookmark the page

Not possible to bookmark the page

 

5.     How to create object in PHP? Explain with example.

 

      Objects of a class are created using the new keyword.

 

<?php
class Fruit {
  // Properties
  public $name;

  public $color;

  // Methods
  function set_name($name) {

    $this->name = $name;
  }
  function get_name() {
    return $this->name;
  }
}

$apple = new Fruit();
$banana = new Fruit();
$apple->set_name('Apple');
$banana->set_name('Banana');

echo $apple->get_name();
echo "<br>";
echo $banana->get_name();
?>
    

 

  

6.     Write a simple PHP program which implements AJAX for addition of two numbers.

 

<?php
$n1=$_GET['num1'];
$n2=$_GET['num2'];
$add=$n1+$n2;
echo "Addition Is:" .$add;
?>


<html>
<head>
<script type="text/javascript">
function Addition()
{
var ob=false;
ob=new XMLHttpRequest();
var no1=document.getElementById("no1").value;
var no2=document.getElementById("no2").value;
ob.open("GET","Que24.php?num1="+no1+"&num2="+no2);
ob.send();
ob.onreadystatechange=function()
{
if(ob.readyState==4 && ob.status==200)
document.getElementById("add").innerHTML=ob.responseText;
}
}
</script>
</head>
<body>
Enter 1st No :<input type=text id="no1">
Enter 2nd no:<input type=text id="no2">
<input type=button name=submit value=add onClick="Addition()">
<span id="add"></span>
<body>
</html>

 

7.     Explain class and object with example.

 

·    Class − This is a programmer-defined data type, which includes local functions as well as local data. You can think of a class as a template for making many instances of the same kind (or class) of object.

·         Object − An individual instance of the data structure defined by a class. You define a class once and then make many objects that belong to it. Objects are also known as instance.

<?php
class Fruit {
  // Properties
  public $name;

  public $color;

  // Methods
  function set_name($name) {

    $this->name = $name;
  }
  function get_name() {
    return $this->name;
  }
}

$apple = new Fruit();
$banana = new Fruit();
$apple->set_name('Apple');
$banana->set_name('Banana');

echo $apple->get_name();
echo "<br>";
echo $banana->get_name();
?>
    

  

8.     Explain with example how to connect database using PHP and Ajax.

 

AJAX can be used for interactive communication with a database.

https://bcapractical2017.blogspot.com/2022/05/advance-php-slip7b-project-pgroup-no.html