Coder Social home page Coder Social logo

yongeshi / in-ur-area Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 0.0 157 KB

A fun backend-focused website that allows you to search for information on nearby restaurants with the ability to create an account and login to save your favorite restaurants.

Home Page: https://in-ur-area.herokuapp.com/index.php

PHP 95.52% Hack 0.06% CSS 0.41% JavaScript 4.01%
yelp-api google-maps-api php jquery mysql-database

in-ur-area's Introduction

InUrArea

Login and search for nearby restaurants with ease. My website uses Yelp’s database to get information on the restaurants and saves the information in a database when requested. This website is for people who want to be able to search for restaurants and save restaurants for future reference. It is an alternative to Yelp and features a super minimalistic and easy to navigate design.

Some of the features implemented:
-a navbar/header on the top with logo/home which will redirect you back to the home page and login/logout.
-After logging in, you will be able to see favorites. This is where your saved restaurants will appear.
-On the homepage, you can search for restaurants by name and location as well as an option to sort the results. You can either enter your location with latitude/longitude or a button to the right called “Set Location” where a map will pop up (centered on the US), and you can click on any location on the map and it will populate the latitude/longitude for you.
-After searching, it will bring you to the search results page where you can search again on the top. If you click on the picture of a restaurant on the search results page, it will pull up a more detailed page of the restaurant with more information about the restaurant and an option to add it to your favorites list.

I used a Yelp API for information on the restaurants. It can be found in yelp_backend.php and yelp.js. I also used a Google API so people can use Google Maps to set a location when searching for a restaurant. This can be found on index.php line 301, via the “Set Location” button.

Yelp API: https://www.yelp.com/developers/documentation/v3/business_search
Google API: https://developers.google.com/maps/documentation/javascript/overview

Backend: Database structure:

image

Where the database is used:
-In details.php line 632, after pressing the “Add to Favorites” button it makes an ajax call to add_favorite.php which inserts the restaurant in the Restaurants table and inserts into FavoriteRestaurants with the user’s ID.
-In favorites.php line 5-25, on page load, if there is data in the tables, It will display the restaurants added to your favorites.
-In details.php, the add to favorites/remove from favorites, will update/remove the existing restaurants and then delete/insert into the FavoriteRestaurants table.
-In details.php line 613, after pressing the “Remove from Favorites” button it deletes/removes the restaurant in the Restaurants table and removes from FavoriteRestaurants with the user’s ID.

Installing and Running on Your Machine:
These are PHP files and will not open like standard HTML files. If you wish to open the files, you can download MAMP which is free and easy to download. MAMP will not compromise any existing Apache installation already running on your system. For the database, you can download the .sql file provided above (restaurant_database.sql). I also used MySQL which provided a nice looking GUI.

In order to connect to your local database, change the information in config.php (username, pass, etc) with your DB credentials.

Demo/view:
https://in-ur-area.herokuapp.com/index.php

in-ur-area's People

Contributors

yongeshi avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.