Jump to content

Connecting to site THEN database.(not through localhost)


DamienRoche

Recommended Posts

I am having huge trouble trying to connect to my website through php, then to my database.

 

The database is easy to connect to but I can't figure out how to connect to my website.

 

The reason I'm doing this is because I am looking to protect from sql injection in my forms but the no_escape function seems to be requiring me to connect to my website first. Am I going about it the wrong way?

 

Thanks,

 

Damien.

I am having huge trouble trying to connect to my website through php, then to my database.

 

The database is easy to connect to but I can't figure out how to connect to my website.

 

The reason I'm doing this is because I am looking to protect from sql injection in my forms but the no_escape function seems to be requiring me to connect to my website first. Am I going about it the wrong way?

 

Thanks,

 

Damien.

 

What do you mean by connecting to your website through PHP??

 

 

What do you mean by connecting to your website through PHP??

 

Like when you connect to a database, you connect to localhost. Well I want to connect to my website, but not through the localhost command. Like through an ip. Thing is, if I am connect from elsewhere, then surely I will have to provide login details of the website and NOT the database.

 

I'm totally confused  ???

 

I'm totally confused   ???

 

Dude lol ! I wanna help you out but you are making me LMAO..

I'm with d.shankar on this...... Your also making me laugh and confusing me ???

 

Are you on about actually putting files to your website? You'll need FTP to do that (If thats what your on about)?

 

I'm totally confused  ???

 

Dude lol ! I wanna help you out but you are making me LMAO..

I'm with d.shankar on this...... Your also making me laugh and confusing me ???

 

Are you on about actually putting files to your website? You'll need FTP to do that (If thats what your on about)?

 

Sorry guys, I'm having a hard time explaining it. I just don't understand what I'm talking about lol.

 

Here goes.You know like you connect to a database like this:

 

 

$DBhost = "localhost";

$DBuser = "wwwdami_new";

$DBpass = "new";

$DBName = "wwwdami_new";

 

 

Is there a similar function to connect to a site:

 

$host = "45.153.4778:45" //dummy ip.

$siteuser = ;

$sitepass = ;

 

If that is a stupid question. How about this. I am trying to use mysql_real_escape_string but I don't have the right privileges. It keeps asking me to connect to the host...I can connect to the database..

 

I hope someone can decipher my ramblings.

 

Thanks.

by connecting to a "site", you mean connecting to a mysql server on some differnt machine (your server).

 

for that you can use IP as host and username and pass word of MYSQL on your server.

 

Although on your mysql server you will have to add entry in the hosts table in mysql database of the IP of the server you are connecting from. then only it will allow to connect.

 

hope this is what you want..:)

well,

 

if its on a shared hosting account, then by default you can only connect on a local host, but the hosting provider let's you have remote connection also.

 

if your hosting provider offers you cpanel then do the following:

 

1) log into cpanel

2) click on "mySQL databases"

3) scroll down to "access hosts"

4) either type in your IP address or type in with wildcards such as "%" (be warned of the wildcards though if you set it as all wildcards anyone can hacked your mySQL database)

 

enjoy!!

 

Archived

This topic is now archived and is closed to further replies.

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