Jump to content

Using githup to make php code opensource, keeping details of server secure


thehitechpanky

Recommended Posts

Hi Little Help Needed
I have created a new website
In the index.php file i want to show records from database

Now, here is how the problem arise
I want to import codes from github intead of hosting those files on my server because i want to keep it opensource

Below is the code I am using
<?php
// connect to the database
include('connect-db.php');

// get results from database
$sql = "SELECT id, upadhi, name FROM munishri";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
// output data of each row
while($row = $result->fetch_assoc()) {
echo "id: " . $row["id"]. " - Name: " . $row["upadhi"]. " " . $row["name"]. "<br>";
}
} else {
echo "0 results";
}

// close connection
$conn->close();
?>

Can i host the code to show result in another file and use something like
<?php
// connect to the database
include('connect-db.php');

// get results from database
include('http://rawgit.com/thehitechpanky/jainmunilocator/master/database.php');
?>

Link to comment
Share on other sites

...no.

 

First, open source is a concept - a license, really - not an implementation. You don't have to host your code on GitHub for it to be open source, and putting it on GitHub doesn't make it open source.

 

Second, GitHub and others are code repositories. You don't keep your code there and then try to run it from there. It's a place you can store your files on the internet. When you want to run them, you download them (in the case of GitHub, using git) and run them. Locally. You could just as well put the files in a .zip on an FTP server and download the code for all it matters.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.