Jump to content

External Reading Of Information In A MySQL


DukeOfMarshall

Recommended Posts

My MySQL is 4.1.22.

 

I'm trying to setup up something with PHP right now to read something from one of my MySQL databases in order to retrieve certain information. Eventually I will be doing it with a .NET application.

 

My server informed me that I can allow access to certain IP addresses or all IP addresses, but I don't want to do ALL IP addresses because of the obvious securtiy risks and I can't set it to a certain IP address because my clients are going to be from varying IP addresses.

 

All I need to do is have a simple script that will read a few pieces of information from the database externally. I've never done external before so that's why I'm needing some advice. Any help would be greatly appreciated.

 

Here's what I've tried so far, but the server keeps rejecting access.

 

**test.php

<?

global $t;

$t = "828-555-5555";

include("http://test.dukeofmarshall.com/call.php");

 

echo $name."<BR>";

echo $denomination."<BR>";

echo $address."<BR>";

echo $city.", ".$state." ".$zip."<BR>";

echo $phone."<BR>";

echo $email."<BR>";

?>

 

**call.php

<?

global $name;

global $denomination;

global $address;

global $city;

global $state;

global $zip;

global $phone;

global $email;

 

    mysql_connect("localhost", "$USERNAME", "$PASSWORD") or die(mysql_error());

mysql_select_db("$DATABASE") or die(mysql_error());

 

$find = mysql_query("SELECT * FROM churches WHERE phone='$t'") or die(mysql_error());

 

while($row = mysql_fetch_array($find)){

$name = $row['name'];

$denomination = $row['denomination'];

$address = $row['address'];

$city = $row['city'];

$state = $row['state'];

$zip = $row['zip'];

$phone = $row['phone'];

$email = $row['email'];

}

}

?>

Link to comment
Share on other sites

I may be going about this the wrong way. What I need to do is go from a random point and get a variable from a specified server. What I'm thinking about doing now is to write a script on the random point that passes a static piece of information to the specific server and then have the server query the database and return a specific piece of information to the random point.

 

Here's the complete story if it helps to clarify. I have a client that is producing a video encoding box to sell to churches that will allow the church to stream live video, record the sermon, and then upload the recorded video to a hosting server. The box is completely automated. Very little user interaction will be needed. What I have to do is develop a database that stores all the customer information and also stores the IP address to the current hosting server to which the box needs to upload the video when it's done recording. The hosting server will more than likely change depending on how much space the customer is using and of course the bandwidth. What I'm looking for is a way for the customer's encoding box to query my database and find out the IP address for the hosting server for that day. There will be thousands of boxes sold and there's no way to determine the IP address of all the customers. So I need to have a process where the encoding box passes the customer identifier to the server and then have the server return the IP address for uploading for that day. My client will be programming the encoding box in either ASP or .NET. He hasn't decided yet.

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.