unidox Posted May 12, 2007 Share Posted May 12, 2007 I need some help. I have an admin panel, and I like it, however I dont want to give my script out. So I was just wondering how I set my panel up so I add a domain, which has their own mysql files on it, and can login on the panel and edit their site without having to have the files on their webserver, and just mine. Quote Link to comment Share on other sites More sharing options...
neel_basu Posted May 12, 2007 Share Posted May 12, 2007 So I was just wondering how I set my panel up so I add a domain, which has their own mysql files on it, and can login on the panel and edit their site without having to have the files on their webserver, and just mine. I am confused and didn't understand. If you want to access another MySQL Server on another domain use mysql_connect('other-domain.com', 'user_name', 'Password') Quote Link to comment Share on other sites More sharing options...
chigley Posted May 12, 2007 Share Posted May 12, 2007 Yes you can just use: <?php $conn = mysql_connect("1.1.1.1", "user", "pass"); ?> But you may need to alter the MySQL settings on the remote server to allow the server you're running the site on to access the database remotely. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 12, 2007 Author Share Posted May 12, 2007 Would I put it in my admin panel script or what? how do u make it connect to many databases and edit only the one that is logged in Quote Link to comment Share on other sites More sharing options...
unidox Posted May 13, 2007 Author Share Posted May 13, 2007 is there no way to do that? Quote Link to comment Share on other sites More sharing options...
PC Nerd Posted May 13, 2007 Share Posted May 13, 2007 i sort of need to do the same thing ,but through visual basic ( thats another story) what my host says is that you either need a static IP, and they can allow that through their firewall, or ican use SSH tunneling please dont ask what either mean, i havent really looked into either, but though tthose things might help you with your site. good luck Quote Link to comment Share on other sites More sharing options...
unidox Posted May 13, 2007 Author Share Posted May 13, 2007 Thanks, but thats not really what i am looking for. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 13, 2007 Author Share Posted May 13, 2007 Anyone? Quote Link to comment Share on other sites More sharing options...
unidox Posted May 14, 2007 Author Share Posted May 14, 2007 bump Quote Link to comment Share on other sites More sharing options...
unidox Posted May 16, 2007 Author Share Posted May 16, 2007 example? Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 bump Quote Link to comment Share on other sites More sharing options...
hitman6003 Posted May 24, 2007 Share Posted May 24, 2007 $conn1 = mysql_connect("1.1.1.1", "user", "pass"); $conn2 = mysql_connect("2.2.2.2", "user", "pass"); $query = "SELECT * FROM table1"; $results_from_conn1 = mysql_query($query, $conn1); $results_from_conn2 = mysql_query($query, $conn2); Same query, two different servers, presumably two different results. You can connect to as many database servers as your php server has resources for (each connection does take memory and such), and you can query each one independently in the same script. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 how do I set it up on the other end. They will have the sql info Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 hello? Quote Link to comment Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 how do I set it up on the other end. The user needs to login and give themselves permission to login from your domain. Something like... GRANT ALL PRIVILEGES ON *.* TO username@yourdomain.com IDENTIFIED BY "password"; There are serious security issues involved with what you are wanting to do. There is no way I would grant access permissions from someone elses domain. This makes it alot easier for you to break into there db. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 I dont get it. What I need is for my domain to hold the script. Then they goto my site and login to the admin panel. Then they can edit thir site. My admin panel only changes the sql. There server will have the non admin files like index.php and they will also have the sql on their server. Quote Link to comment Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 I understand what you want to do. But you need to grant permissions on there database server to allow a connection to be made to it from your domain. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 I dont get what you would have to grant. I will have the sql user pass and server. Thats all mine has now. Quote Link to comment Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 Thats all mine has now. No its not. By default, you also have permissions to connect from localhost. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 Yea, I use localhost. So all I have to do is $conn1 = mysql_connect("1.1.1.1", "user", "pass"); $conn2 = mysql_connect("2.2.2.2", "user", "pass"); $query = "SELECT * FROM table1"; $results_from_conn1 = mysql_query($query, $conn1); $results_from_conn2 = mysql_query($query, $conn2); but what is table1? Quote Link to comment Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 but what is table1? This code is an example. $query = "SELECT * FROM table1"; And this is an example of how to select all data from a table called table1. Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 So how do I make table1? Quote Link to comment Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 So how do I make table1? This has nothing to do with your original question, but anyway... to make a table called table1 you would run a query such as.... CREATE TABLE table1; Quote Link to comment Share on other sites More sharing options...
unidox Posted May 24, 2007 Author Share Posted May 24, 2007 Oh lmfao. A sql table. Ok I will try when I get home Quote Link to comment Share on other sites More sharing options...
trq Posted May 24, 2007 Share Posted May 24, 2007 I will try when I get home Try what? This example... <?php $conn1 = mysql_connect("1.1.1.1", "user", "pass"); $conn2 = mysql_connect("2.2.2.2", "user", "pass"); $query = "SELECT * FROM table1"; $results_from_conn1 = mysql_query($query, $conn1); $results_from_conn2 = mysql_query($query, $conn2); ?> simply shows how to connect to two different database servers and run the same query on each. You still need to make sure both mysql servers (1.1.1.1 and 2.2.2.2) allow a connection to be made from your domain. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.