Jump to content




A social networking system for ComputerCraft?

lua utility networking

34 replies to this topic

#21 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 16 March 2015 - 12:21 PM

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

Yeah will have a look into it :D

#22 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 16 March 2015 - 12:21 PM

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

#23 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 16 March 2015 - 12:23 PM

View Postoeed, on 16 March 2015 - 12:21 PM, said:

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

Yeah thinking of it, would be useful!

View PostDannySMc, on 16 March 2015 - 12:22 PM, said:

View Postoeed, on 16 March 2015 - 12:21 PM, said:

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

Yeah thinking of it, would be useful!

Although I hope one of you kind fellows has a loving JSON decode function :D

#24 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 16 March 2015 - 12:28 PM

Just for help, each request from the server that is a get type that will get like messages, or users or apps etc, or even get a profile, will come back as a Lua formatted array, so all you would do is readAll and then unserialize :D

#25 TurtleHunter

  • Members
  • 112 posts

Posted 16 March 2015 - 02:12 PM

View PostDannySMc, on 16 March 2015 - 12:23 PM, said:

View Postoeed, on 16 March 2015 - 12:21 PM, said:

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

Yeah thinking of it, would be useful!

View PostDannySMc, on 16 March 2015 - 12:22 PM, said:

View Postoeed, on 16 March 2015 - 12:21 PM, said:

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

Yeah thinking of it, would be useful!

Although I hope one of you kind fellows has a loving JSON decode function :D

Latest CC has one :P

#26 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 16 March 2015 - 02:21 PM

View PostTurtleHunter, on 16 March 2015 - 02:12 PM, said:

View PostDannySMc, on 16 March 2015 - 12:23 PM, said:

View Postoeed, on 16 March 2015 - 12:21 PM, said:

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

Yeah thinking of it, would be useful!

View PostDannySMc, on 16 March 2015 - 12:22 PM, said:

View Postoeed, on 16 March 2015 - 12:21 PM, said:

View Postcdel, on 16 March 2015 - 12:19 PM, said:

A single table containing all the users friends would be best, but may be difficult from the server side.

You could just do a JSON array of IDs.

Yeah thinking of it, would be useful!

Although I hope one of you kind fellows has a loving JSON decode function :D

Latest CC has one :P
It does?

#27 MKlegoman357

  • Members
  • 1,170 posts
  • LocationKaunas, Lithuania

Posted 16 March 2015 - 08:30 PM

View PostDannySMc, on 16 March 2015 - 02:21 PM, said:

It does?

Not decoding, encoding only.

#28 oeed

    Oversimplifier

  • Members
  • 2,095 posts
  • LocationAuckland, New Zealand

Posted 16 March 2015 - 08:48 PM

Regarding JSON, I simply meant as server side storage. You just have an array like this: [1, 4, 16, 28] and then when you get a user's profile you then turn it into an array of the actual profiles. You should avoid send JSON if you can.

I've got a function that textutils.serialises in PHP from the CC App Store you could use if you wanted.

#29 TheOddByte

    Lazy Coder

  • Members
  • 1,607 posts
  • LocationSweden

Posted 16 March 2015 - 09:16 PM

I actually started with a project like this a long time back, but it was through rednet and flickered a lot. This seems like a great idea and I fully support it, I wish I could help out but I won't have the time sadly, because school and other projects are taking up too much time, so I'll be in the shadows secretly watching this project :P

Edit: Found the old project, it was hidden on mediafire! Here's the link if you wanna check it out http://www.mediafire...cw/CakeBook.zip

Edited by TheOddByte, 16 March 2015 - 09:44 PM.


#30 _removed

  • Members
  • 262 posts

Posted 16 March 2015 - 10:06 PM

Your probably going to say no, but I would like to help you with PHP as I have created the PHP for http://retroservices.16mb.com (im not a web developer) and am very experienced with SQL/HTML/CSS/PHP/PDO.

#31 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 16 March 2015 - 11:01 PM

View Postsmigger22, on 16 March 2015 - 10:06 PM, said:

Your probably going to say no, but I would like to help you with PHP as I have created the PHP for http://retroservices.16mb.com (im not a web developer) and am very experienced with SQL/HTML/CSS/PHP/PDO.

You guessed it! Thanks anyway! The PHP I will be making as this is not just for the ComputerCraft, it is for a wide range of programs :D

View PostTheOddByte, on 16 March 2015 - 09:16 PM, said:

I actually started with a project like this a long time back, but it was through rednet and flickered a lot. This seems like a great idea and I fully support it, I wish I could help out but I won't have the time sadly, because school and other projects are taking up too much time, so I'll be in the shadows secretly watching this project :P

Edit: Found the old project, it was hidden on mediafire! Here's the link if you wanna check it out http://www.mediafire...cw/CakeBook.zip

Haha nice, I have so many plans, although I am extending this to node.js and a few CGILua platforms when I have finished :D

#32 Dahknee

  • Members
  • 1,808 posts
  • Location/home/da

Posted 16 March 2015 - 11:18 PM

View Postsmigger22, on 15 March 2015 - 11:04 PM, said:

Your probably going to say no, but I would like to help you with PHP as I have created the PHP for http://retroservices.16mb.com (im not a web developer) and am very experienced with SQL/HTML/CSS/PHP/PDO.

I would also like to point out, where is the website? The content of that page is basic HTML markup language? There is no design? I am not ripping you, it's nice you want to help, but more experience is a lot helpful, and being able to make some basic scripts...? This is a full framework I am making not a few PHP scripts :D but it's cool none the less, will have to show me the bank though, like the idea :D

View Postoeed, on 16 March 2015 - 08:48 PM, said:

Regarding JSON, I simply meant as server side storage. You just have an array like this: [1, 4, 16, 28] and then when you get a user's profile you then turn it into an array of the actual profiles. You should avoid send JSON if you can.

I've got a function that textutils.serialises in PHP from the CC App Store you could use if you wanted.

Will see as I am okay with working with PHP arrays for now, but If it would be better to use it I shall give you a shout, thanks :D

#33 _removed

  • Members
  • 262 posts

Posted 20 March 2015 - 04:00 PM

View PostDannySMc, on 16 March 2015 - 11:18 PM, said:

View Postsmigger22, on 15 March 2015 - 11:04 PM, said:

Your probably going to say no, but I would like to help you with PHP as I have created the PHP for http://retroservices.16mb.com (im not a web developer) and am very experienced with SQL/HTML/CSS/PHP/PDO.

I would also like to point out, where is the website? The content of that page is basic HTML markup language? There is no design? I am not ripping you, it's nice you want to help, but more experience is a lot helpful, and being able to make some basic scripts...? This is a full framework I am making not a few PHP scripts :D but it's cool none the less, will have to show me the bank though, like the idea :D

I'm gonna be really honest, but I'm looking for a web designer that can make a really simple but effective framework for it. If you want to try it out, maybe me and Jasper will let you use it when it is finally finished. All I do is make the scripts and I can send you a tutorial for how to use the PHP API and the Lua API.

EDIT: here are screenshots of the PHPMyAdmin and PHP code:

http://puu.sh/gIbty/49bcea8e2e.png

http://puu.sh/gIbxE/c66d15488b.png

http://puu.sh/gIbAT/b68c95a1e3.png

http://puu.sh/gIbDZ/b4cc22d48f.png

http://puu.sh/gIbFv/3511b7110d.png

Edited by smigger22, 20 March 2015 - 04:08 PM.


#34 SquidDev

    Frickin' laser beams | Resident Necromancer

  • Members
  • 1,427 posts
  • LocationDoes anyone put something serious here?

Posted 20 March 2015 - 05:55 PM

View Postsmigger22, on 20 March 2015 - 04:00 PM, said:

EDIT: here are screenshots of the PHPMyAdmin and PHP code:

$query = $mysqli->prepare("SELECT password FROM users WHERE username = '$username'");
$query->execute();

Why don't you do:

$query = $mysqli->prepare("SELECT password FROM users WHERE username = ?");
$query->bind_param("s", $username);
$query->execute();

This gives you automatic SQL injection prevention and helps keep things nicer. If you use the statement lots (in one request) you only need to prepare it once and then can execute it multiple times.

#35 _removed

  • Members
  • 262 posts

Posted 20 March 2015 - 07:14 PM

View PostSquidDev, on 20 March 2015 - 05:55 PM, said:

View Postsmigger22, on 20 March 2015 - 04:00 PM, said:

EDIT: here are screenshots of the PHPMyAdmin and PHP code:

$query = $mysqli->prepare("SELECT password FROM users WHERE username = '$username'");
$query->execute();

Why don't you do:

$query = $mysqli->prepare("SELECT password FROM users WHERE username = ?");
$query->bind_param("s", $username);
$query->execute();

This gives you automatic SQL injection prevention and helps keep things nicer. If you use the statement lots (in one request) you only need to prepare it once and then can execute it multiple times.

Thanks SquidDev, I actually understand what you written for a change! (No offence)! But yeah, I forgot the bind params function :P





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users