Jump to content

connecting to external host


sethupathy

Recommended Posts

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
Share on other sites

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
Share on other sites

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
Share on other sites

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
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.