oke, ime new here and hope ime posting this correct .
Ime Dj on some internet radio stations and to show the playlist each DJ got each got to upload e config and DBconfig PHP file containing the person his ip.
This got to be done every time before e DJ go on air.
As most will know e IP is not e common thing for most users and it changes alot.
I seem to spend hours /week helping other DJ changing there IP in the PHP files and was really wondering if there is no possibility to make such e File automatic with e simple script or something.
This is the code in the file
$sam["host"] = "00.000.00.000"; //The IP address of the machine SAM is running on this is the line where The IP should go in
Add users IP address into a PHP file automatically
» PHP Forum Archive » General Web Development Forum
The most popular forum posts:
Comments / discussions
Sorry maybe I see this to easy but how about:
$sam["host"] = $_SERVER['REMOTE_ADDR']
Yes that would indeed be te easy :)
Maybe i didnt make it clear before each person is running e program that streams music and data(playlist) to the server , program used = Sam Broadcaster with MYSQL server.
and what is your problem?
The problem is , now We need to check ip and when it changed we need to change it into the config and the DBconfig file each time before we upload it to the server , on 1 radio station there is 15 DJ and on the other there is 11 , wich makes i got to lookup ip and change it for 26 dj atleast 2X month.
What ime looking for is e way or script or whatever is helping to make so that the ip go into the config and dbconfig file automatic , i cant figure out how to atach e file inhere or i would post it also :)
I got NO knowledge of PHP what so ever so ime not even sure if its possible with PHP or if i need to look at it another way :)
This server VAR will change with every user (if they are on different IP locations)
just replace the manual value with variable
So do this means there is no script ??
Quote from: Duck
"So do this means there is no script ??"
The problem is that we didn't understand each other ;)
the variable I mentioned will show the users IP address (check this on your office and home PC)
Using this variable you should be able to store the users IP address.
Example on this forum, each post logs the user IP address, this happens just by calling the variable.
like i did say , i dont know nothing about PHP could you plz explain how to add varaible :)
<?
/* ## ======================================== ## */
$commonpath = "./common";
//Station general details
$station = "";
$email = "email@mailbox.com";
$logo = "images/logo.gif";
$stationid = 0; //The ID of your registered station on AudioRealm.com
$sam["host"] ="00.000.000.000"; //The IP address of the machine SAM is running on (DO NOT use a local IP address like 127.0.0.1 or 192.x.x.x)
$sam["port"] = "1221"; //The port SAM handles HTTP requests on. Usually 1221.
//General options
$privaterequests = true; //If False, AudioRealm.com will handle the requests
$showtoprequests = true; //Must we show the top 10 requests on the now playing page?
$requestdays = 30; //Show the top10 requests for the last xx days
$showpic = false; //Must we show pictures in now playing section?
$picture_dir = "pictures/"; //Directory where all your album pictures are stored
$picture_na = $picture_dir."na.gif"; //Use this picture if the song has no picture
//Row colors used
$darkrow = "transparent";
$lightrow = "transparent";
/* ## ======================================== ## */
require_once("common/form.php");
require_once("common/db.php");
require_once("common/functions.php");
// Load EGPCS vars into globals (emulates register_globals = On in php.ini)
if (!empty($HTTP_ENV_VARS)) while(list($name, $value) = each($HTTP_ENV_VARS)) $$name = $value;
if (!empty($HTTP_GET_VARS)) while(list($name, $value) = each($HTTP_GET_VARS)) $$name = $value;
if (!empty($HTTP_POST_VARS)) while(list($name, $value) = each($HTTP_POST_VARS)) $$name = $value;
if (!empty($HTTP_COOKIE_VARS)) while(list($name, $value) = each($HTTP_COOKIE_VARS)) $$name = $value;
if (!empty($HTTP_SERVER_VARS)) while(list($name, $value) = each($HTTP_SERVER_VARS)) $$name = $value;
$db = new DBTable();
//Your REMOTE MySQL database login details
//IMPORTANT: This is the database login details for the database located on the WEBSERVER.
$db->ReadXMLConfig("dbconfig.xml.php");
//Your LOCAL MySQL database login details
//This is the login details the webserver will use to contact the local database on the SAM Broadcaster server.
//This is only used for making dedications from the request window.
//$db->ReadXMLConfig("samdb.xml.php");
$samlogin = $db->login; //In most cases the remote database will be the same as the local database.
//Finally connect to the database
$db->connect();
?>