-
Need Help!
Hi Guys,
Im making a sort of Autohits/Traffic Exchange Program.
With a timer that goes from 10 to 0
when i gets to 0, i want to show a random website
(i have insertet Active X MS webbrowser) for that.
So i was thinking people could register their website, on a webpage, and store the info in a database.
Is it possible for MMf2 to retrieve the websites that has been added to the database, and randomly show them in the Active X ms browser in Mmf2?
If not, any other ideas?
Every idea is welcome!
Thx
-
Re: Need Help!
The thing is, i just want people to be able to add their website,
and then show a random website in mmf2.
Im just not sure how or where to begin.
-
Re: Need Help!
So User 1 would add www.example.com and then User 2 would have that in their database? Or is this for use on a single computer.
-
Re: Need Help!
i was thinking, when a user enters my aplication. They would be able to add their website link "www.mywebsite.com", to a database (on my webserver) or a text file. or similar.
And then my aplication will get all the added websites in the database, text file or so, and display them randomly in the application. In the ActiveX Webbrowser.
Or something like that.
-
Re: Need Help!
OK Thalamus here's what you do:
1) Make a PHP file with a register and list script.
2) Use the Live Receiver object to POST and GET this information.
3) Make a list object and populate it with the contents of the list script in your PHP file.
4) Set the webpage to List Line Text$( "List", random(List Nb Lines( "List" )))
5) Voilą!
-
Re: Need Help!
whoa..
That sounds like a very good aproach!
Only thing im unsure of, is that php file, can you make an example of that?
Thank you very much for the help.
Much apreciated!
Im just thinking the data insertet on the php, should be saved somewhere?
in a txt file or a database? i would think
-
Re: Need Help!
I recommend you use a webserver database. Here's a sample PHP file you could use. It might be hard to read, but bear with me.
PHP Code:
<?php
// Put your server information below
$host = "host.server.com";
$user = "username";
$pass = "password";
$db = "database_name";
// This is all of the other featured stuff. You can edit this at will. Just be careful.
$conn = mysql_connect($host, $user, $pass) or die("Error connecting to database.");
mysql_select_db($db);
$type = $_GET['type'];
if ($type = "post") {
$site = $_GET['site'];
$sql = "INSERT INTO table (website) VALUES ('$site')";
mysql_query($sql) or die("Add Website Failed. MySQL Failure.");
$sql = "FLUSH PRIVELEGES";
mysql_query($sql) or die("Flush Priveleges Failed.");
echo "Successfully Added!";
} else if ($type = "get") {
$sql = "SELECT * FROM table";
$result = mysql_query($sql);
while ($row = mysql_fetch_array($result)) {
echo "{$row['website']},";
}
}
?>
OK, to list all of the websites you need the String Tokenizer Object, the Live Receiver Object, and the List Object. First you want to use the Live Receiver object to GET the webpage name with ?type=get at the end. Like this: http://www.example.com/file.php?type=get
Then you want to use Split String on the String Tokenizer Object, and choose "Get Received Data" under the Live Receiver icon. Set the delimiter to ",".
Then you want to select your ActiveX Browser and Navigate to the page:
Element$( "String tokenizer", random(ElementCount( "String tokenizer" )))
OK, that's how you get the list. To post you would simply make a form using an edit box and a button. You would then set:
On Button Pressed: Live Receiver: Start Download (POST): "http://www.example.com/file.php?type=post&site="+Edittext$( "Edit Box" )
The information will submit automatically. If the item has been added successfully, the web page will return "Successfully Added!"
*Phew* Well I think that was pretty thorough.
-
Re: Need Help!
Thats amazing.
This seems to work like a charm.
Thank you very much for the help!
The only part i need, is that post/add website php form/script.
Could you give an example of that too?
I hope im not asking too much.
But im really learning something new here! :-)
-
Re: Need Help!
It seems it has a problem adding a site.
I tried this in my normal explorer browser:
http://www.qbo.dk/qbo.php?type=post&site=www.lalal.dk
Feel free to test it.
But it gives an error:
Add Website Failed. MySQL Failure.
And theres nothing added in the Database.
-
Re: Need Help!
This is how my script looks in mmf2 now.
Image: qbo