sethupathy Posted June 9, 2007 Share Posted June 9, 2007 I am new to php so bear with me I have made my web form but my host is external i have two files one the form.php and connect.php on submit how do i make a request in my form.php to connect to my host on submit? do i have to inject php in my form.php how would the scrpit look like ??? It could be a silly question but i would love to get this done asap. :-\ Thank you Link to comment https://forums.phpfreaks.com/topic/54835-connecting-to-external-host/ Share on other sites More sharing options...
BK87 Posted June 9, 2007 Share Posted June 9, 2007 you can make a direct connect to the other host's sql database, just make sure the other server's database accepts your connection but setting up a user with the ip address of the original host. Link to comment https://forums.phpfreaks.com/topic/54835-connecting-to-external-host/#findComment-271224 Share on other sites More sharing options...
sethupathy Posted June 9, 2007 Author Share Posted June 9, 2007 could you be more clear , is there a way to to connect to the external host without any resquest made to the localhost of the page, i have all acsess to the external host i just need to know how do i input the script into my form.php Link to comment https://forums.phpfreaks.com/topic/54835-connecting-to-external-host/#findComment-271225 Share on other sites More sharing options...
BK87 Posted June 9, 2007 Share Posted June 9, 2007 you want this right... Website A: have form.php, connect.php Website B: has sql server? you need to have a connection from Website A to Website B. You can set up a connection if your using mysql server, you need to create a user on Website B, with recognizing IP/host address from Website A, make a script that will connect the Website B to Website A, then create a script that will insert the info from the form into the database... I'm an old programmer, I'd sketch this for you, but I'm kind of rusty. =) Link to comment https://forums.phpfreaks.com/topic/54835-connecting-to-external-host/#findComment-271228 Share on other sites More sharing options...
BK87 Posted June 9, 2007 Share Posted June 9, 2007 refer to... http://us.php.net/manual/en/function.mysql-select-db.php instead to connecting to localhost, connect to external host with designated address... Link to comment https://forums.phpfreaks.com/topic/54835-connecting-to-external-host/#findComment-271229 Share on other sites More sharing options...
sethupathy Posted June 9, 2007 Author Share Posted June 9, 2007 Thanks for the link if i use this script in my form.php would my extarnal server user and password be visible to anyone wouls it have any security flaw to the localhost? <?php $link = mysql_connect('localhost', 'mysql_user', 'mysql_password'); if (!$link) { die('Not connected : ' . mysql_error()); } // make foo the current db $db_selected = mysql_select_db('foo', $link); if (!$db_selected) { die ('Can\'t use foo : ' . mysql_error()); } ?> Link to comment https://forums.phpfreaks.com/topic/54835-connecting-to-external-host/#findComment-271231 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.