The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hi, (I'll try this again, this time in the right forum :nervous
![]() Please forgive my newbie question, but is using mysql_connect from vb to insert info into a second database a security risk? Is using the database name, user name and password safe from those viewing the forum? Thanks, still Larning. Is this question too difficult, or too retarded? |
|
#2
|
||||
|
||||
|
hmm, actually i don't really understand where there should be an issue.
vb makes a connecten to a db, but that is totally isolated from a second connection, so if you write your scripts carefully, a second db connection is no security risk |
|
#3
|
|||
|
|||
|
Thank you for replying Xenon.
I simply do not know much about database connections, so am unsure as to the correct way of connecting 2 databases. Would the following constitute a safe connection? Code:
//connecting to second database
$dbtest = @mysql_connect("host","name","pass",true) or die ("no connection possible");
mysql_select_db("database",$dbtest) or die ("no db");
$a = mysql_query("
SELECT something
FROM " . TABLE_PREFIX . "sometable
");
while ($row = mysql_fetch_assoc($a))
{
foreach ($row as $field_name => $field_value)
echo $field_name . " : " .$field_value;
}
mysql_close($dbtest);
Thanks in advance. |
|
#4
|
||||
|
||||
|
from what i see, there is no security problem in the code, just two things to think about:
1) vb3.5 allows a second connection set up from within config.php afaik, which could make things a bit easier for you 2) are you sure you need TABLE_PREFIX in your query, as you are connecting to a second db, no the vb one, that could produce an error. as for the security again: yep that's ok, as noone could directly view into the php files and see the pw
|
|
#5
|
|||
|
|||
|
It's only a security risk if injection is possible such that the username/password/database/server/query can be read/altered. As for performance, that depends on how MySQL is set up.
|
|
#6
|
||||
|
||||
|
Quote:
|
|
#7
|
|||
|
|||
|
This is great stuff.
Thanks guys, I do appreciate your replies and info. At least Im on the right track and my learning curve can now continue / expand. Cheers. |
|
#8
|
||||
|
||||
|
Quote:
seem si have to look at that feature again. couldn't test it as locally i just have one and never saw a need for it
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|