Enhancing Virtual Intranet Server Full Doc(editing).docx

  • Uploaded by: Tharani Tharani
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Enhancing Virtual Intranet Server Full Doc(editing).docx as PDF for free.

More details

  • Words: 5,921
  • Pages: 56
ENHANCING VIRTUAL INTRANET SERVER PERFORMANCE IN OFFLINE AND ONLINE MODE

1.INTRODUCTION 1.1 ABSTRACT The data mining is the concept of retrieving the data in filtered formats. The data that have been extracted in all the high level and low level browser’s or search engine are using the concept of data mining for various process like listing information, filtering of information, related image, video and voice file, etc. In this paper, it is going to create a virtual Intranet server to store the data which have been browsed from the Internet for the first time, to increase the performance, efficiency, lowering cache storage, and reducing the Internet usage. The process is performed by retrieving the data by using the several filtering concepts by mapping the domain IP address from various web browsers. The lowering of cache is done by decreasing the storage to 1/10th of removing the cache at every even interval. The virtual browser is created and the data are filtered by using CPF algorithm. The information that is filtered using CPF algorithm has been stored in the local server of a LAN network. When the user surfs for the same information that has already been filtered, the browser brings the relevant data from the local server.

2. SYSTEM STUDY

2.1 INTRODUCTION

The domain name system (DNS) is a globally distributed database that maps names to network locations, thus, providing information critical to the operation of most Internet applications and services. As a global service, DNS must be highly scalable and offer good performance under high load. It is widely believed that two factors contribute to the scalability of DNS: hierarchical design around administratively delegated name

spaces, and the aggressive use of caching. Both factors seek to reduce the load on the root servers at the top of the name space hierarchy, while successful caching hopes to limit client-perceived delays and WAN bandwidth usage. The DNS name space is hierarchically organized so that sub domains can be locally administered.

In the past few years, the reputation of large-scale Internet communications services such as Yahoo, Google, and MSN has grown extremely. The scalability and availability requirements of these services have led to system architectures that diverge significantly from those of traditional systems like desktops, enterprise servers, or databases. In this section, it’s given a brief overview of the design of the Domain Name System (DNS) and how the different DNS components interact. It is also take a look at how DNS is being used today. DNS relies on a distributed database with a hierarchical structure. The root zone of the DNS system is centrally administered and serves its zone information via a collection of root servers. . At the end, each site is responsible for its own domain and maintains its own database containing its information and operates an authoritative name server. The whole database is usually queried by end-hosts using a local name server called caching resolver. For efficiency reasons DNS relies heavily on caching. All information that a name server delivers to a resolver is cached for a duration specified in the TTL field of the resource records (RR).

2.2 EXISTING SYSTEM

In existing method Extract, Transform and Load process can involves extracting the data from the source systems. In many cases this is the most challenging aspect of ETL, as extracting data correctly will set the stage for how subsequent processes will go. Most data warehousing projects consolidate data from different source systems. Each separate system may also use a different data organization/format. Common data source formats are relational databases and flat files, but may include non-relational database structures such as Information Management System (IMS) or other data structures such

as Virtual Storage Access Method (VSAM) or Indexed Sequential Access Method (ISAM), or even fetching from outside sources such as through web spidering or screenscraping. The streaming of the extracted data source and load on-the-fly to the destination database is another way of performing ETL when no intermediate data storage is required. In general, the goal of the extraction phase is to convert the data into a single format which is appropriate for transformation processing. An intrinsic part of the extraction involves the parsing of extracted data, resulting in a check if the data meets an expected pattern or structure. If not, the data may be rejected entirely or in part.

2.3 DISADVANTAGES •

High usage of internet while searching on the same keyword again and again.



Different search engine has been produced various link priorities.



Cannot surf without internet.



The data’s retrieve only for the Internet Server.

2.4 PROPOSED SYSTEM

Now a day the peoples are mostly used by the Google search engine. The search engine searches for and identifies items in a database that correspond to keywords or characters specified by the user, used especially for finding particular sites on the World Wide Web. Hence, any keywords has been searched on the Google and as well as Bing. It gets from many kinds of links. In that links may be the same or in different links appeared. In despite of we proposed the method as Searched keyword has been added with the define keyword and special quotes, it gets from lots of links are appeared. We have analyzed to compare the repeated links and stored by using the intranet server or local server. The user searches the same keyword again and again means the resultant links are retrieved in the local server not using the internet server. The resultant links are viewed

based upon the higher priority while searching on the same keyword for that any user. The lowering of cache is complete by shrinking the storage space to minimizing and erasing the cache at each even period. At last the user can view the URL’s priority graph.

2.5 ADVANTAGES: •

Fast surfing



Low usage of Internet while searching on offline with the saved data keywords.



Better results, analyzing and comparing with the Google and Bing search engines for the same keyword.



Fast retrieving data (links) from server.



Based on link (Urls) higher priority urls will be shown.



The data’s retrieve for using both Internet and Intranet server.



Generated for Link priority graph.

4.MODULE DESCRIPTION

4.1 LIST OF MODULES



Online browser mode module



IP filter module



Server storage module



Server login module



Offline browser module



Comparison between online and offline mode module

4.2 Module Description Online browser mode module

In this module the keyword to be searched is entered and searched. Immediately the keyword is been searched in three different browsers and three different formats and the top 30 results are been captured and the domain IP of the each website is been taken as the output of the first module. This module details are done using internet.

IP filter module In this module has been processed by IP filtering. IP filtering is simply a mechanism that decides which types of IP datagram’s will be processed normally and which will be discarded. By discarded we mean that the datagram is deleted and completely ignored, as if it had never been received.

Server storage module In this module, the data’s or link sets are stored into the Local server, after we clustering the data’s by using the search engines. The resultant data sets are stored into the particular local server. The Server provides for an additional storage for spacing.

Server login module In this module, gives security to the server by avoiding unauthorized access. The admin can only access to the server by giving their username and password. If it is not match means the error message will be shown.

Offline browser module In this module the data extraction is processed by the offline mode. Before that the data’s can stored into the local server. Then only the result will be shown. The data is not extracted directly from the source system but is staged explicitly outside the original source system. The data already has an existing structure (for example, redo logs, archive logs or transportable table spaces) or was created by an extraction routine.

Comparison between online and offline mode module

In this module, we compared both the online and offline mode browsing methods. Online browsing mode, the data’s is extracted to the Internet server only. Because the internet usage is very high and also the server is very delay processing. The offline mode, the data’s are extracted to the local server while the extracting the time no need to be used for the internet and the server has been very quick manner.

3.SYSTEM SPECIFICATION 3.1 HARDWARE REQUIREMENTS •

SYSTEM

: Dual Core



HARD DISK

: 160 GB



FLOPPY DRIVE

: 1.44 MB



MONITOR

: 15 VGA colour



MOUSE

: Logitech.



RAM

: 1GB



KEYBOARD

: 110 keys enhanced.

3.2 SOFTWARE REQUIREMENTS



Operating system

: Windows XP Professional



Front End

: PHP



Back End

: MY SQL

5.SOFTWARE DESCRIPTION

5.1 PHP PROGRAMMING

Basically, PHP allows a static webpage to become dynamic. "PHP" is an acronym that stands for "PHP: Hypertext Preprocessor". The word "Preprocessor" means that PHP makes changes before the HTML page is created. This enables developers to create powerful applications that can publish a blog, remotely control hardware, or run a

powerful website such as Wikipedia or Wikibooks. Of course, to accomplish something such as this, you need a database application such as MySQL.

PHP code can be simply mixed with HTML code, or it can be used in combination with various and web forms. PHP code is usually processed by a PHP interperter, which is usually implemented as a web server's native Module or a Common graphical interface (CGI) executable. After the PHP code is interpreted and executed, the web server sends resulting output to its client, usually in form of a part of the generated web page; for example, PHP code can generate a web page's HTML code, an image, or some other data. PHP has also evolved to include a command line interface (CLI) capability and can be used in Standalone graphical application

The canonical PHP interpreter, powered by the Zend Engine, is free software released under the PHP License. PHP has been widely ported and can be deployed on most web servers on almost every operating system and platform, free of charge. Despite its popularity, no written specification or standard existed for the PHP language until 2014, leaving the canonical PHP interpreter as a de facto standard. Since 2014, there is ongoing work on creating a formal PHP specification.

PHP/FI could be used to build simple, dynamic web application. Lerdorf initially announced the release of PHP/FI as "Personal Home Page Tools (PHP Tools) version 1.0" publicly to accelerate bug location and improve the code, on the Usenet discussion group on June 8, 1995. This release already had the basic functionality that PHP has as of 2013. This included Perl-like variables, form handling, and the ability to embed HTML. The syntax resembled that of Perl but was simpler, more limited and less consistent.

Early PHP was not intended to be a new programming language, and grew organically, with Lerdorf noting in retrospect: "I don’t know how to stop it, there was never any intent to write a programming language.I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way." A development team began to form and, after months of work and beta testing, officially released PHP/FI 2 in November 1997.

One criticism of PHP is that it was not originally designed, but instead it was developed organically; among other things, this has led to inconsistent naming of functions and inconsistent ordering of their parameters. In some cases, the function names were chosen to match the lower-level libraries which PHP was "wrapping", while in some very early versions of PHP the length of the function names was used internally as a hash function, so names were chosen to improve the distribution of hash values.

On May 22, 2000, PHP 4, powered by the Zend Engine 1.0, was released. As of August 2008 this branch reached version 4.4.9. PHP 4 is no longer under development nor will any security updates be released. On July 13, 2004, PHP 5 was released, powered by the new Zend Engine II. PHP 5 included new features such as improved support for object oriented programming, the PHP Data Objects (PDO) extension (which defines a lightweight and consistent interface for accessing databases), and numerous performance enhancements. In 2008 PHP 5 became the only stable version under development. Late static binding had been missing from PHP.

Many high-profile open-source projects ceased to support PHP 4 in new code as of February 5, 2008, because of the GoPHP5 initiative, provided by a consortium of PHP developers promoting the transition from PHP 4 to PHP 5.

Over time, PHP interpreters became available on most existing 32-bit and 64-bit operating systems, either by building them from the PHP source code, or by using pre-

built binaries. For the PHP versions 5.3 and 5.4, the only available Microsoft windows binary distributions were 32-bit x86 builds, requiring Windows 32-bit compatibility mode while using Internet Information system (IIS) on a 64-bit Windows platform. PHP version 5.5 made the 64-bit x86-64 builds available for Microsoft Windows.

5.2 MYSQL

The MySQL development project has made its source code available under the terms , as well as under a variety of proprietary agreements. MySQL was owned and sponsored by a single for-profit firm, the Swdish company MYSQL, now owned by Oracle corporation

For proprietary use, several paid editions are available, and offer additional functionality. Applications which use MySQL databases include: TYPO3, MODx, Joomla, Wordpress, phpBB, MyBB, Drupal and other software. MySQL is also used in many high-profile, large-scale webistes

Graphical

The official MYSQL Workbench is a free integrated environment developed by MySQL AB, that enables users to graphically administer MySQL databases and visually design database structures. MySQL Workbench replaces the previous package of software, MySQL GUI Tools. Similar to other third-party packages, but still considered the authoritative MySQL front end, MySQL Workbench lets users manage database design & modeling, SQL development and Database administration.

Third-party proprietary and free graphical administration applications are available that integrate with MySQL and enable users to work with database structure and data visually. Some well-known front ends, in alphabetical order, are: •

Adminer – a free MySQL front end written in one PHP script, capable of managing multiple databases, with many CSS skins available



Chive - a free, open source, web-based database management tool designed as an alternative to phpMyAdmin



DatabaseWorkbench – a software application for development and administration of multiple relational databases including MySQL, with interoperationality between different database systems



DBEdit – a free front end for MySQL and other databases



Navicat – a series of proprietary graphical database management applications, developed for Windows, Macintosh and Linux



Openoffice.org – freely available OpenOffice.org Base can manage MySQL databases if the entire suite is installed



phpMyAdmin– a free Web-based front-end, widely installed by web hosting services since it is developed in PHP and included in the LAMP stack, and MAMP, XAMPP and WAMPsoftware bundle installers



SQL buddy – a free Web-based front end, developed in PHP



SQLyog – proprietary, but there is also a free 'community' edition available



Toad for MySQL – a free development and administration front end for MySQL from Dell Software



Webmin – a free Web-based management utility and a MySQL front end, developed in Perl with some parts written in Java Command line MySQL ships with many command line tools, from which the main interface is 'mysql' client. Third parties have also developed tools to manage MySQL servers.



MySQL Utilities – a set of utilities designed to perform common maintenance and administrative tasks. Originally included as part of the MySQL Workbench, the utilities are now a stand-alone download available from Oracle.

Features MySQL is offered under two different editions: the open source MySQL Community Server and the proprietary Enterprise server. MySQL Enterprise Server is differentiated by a series of proprietary extensions which install as server plug-in, but otherwise shares the version numbering system and is built from the same code base. Major features as available in MySQL 5.6: •

A broad subset of ANSI SQL99, as well as extensions



Cross-platform support



Stored procedures, using a procedural language that closely adheres to SQL/PSM



Triggers



Cursors



Updatable views



Online DDL when using the InnoDB Storage Engine.



Information schema



Performance Schema



A set of SQL Mode options to control runtime behavior, including a strict mode to better adhere to SQL standards.



X/OpenXA (DTP) support; two phase commit as part of this, using the default InnoDB storage engine



Transactions with save points when using the default InnoDB Storage Engine. The NDB Cluster Storage Engine also supports transactions.



ACID compliance when using InnoDB and NDB Cluster Storage Engines



SSL support



Query caching



Sub-SELECTs



Built-in Replication support

with one master per slave, many slaves per master.

Multimaster replication is provided in MySQL Cluster, and multi-master support can be added to unclustered configurations using Galera Cluster.



Full-text indexing and searching



Embedded database library



Unicode support



Partitioned tables with pruning of partitions in optimizer



Shared-nothing clustering through MySQL cluster



Multiple storage engines, allowing one to choose the one that is most effective for each table in the application.



Native storage engines InnoDB, MyISAM, Merge, Memory , Federated, Archive, CSV, Black hole, NDB Cluster.



Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second. The developers release minor updates of the MySQL Server approximately every two months. The sources can be obtained from MySQL's website or from MySQL's Bazaar repository, both under the GPL license.

6.SYSTEM DESIGN AND DEVELOPMENT

6.1 INPUT DESIGN

Input design is the process of converting user-originated inputs to a computer-based format. Input design is one of the most expensive phases of the operation of computerized system and is often the major problem of a system. In the project, the input design is made in various web forms with various methods.For example, in the user creation form, the empty username and password is not allowed. The username if exists in the database, the input is considered to be invalid and is not accepted. Likewise, during the login process, the username is a must and must be available in the user list in the database. Then only login is allowed.

6.2 OUTPUT DESIGN Output design generally refers to the results and information that are generated by the system for many end-users; output is the main reason for developing the system and the basis on which they evaluate the usefulness of the application. In the project, the user details, search, are the web forms in which the output is available.

6.3 DATABASE DESIGN The database design is a must for any application developed especially more for the data store projects. Since the chatting method involves storing the message in the table and produced to the sender and receiver, proper handling of the table is a must. In the project, login table is designed to be unique in accepting the username and the length of the username and password should be greater than zero. The different users view the data in different format according to the privileges given.

6.4 FILE DESIGN A file system provides the machinery to support the project tasks. At the highest level a file system is a way to organize, store, retrieve, and manage information on a permanent storage medium such as a disk. File systems manage permanent storage and form an integral part of all operating systems. There are many different approaches to the task of managing permanent storage. At one end of the spectrum are simple file systems that impose enough restrictions to inconvenience users and make using the file system difficult. In deciding what type of filing system is appropriate for a particular operating system, we must weigh the needs of the problem with the other constraints of the project. The two basic abstractions of files and directories form the basis of what a file system can operate on. There are many operations that a file system can perform on files and directories. All file systems must provide some basic level of support. Beyond the most basic file system primitives lay other features, extensions, and more sophisticated operations. The Structure of a File is given the concept of a file, a file system may impose no structure on the file, or it may enforce a considerable amount of structure on the contents of the file. An unstructured, “raw” file, often referred to as a “stream of bytes,” literally has no structure. The file system simply records the size of the file and allows programs to read the bytes in any order or fashion that they desire. If a file system chooses to enforce a formal structure on files, it usually does so in the form of records. With the concept of records, a programmer specifies the size and format of the record, and then all I/O to that file must happen on record boundaries and be a multiple of the record length.

6.5 DATA FLOW DIAGRAM Level 0

6.6 ENTITY RELATIONSHIP DIAGRAM

SYSTEM ARCHITECTURE

6.7. Online Browser Architecture

Browser

Filter

IP extract

Local cache

Browser cache

6.8. Server Architecture

Browser cache

Local cache

Local server

Authentication

Offline mode

6.9. Offline Browser Architecture

User

Data search

Local server

Server cache

Offline mode data

7.TESTING 7.1 Introduction The most important phase in system development life cycle is system testing. The number and nature of errors in a newly designed system depends on the system specifications and the time frame given for the design. A newly designed system should have all the subsystems working together, but in reality each subsystems work independently. During this phase, all the subsystems are gathered into one pool and tested to determine whether it meets the user requirements. Testing is done at two level -Testing of individual modules and testing the entire system. During the system testing, the system is used experimentally to ensure that the software will run according to the specifications and in the way the user expects. Each test case is designed with the intent of finding errors in the way the system will process it. Testing plays a very critical role in determining the reliability and efficiency of software and hence is a very important stage in software development. Software testing is done at different levels. They are the unit testing and system testing which comprises of integration testing and acceptance testing.

7.2 TYPES OF TESTING Unit Testing This is the first level of testing. The different modules are tested against the specifications produced during the integration. This is done to test the internal logic of each module. Those resulting from the interaction between modules are initially avoided.

The input received and output generated is also tested to see whether it falls in the expected range of values. Unit testing is performed from the bottom up, starting with the smallest and lowest modules and proceeding one at a time.

The units in a system are the modules and routines that are assembled and integrated to perform a specific function. The programs are tested for correctness of logic applied and detection of errors in coding. Each of the modules was tested and errors are rectified. They were then found to function properly.

Integration Testing In integration testing, the tested modules are combined into sub-systems, which are then tested. The goal of integration testing to check whether the modules can be integrated properly emphasizing on the interfaces between modules. The different modules were linked together and integration testing done on them.

Validation Testing The objective of the validation test is to tell

the user about the validity and

reliability of the system. It verifies whether the system operates as specified and the integrity of important data is maintained. User motivation is very important for the successful performance of the system. All the modules were tested individually using both test data and live data. After each module was ascertained that it was working correctly and it had been "integrated" with the system. Again the system was tested as a whole. We hold the system tested with different types of users. The System Design, Data Flow Diagrams, procedures etc. were well documented so that the system can be easily maintained and upgraded by any computer professional at a later

System Testing

The integration of each module in the system is checked during this level of testing. The objective of system testing is to check if the software meets its requirements. System testing

is done to uncover errors that were not found in earlier tests. This

includes forced system failures and validation of total system as the user in the operational environment implements it. Under this testing, low volumes of transactions are generally based on live data. This volume is increased until the maximum level for each transactions type is reached. The total system is also tested for recovery after various major failures to ensure that no data are lost during the breakdown.

User Acceptance Testing The objective of the acceptance test is to tell

the user about the validity and

reliability of the system. It verifies whether the system operates as specified and the integrity of important data is maintained. User motivation is very important for the successful performance of the system. All the modules were tested individually using both test data and live data. After each module was ascertained that it was working correctly and it had been "integrated" with the system. Again the system was tested as a whole. We hold the system tested with different types of users. The System Design, Data Flow Diagrams, procedures etc. were well documented so that the system can be easily maintained and upgraded by any computer professional at a later

8.SYSTEM IMPLEMENTATION

Implementation is the process that actually yields the lowest-level system elements in the system hierarchy (system breakdown structure). The system elements are made, bought, or reused. Production involves the hardware fabrication processes of forming, removing, joining, and finishing; or the software realization processes of coding and testing; or the operational procedures development processes for operators' roles. If implementation involves a production process, a manufacturing system which uses the established technical and management processes may be required. The purpose of the implementation process is to design and create (or fabricate) a system element conforming to that element’s design properties and/or requirements. The element is constructed employing appropriate technologies and industry practices. This process bridges the system definition processes and the integration process. System Implementation is the stage in the project where the theoretical design is turned into a working system. The most critical stage is achieving a successful system

and in giving confidence on the new system for the user that it will work efficiently and effectively. The existing system was long time process. The proposed system was developed using PHP. The existing system caused long time transmission process but the system developed now has a very good user-friendly tool, which has a menu-based interface, graphical interface for the end user. After coding and testing, the project is to be installed on the necessary system. The executable file is to be created and loaded in the system. Again the code is tested in the installed system. Installing the developed code in system in the form of executable file is implementation.

11.CONCLUSION

We have presented an enhancement mechanism in intranet server for getting best results by combining Google and Bing search engine. We provided a mechanism to gather the most relevant results to user queries using CPF algorithm; In despite of we proposed the method as Searched keyword has been added with the define keyword and special quotes, it gets from lots of links are appeared. We have analyzed to compare the repeated links and stored by using the intranet server or local server. At last the user can view the URL’s priority graph. This system is user friendly so everyone can use easily. Proper documentation is provided. The end user can easily understand how the whole system is implemented by going through the documentation. The system is tested, implemented and the performance is found to be satisfactory. All necessary output is generated. Thus, the project is completed successfully.

12. SCOPE FOR FUTUREWORK

There is scope for future development of this project. The world of computer fields is not static; it is always subject to be dynamic. The technology which is famous today becomes outdated the very next day. To keep abstract of technical improvements, the system may be further refined. So, it is not concluded. Yet it will improve with further enhancements. Enhancements can be done in an efficient manner. In our future work we will implement our system with three search engines ( for eg Google, bing, yahoo).So that the user can obtain very best results .

13. BIBLIOGRAPHY AND REFERENCES

Textual Reference •

PHP book by Vasvani (TMH publications).



Beginning PHP5 by WROX.



Informatics practices by Sumita Arora.



Head First PHP & MySQL by Lynn Beighley and Michael Morrison(O’Reilly)



PHP Objects, Patterns, and Practice by Matt HYPERLINK "https://www.goodreads.com/author/show/79192.Matt_Zandstra"Zandstra



PHP and MySQL Web Development by Luke Welling



PHP Object-Oriented Solutions by David Powers



Modern PHP: New Features and Good Practice by Josh Lockhart



Learning PHP Design Patterns by William Sanders



PHP 5 Objects, Patterns, and Practice by Matt HYPERLINK "https://www.goodreads.com/author/show/79192.Matt_Zandstra"Zandstra



PHP for the Web: Visual HYPERLINK "https://www.goodreads.com/book/show/9683472-php-for-theweb"QuickStart HYPERLINK "https://www.goodreads.com/book/show/9683472-php-for-the-web" Guide by Larry Ullman

Online Reference: • • • • • •

www.wikipedia.com www.w3schools.com http://www.phpreferencebook.com/ http://www.tizag.com/phpT/ http://www.phpbuddy.com/ http://www.php.net/

9. SAMPLE

CODE

public function __construct($search_engine_id, $api_key) { $this->search_engine_id = $search_engine_id; $this->api_key = $api_key; }

/** * Sends search request to Google * * @param array params The parameters of the search request * @return object The raw results of the search request **/ private function request($params) { $params = array_merge( $params, [ 'key' => $this->api_key, 'cx' => $this->search_engine_id ] );

$context = stream_context_create([ 'http' => [ 'ignore_errors' => true ] ]);

return json_decode( file_get_contents('https://www.googleapis.com/customsearch/v1?' . http_build_query($params), false, $context)

); }

public function search($terms, $page=1, $per_page=10, $extra=[]) { // Google only allows 10 results at a time $per_page = ($per_page > 10) ? 10 : $per_page;

$params = [ 'q' => $terms, 'start' => (($page - 1) * $per_page) + 1, 'num' => $per_page ]; if (sizeof($extra)) { $params = array_merge($params, $extra); }

$response = $this->request($params);

if (isset($response->error)) { throw new \Exception($response->error->message); }

$request_info = $response->queries->request[0];

$results = new \stdClass(); $results->page = $page; $results->perPage = $per_page; $results->start = $request_info->startIndex; $results->end = ($request_info->startIndex + $request_info->count) - 1; $results->totalResults = $request_info->totalResults; $results->results = [];

if (isset($response->items)) { foreach ($response->items as $result) { $results->results[] = (object) [ 'title' => $result->title, 'snippet' => $result->snippet, 'htmlSnippet' => $result->htmlSnippet, 'link' => $result->link, 'image' => isset($result->pagemap->cse_image) ? $result->pagemap->cse_image[0]>src : '', 'thumbnail' => isset($result->pagemap->cse_thumbnail) ? $result->pagemap>cse_thumbnail[0]->src : '', ]; } }

return $results; }

}
$name=$_POST['uname']; $pass=$_POST['pass'];

$dbhost = 'localhost'; $dbuser = 'root'; $dbpass = ''; $conn = mysql_connect($dbhost, $dbuser, $dbpass);

mysql_select_db('search');

$result1 = mysql_query("SELECT * FROM user WHERE user_name = '".$name."' && user_pass = '".$pass."'");

if(mysql_num_rows($result1) > 0 ) { header('Location: dashboard.php'); } else { echo 'The username or password are incorrect!'; header('Location: index.php'); }

?>
header('Content-Type: application/json');

$data_points = array();

$dbhost = '172.16.20.21'; $dbuser = 'root'; $dbpass = 'redhat'; $db= 'search'; $conn = mysql_connect($dbhost, $dbuser, $dbpass);

$result = mysql_query("SELECT searc_id, DISTINCT query FROM search.cache where result='$src_key' LIMIT 1,4;");

while($row = mysql_fetch_array($result)) { $point = array("label" => $row['prob_equip_name'] , "y" => $row['rep_id']); array_push($data_points, $point); } echo json_encode($data_points, JSON_NUMERIC_CHECK); ?>


$key=$_GET['q']; $rs=get_result($key,$mysqli); //$rs=get_result("test",$mysqli); if($rs=="") { $bing=array(); $google=array();

$k=$_GET['q']; $response=fetch_from_bing($k); $bing=parse_from_bing($response,'b');

$myhtml=fetch_from_google($key); $google=parse_from_google($myhtml,'g');

$final=algorithm($google,$bing);

$response=fetch_from_bing('"'.$k.'"');

$bing=parse_from_bing($response,'B');

$final=algorithm($final,$bing);

$myhtml=fetch_from_google('"'.$key.'"'); $google=parse_from_google($myhtml,'G');

$final=algorithm($google,$final);

//put_result($key,urlencode(serialize($final)),$mysqli); put_result("test", "www.test.com", "jhello"); } else { $final=unserialize(urldecode($rs)); } echo "
"; echo "
"; echo ""; echo "
"; echo "
"; echo "
";

if($action=='result') for($i=0;$i<sizeof($final);$i++)

{

echo "
"; echo "
"; echo "".$final[$i][1].""; echo ""; echo "

".$final[$i][2]."

"; echo "
"; echo "
"; //echo "
"; } else if($action=='report') { echo "";

for($i=0;$i<sizeof($final);$i++) { $g=""; $G=""; $b=""; $B=""; if(strstr($final[$i][4],'g')) $g="";

if(strstr($final[$i][4],'b')) $b=""; if(strstr($final[$i][4],'G')) $G=""; if(strstr($final[$i][4],'B')) $B=""; echo ""; //echo "
"; } echo "
URLGoogleGoogle(Wildcard) BingBing(Wildcard)
".$final[$i][0]."
$g
$G
$b
$B
"; echo ""; } //echo substr($json,0,strlen($json)-1)."]}}})"; //DOMinnerHTML($original); //preg_match_all('@href=\"(.+?)\"@',$original,$matches,PREG_SET_ORDER); //print_r($matches); if(1==2){ if (stristr($original,"\"results\":[]")) { echo 'sorry '.$key." - did not match any documents.
Make sure all words are spelled correctly.
Try different keywords.
We'll add results according to this keyword very soon.."; }

else { $original=str_replace("\",\"","\"~\"",$original); $i=0; $str=""; while(strlen($original)>$i) { $count=0; if(substr($original,$i,3)=="[{\"") { $i=$i+3; $count=1; while(strlen($original)>$i) { if(substr($original,$i,2)=="[{") { while(substr($original,$i,2)!="}]" and (strlen($original)>$i)) { $i=$i+1; } } if(substr($original,$i,3)!="\"}]") { $str=$str."".substr($original,$i,1); }

else { if($count==1) { break 2; } else { $count=$count-1; $str=$str."".substr($original,$i,1); } } $i=$i+1; } } $i=$i+1; } $bstr=""; while(strlen($original)>$i) { $count=0; if(substr($original,$i,3)=="[{\"") { $i=$i+3; $count=1;

while(strlen($original)>$i) { if(substr($original,$i,2)=="[{") { while(substr($original,$i,2)!="}]" and (strlen($original)>$i)) { $i=$i+1; } } if(substr($original,$i,3)!="}],") { $bstr=$bstr."".substr($original,$i,1); } else { if($count==1) { break 2; } else { $count=$count-1; $str=$str."".substr($original,$i,1); } }

$i=$i+1; } } $i=$i+1; }

//echo $bstr; $str=str_replace("\u0026#39;","'",$str); $str=str_replace("\u0026quot;",'"',$str); $str=str_replace("\u200f","",$str); $str=str_replace("\u0026amp;","&",$str); $str=str_replace("\u0026gt;",">",$str); $str=str_replace("\u0026lt;","<",$str); $str=str_replace("\u003d","=",$str); $exstr=explode("},{",$str); $exstrsize=sizeof($exstr); for ($i=0;$i<$exstrsize;$i++) { //echo $exstr[$i]."

"; //echo "
"; $exstr1=explode("~",$exstr[$i]); $exstrsize1=sizeof($exstr1); for ($i1=0;$i1<$exstrsize1;$i1++) { if(substr(strtolower($exstr1[$i1]),1,3)=="url")

{ $url=substr($exstr1[$i1],7,strlen($exstr1[$i1])-8); $url=str_replace("\\u003c","<",$url); $url=str_replace("\\u003e",">",$url); $url=str_replace("%3F","?",$url); $url=str_replace("%3D","=",$url); $url=str_replace("%26","&",$url); } if(substr(strtolower($exstr1[$i1]),1,3)=="tit" and (substr(strtolower($exstr1[$i1]),1,7)!="titleno")) { $title=substr($exstr1[$i1],9,strlen($exstr1[$i1])-10); $title=str_replace("\\u003c","<",$title); $title=str_replace("\\u003e",">",$title); } if(substr(strtolower($exstr1[$i1]),1,3)=="con") { $content=substr($exstr1[$i1],11,strlen($exstr1[$i1])-12); $content=str_replace("\\u003c","<",$content); $content=str_replace("\\u003e",">",$content); } if(substr(strtolower($exstr1[$i1]),1,11)=="richsnippet") { break; } //echo $exstr1[$i1]."
";

} //echo $title; //echo "
"; //echo $content; //echo "
"; //echo $url; //echo "
"; echo '
'.'
'.$url.'

';

}

echo "
"; $exbstr=explode("},{",$bstr); $exbstrsize=sizeof($exbstr); for ($i=0;$i<$exbstrsize;$i++) { $stpt=$i+1; $stptc=$i*10; echo "$stpt "; } } echo "



 "; //$myhtml=file_get_contents("http://www.google.com/uds/GwebSearch?callback=google.searc h.WebSearch.RawCompletion&context=1&rsz=filtered_cse&hl=en&source=gcsc&gss=.com&sig=

1aa7ebf4e25e8274c7689c312b6585ed&cx=010214595516197562483:ziq2dh57qq&q=help&gl=www.google.com&qid=130ebaddc4a7df330&key=notsupplied&v=1.0", false); //echo $myhtml; } function algorithm($first,$second) { if(sizeof($first)<sizeof($second)) { $tmp=$first; $first=$second; $second=$tmp; } $final=array(); $f=0; for($i=0;$i<sizeof($first);$i++) for($j=0;$j<sizeof($second);$j++) if($first[$i][0]==$second[$j][0]) { //echo $first[$i][0]."
"; $final[$f]=$first[$i]; $final[$f][3]++; $final[$f][4]=$final[$f][4].$second[$f][4]; $f++; $first[$i][0]=""; $first[$i][1]=""; $first[$i][2]="";

$second[$j][0]=""; $second[$j][1]=""; $second[$j][2]=""; break; } for($i=0;$i<sizeof($first);$i++) { if($first[$i][0]!="") { //echo $first[$i][0]."
"; $final[$f]=$first[$i]; $f++; } if($second[$i][0]!="") { //echo $second[$i][0]."
"; $final[$f]=$second[$i]; $f++; } } //echo sizeof($first)."+".sizeof($second)."=".sizeof($final); return $final;

} function fetch_from_bing($k)

{ $query = urlencode("'{$k}'"); $process = curl_init("https://api.datamarket.azure.com/Bing/Search/Web?\$format=json&Query=$query") ; curl_setopt($process, CURLOPT_HTTPAUTH, CURLAUTH_BASIC); curl_setopt($process, CURLOPT_USERPWD, "G+JpLtFTuMJdOKt+7vrnMGQ6c636XhQay7RB0p6y3Ig:G+JpLtFTuMJdOKt+7vrnMGQ6c636XhQa y7RB0p6y3Ig"); curl_setopt($process, CURLOPT_TIMEOUT, 30); curl_setopt($process, CURLOPT_RETURNTRANSFER, TRUE); curl_setopt($process, CURLOPT_SSL_VERIFYPEER, false); $response = curl_exec($process); curl_close($process);

return $response; } function fetch_from_google($key) { $ch = curl_init(); $key=urlencode($key); //$proxy = "59.90.213.18:3128"; //curl_setopt($ch, CURLOPT_PROXY, $proxy); //curl_setopt($ch, CURLOPT_HTTPPROXYTUNNEL, 0); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (Windows NT 6.1; rv:5.0) Gecko/20100101 Firefox/1.0'); curl_setopt($ch, CURLOPT_FAILONERROR,true); curl_setopt($ch,CURLOPT_URL,"http://www.google.com/search?q=$key&tbs=rl:1,rls:0" ); $myhtml= curl_exec($ch); curl_close($ch); return $myhtml; } function parse_from_google($myhtml,$t) { $google=array(); $pattern[] = '/(.*?)<\\/table>/'; $replace[] = '';

$myhtml = preg_replace($pattern, $replace, $myhtml); $doc = new DOMDocument(); $doc->loadHTML($myhtml); $original=$doc->getElementById("ires"); $originalm= $doc->saveXML($original); //echo $original; //exit; $tit[10]; $url[10]; $dsc[10]; $dur[10];

$doc->loadHTML($originalm); //$original=$doc->getElementsByTagName("table"); //$i=0;

$original=$doc->getElementsByTagName("h3"); $i=0; foreach($original as $ori){ $fstspl=$doc->saveXML($ori); $doc1 = new DOMDocument(); $doc1->loadHTML($fstspl); $fstspl=$doc1->getElementsByTagName("a"); foreach($fstspl as $fstsp) { if (substr($fstsp->getAttribute('href'),0,4)=="/url") { $tmp=split("q=",$fstsp->getAttribute('href')); $tmp=split("&sa=",$tmp[1]); $google[$i][0]= $tmp[0]; $google[$i][1]= strip_tags($fstsp->nodeValue); $i=$i+1; } } } $i=0; $doc->loadHTML($originalm);

$original=$doc->getElementsByTagName("cite"); foreach($original as $ori){ $fstspl=$doc->saveXML($ori); $url[$i]= strip_tags($fstspl); $i=$i+1; } $i=0; $doc->loadHTML($originalm); $original=$doc->getElementsByTagName("span"); foreach($original as $ori){ if($ori->getAttribute('class')=='st') { $fstspl=$doc->saveXML($ori); $google[$i][2]= str_replace("\n","",strip_tags($fstspl)); $google[$i][3]=0; $google[$i][4]=$t; $i=$i+1; } } return $google; } function parse_from_bing($response,$t) { $bing=array(); $jsonObj = json_decode($response);

$i=0; $resultStr = ''; // Parse each result according to its metadata type. foreach($jsonObj->d->results as $value) { switch ($value->__metadata->type) { case 'WebResult': $bing[$i][0]=$value->Url; $bing[$i][1]=$value->Title; $bing[$i][2]=$value->Description;//}
{$value->DisplayUrl}
"; $bing[$i][3]=0; $bing[$i][4]=$t; } $i++; if($i==10)break; } return $bing; } ?>

Tables cache

save_url

user

9. SCREENSHOTS

Related Documents

Server Intranet
November 2019 14
Intranet
June 2020 11
Intranet
May 2020 15
Intranet
November 2019 20

More Documents from ""