82 posts
Posted 21 February 2013 - 07:01 AM
Hi I was wanting to make websites and email programs and other everyday use of internet applications. I went on to realise computer IDS can be hard to remember 123 1 3 which one? So i thought about programming a DNS server, which would receive a message:
Email: rugbyguy99
message: Hi
The Idea would be that the dns server would receive this message and look in its directory for rugbyguy99. It would then say ah rugbyguy99 the id is 5 and then send the message to computer with ID 5. Does this make sense?
Any help would be appreciated
1214 posts
Location
The Sammich Kingdom
Posted 21 February 2013 - 07:37 AM
You could of have a table of all ID's that have their index set to the name. So something like this is pretty basic:
for k,v in pairs(rs.getSides()) do
rednet.open(v)
end
ids = {
["helloWorld"] = 1,
["bob"] = 3,
["mansion"] = 500
}
while true do
id, msg = rednet.receive()
for k,v in pairs(ids) do
if tonumber(msg) == k then
rednet.send(id, v)
print("Sent: "..v.." the ID for "..k)
end
end
end
It is basic but it works.
2088 posts
Location
South Africa
Posted 21 February 2013 - 07:37 AM
Can't you use a MySQL database to keep this information. The CC computer can then retrieve information from a website which connects to the database of the information, returning the id
1214 posts
Location
The Sammich Kingdom
Posted 21 February 2013 - 07:39 AM
Can't you use a MySQL database to keep this information. The CC computer can then retrieve information from a website which connects to the database of the information, returning the id
I doubt he has a spare web server around. I believe his intent was to do this all in-game.
Also, Ninja'd :ph34r:/>
82 posts
Posted 21 February 2013 - 07:40 AM
Ah perfect. This is exactly what i wanted! I edited the basic roaming profiles password lock posted on the computercraft website though it didnt seem to work. Thanks alot!
2088 posts
Location
South Africa
Posted 21 February 2013 - 07:41 AM
Can't you use a MySQL database to keep this information. The CC computer can then retrieve information from a website which connects to the database of the information, returning the id
I doubt he has a spare web server around. I believe his intent was to do this all in-game.
Also, Ninja'd :ph34r:/>
He could use a free webhoster, EG 000webhost (supports php, I use it and it's awesome)
You could of have a table of all ID's that have their index set to the name. So something like this is pretty basic:
for k,v in pairs(rs.getSides()) do
rednet.open(v)
end
ids = {
["helloWorld"] = 1,
["bob"] = 3,
["mansion"] = 500
}
while true do
id, msg = rednet.receive()
for k,v in pairs(ids) do
if tonumber(msg) == k then
rednet.send(id, v)
print("Sent: "..v.." the ID for "..k)
end
end
end
It is basic but it works.
Well hmm please do tell me if it really works - why are you tonumbering msg and then checking if it's equal to a STRING? :P/>
1214 posts
Location
The Sammich Kingdom
Posted 21 February 2013 - 07:44 AM
Well hmm please do tell me if it really works - why are you tonumbering msg and then checking if it's equal to a STRING? :P/>
Well I was pretty tired. Don't tonumber the string :P/> I meant to tostring the ID when I sent it back.
2088 posts
Location
South Africa
Posted 21 February 2013 - 07:46 AM
Yeah common mistake really… it's funny that every time someone makes a mistake their excuse is 'i was tired' xD
But yeah he was talking about DNS servers so I thought of websites ^^
82 posts
Posted 21 February 2013 - 07:53 AM
Thank you! Do any of you know much about GPS?
1214 posts
Location
The Sammich Kingdom
Posted 21 February 2013 - 07:55 AM
Thank you! Do any of you know much about GPS?
Check the tutorials section for some tutorials on it.
2217 posts
Location
3232235883
Posted 21 February 2013 - 07:55 AM
i do
82 posts
Posted 21 February 2013 - 07:58 AM
82 posts
Posted 21 February 2013 - 09:56 AM
Hi only testing it now. I programmed it to say error if it didnt work and it said error 3 times. Whats wrong is it my send/receive program i dont know how to upload it to show. Is there any basics i should be looking at to change to match the dns program?
1214 posts
Location
The Sammich Kingdom
Posted 21 February 2013 - 10:01 AM
Hi only testing it now. I programmed it to say error if it didnt work and it said error 3 times. Whats wrong is it my send/receive program i dont know how to upload it to show. Is there any basics i should be looking at to change to match the dns program?
Not sure what you mean.
82 posts
Posted 21 February 2013 - 10:06 AM
Can someone post a compatible email program?
1214 posts
Location
The Sammich Kingdom
Posted 21 February 2013 - 10:11 AM
Can someone post a compatible email program?
We are not going to code for you. There are plenty scripts on the forums to do what you want. We are just here to help people.
2088 posts
Location
South Africa
Posted 21 February 2013 - 05:28 PM
Rednet email program or web-based email program? Maybe try the programs section
82 posts
Posted 22 February 2013 - 06:29 AM
thanks! its a new way of coding for me you know the dns server thing. Are there any main points i should have in my email set-up like different paramentors?
82 posts
Posted 23 February 2013 - 08:21 AM
2217 posts
Location
3232235883
Posted 23 February 2013 - 08:26 AM
rednet.send(id, v)
sould be
rednet.send(v,k)