Results 1 to 17 of 17
-
04-19-2004, 09:10 AM #1Web Hosting Master
- Join Date
- May 2002
- Posts
- 638
can I retrieve a value from a mysqldb without opening the db first?
I am writing an affiliate program whereby the affiliate can simply copy and paste a code on his website and that code will automatically retrieve the value of my plans from my db automatically.
I want this because should i change my plans' prices, my affiliates will not need to do any updating of their website as the prices are retrieved from my db.
what language is suitable for this purpose? php possible?
php requires us to open the mysqldb first right? it wouldn't be smart to let outsiders know your mysqldb username and password, so any other solution?
-
04-19-2004, 09:22 AM #2WHT Addict
- Join Date
- Apr 2004
- Posts
- 104
you could create a script in php that queries your database on each page load. we did something similar for a client where we created a textads script that he has people run ads on their websites. each time a page is loaded on the client website, it queries OUR client's database for teh correct ad info and updates it accordingly.. so what you wanna do is fairly simple.... I could write the code for you, for a price, or you might be able to find something on a script search...
Bri!Last edited by trukfixer; 04-19-2004 at 09:29 AM.
-
04-19-2004, 10:54 AM #3Web Hosting Master
- Join Date
- May 2002
- Posts
- 638
but before you can query the db, you need to open the db right?
and to open the db, you need to add the username and password in your code right? this is the prob.
-
04-19-2004, 11:03 AM #4WHT Addict
- Join Date
- Apr 2004
- Posts
- 104
Yeah but that isnt a problem, no one has to know your user name and password. it's set up in a configuration file that no one ever sees. no one will need to know anything other than enough html to copy and paste the html code you give them to run on their website..
everything else would be handled on your website, provided your webhosting can manage php and mysql...
not a problem.
the scripts themselves would be about 2,000 lines of code more or less, which would run on your server under your control. the only thing your affiliates would need is a block of html code to insert into their webpages (about 10 lines of html more or less) and would have ZERO access to any sensitive information..
-
04-19-2004, 02:56 PM #5WHT Addict
- Join Date
- Oct 2003
- Posts
- 124
You could also just create a new user with its own password and grant read access only to the data you specify. See GRANT:
http://dev.mysql.com/doc/mysql/en/GRANT.html
-
04-19-2004, 03:01 PM #6WHT Addict
- Join Date
- Aug 2003
- Location
- PA
- Posts
- 110
These work...you could also...
Everytime you update your plans, have a script to update a text file in you ftp part of your site, or a text file anywhere really. The included script for external site would simple open that file in and print out the data through the browser. This way, no one at all externally can be on the db.
As far as external entry no way is safe, even having a site at all on the net But, that is something you can use without at thrills through the grant priveledges. Would be basic and wouldn't hurt, as those users couldn't do anything to the data anyhow...via insert,update,delete or dump calls, as you would limit them to one table with only select priveledges.
Anyhow, the post was just another suggestion
Take care.
-
04-19-2004, 06:57 PM #7Junior Guru
- Join Date
- Sep 2003
- Location
- London, UK
- Posts
- 188
Why not have a js that can be pulled off your server. The same sort of thing as google adsense.
Rob Johnston | LucidUK.com | Rob@LucidUK.com
Who is Rob? boobear.co.uk
MSN: msn@luciduk.com | AIM: rob at lucid
-
04-19-2004, 11:47 PM #8WHT Addict
- Join Date
- Aug 2003
- Location
- PA
- Posts
- 110
...and the ideas keep coming. I forgot about that too lucid!
-
04-21-2004, 01:16 AM #9Web Hosting Master
- Join Date
- May 2002
- Posts
- 638
Originally posted by lucid
Why not have a js that can be pulled off your server. The same sort of thing as google adsense.
-
04-21-2004, 06:18 AM #10WHT Addict
- Join Date
- Sep 2003
- Posts
- 126
Originally posted by lobaloba9
yes. THis is exactly the solution i am looking for. do you know of any online resources that might be able to help me with this?
For example make this html document:
<html>
<head>
<title>Untitled</title>
</head>
<body>
<hr>
<script type="text/javascript" src="i.js">
</script>
<hr>
</body>
</html>
document.write("<b> This is great </b> <br>")
document.write("<b> and so is this </b> <br>")
There is another, related, method ... you can just declare a bunch of javascript variable in the script which can then be refered to elsewhere in the HTML leaving the the layout completely open for your affiliates.
Of course this does require that your affiliates' website visitors have js enabled browsers.
HTH,
Mike
-
04-24-2004, 03:25 AM #11Web Hosting Master
- Join Date
- May 2002
- Posts
- 638
foogee, your method requires the js file to be in the same directory as the html code. this way, i cannot retrieve generate the data in the js file.
the solution i'm looking for as follows:
- affiliate copy and paste html/js code in his website.
- that code will remotely retrieve prices from my msyql db
- hence, everytime i change the prices, the affiliate need not make any change to the code since the prices will be retrieved from my db.
-
04-24-2004, 06:30 AM #12Junior Guru
- Join Date
- Sep 2003
- Location
- London, UK
- Posts
- 188
ofcourse the file doesn't have to be called .js, it can ba a .php which reads the db then outputs document.write('stuff from db');
Rob Johnston | LucidUK.com | Rob@LucidUK.com
Who is Rob? boobear.co.uk
MSN: msn@luciduk.com | AIM: rob at lucid
-
04-24-2004, 01:56 PM #13Web Hosting Master
- Join Date
- May 2002
- Posts
- 638
yes. i know you can use php to read the db and output document.write('stuff from db').
However, that "document.write('stuff from db')" will be in the js file right?
and that js file will be stored in my website directory right?
in that case, how can my affiliate call out to this js file since it is not in the same directory as his html code?
-
04-24-2004, 02:17 PM #14WHT Addict
- Join Date
- Sep 2003
- Posts
- 126
Originally posted by lobaloba9
foogee, your method requires the js file to be in the same directory as the html code.
This is how nearly all affilate ad systems work including google.
Regards,
Mike
-
04-24-2004, 05:35 PM #15Junior Guru
- Join Date
- May 2003
- Location
- Bayreuth, Bavaria, Germany
- Posts
- 175
another possibility to realize this would be xml-rpc or SOAP ...
just my 2 euro-cents
Michael
-
04-24-2004, 06:38 PM #16Junior Guru
- Join Date
- Sep 2003
- Location
- London, UK
- Posts
- 188
just to confirm you could have...
affiliate's html;
Code:<script type="text/javascript" src="http://myhostingdomain.com/i.php">
PHP Code:echo "document.write(\'".$stuff_from_db."\')";
Rob Johnston | LucidUK.com | Rob@LucidUK.com
Who is Rob? boobear.co.uk
MSN: msn@luciduk.com | AIM: rob at lucid
-
04-25-2004, 05:58 AM #17Web Hosting Master
- Join Date
- May 2002
- Posts
- 638
Originally posted by lucid
just to confirm you could have...
affiliate's html;
Code:<script type="text/javascript" src="http://myhostingdomain.com/i.php">
PHP Code:echo "document.write(\'".$stuff_from_db."\')";
thanks everyone for your input!