Presenting: The SUB-ETHA-NET

Discussion in 'ComputerCraft Programming' started by weaversam8, Mar 11, 2014.

?

Do you like the idea of the SUB-ETHA-NET, and is it useful?

  1. I like it, and it is very useful!

    60.0%
  2. I like it, but it isn't useful.

    20.0%
  3. I dislike it, but it is useful.

    0 vote(s)
    0.0%
  4. I dislike it, and it is not useful.

    20.0%
  1. weaversam8

    weaversam8 New Member

    Joined:
    Jan 29, 2014
    Messages:
    7
    Likes Received:
    0
    Hello Again everyone! Today I am here to showcase the my latest and greatest ComputerCraft project, the SUB-ETHA-NET.

    This is an infinitely expandable network of computers, that allows you, similar to the modem messaging framework, to send messages an infinite distance, even across servers, simply by plugging your computer into the ground! How you may ask?

    If you are interested in the science of this process, click the spoiler below.
    Well, I cannot reveal any actual code, or too much about how the process works, (except to moderators,) so have this fake answer.

    When you transmit a message to the modem, it sends electrominetec signals through a specially fabricated dirt conductance block, which then spreads the message through every connected block in the server (encrypted, of course,) and by doing this makes the message embedded in the server frequency. This frequency is spread throughout the internet, and picked up by other modded servers with CC, and it can then be sent to the receiving fabricated dirt conductance block and down a network cable. ;)

    If you are interested in how the API works, read the next spoiler.
    I plan on writing an importable LUA API, but I have not yet, it
    isn't really hard to code into your program...

    Code:
    --Sends a message to ip address 10.0.0.1
    rednet.broadcast("s:10.0.0.1:message");
    --Need to be connected to cable to sub-etha-net by modem
     
    --When a message arrives, a rednet message is broadcast with the following attributes
    "m:10.0.0.2:message"
    --Where 10.0.0.2 is origin address
    

    Pricing information is located below:
    2 diamond - set up cost
    1 diamond - every 2 weeks of service


    Setup information is located here:
    To set up, we simply need to claim one chunk, in OR outside of you base. We will place the base station there, and feed the cable out accordingly. Once you connect to that cable, you can connect to the SUB-ETHA-NET


    So, hope you enjoyed this post on the SUB-ETHA-NET, and if you have any questions, please ask below. If you are interested in subscribing, contact me in-game or below.

    Sincerely
    -Weaversam8, the Conqueror.

    P.S. A demonstration is available at my shop in the bazaar. :)
     
  2. sk89q

    sk89q Administrator
    Staff Member

    Joined:
    Dec 1, 2011
    Messages:
    2,490
    Likes Received:
    1,504
    This doesn't happen to use the HTTP API, does it (just speculation -- not from a moderator's PoV)?
     
  3. weaversam8

    weaversam8 New Member

    Joined:
    Jan 29, 2014
    Messages:
    7
    Likes Received:
    0
    It does, and uses a combination of software between a real PHP server and client side lua server code.
     
  4. gknova61

    gknova61 Farbes Lover

    Joined:
    Mar 17, 2012
    Messages:
    1,238
    Likes Received:
    350
  5. weaversam8

    weaversam8 New Member

    Joined:
    Jan 29, 2014
    Messages:
    7
    Likes Received:
    0
    I suppose I shall. I don't really have the resources to do this right now. Understand, the code is very unclean, and it requires a specific MySQL database setup.

    PHP Code:
    PHP:
    <?php
     
    /**
    * SKOnline PHP Source
    * Created by Samuel Weaver, 2014
    * (weaversam8)
    *
    *
    * Just credit me. That's all I ask. :)
    *
    */
     
    $con=mysqli_connect("server","user","pass","db");
     
    // Check connection
    if (mysqli_connect_errno())
    {
      echo 
    "Failed to connect to MySQL: " mysqli_connect_error();
    }
     
    $type $_GET[t];
    $who $_GET[c];
    $message $_GET[m];
    $dest $_GET[d];
     
    if(
    $type == 1) {
        
    $result mysqli_query($con,"SELECT * FROM users WHERE address='" $dest "'");
        
    $row mysqli_fetch_array($result);
        if(
    $row != null) {
            echo(
    'y');
        } else {
            echo(
    'n');
        }
    }
    if(
    $type == 2) {
        if(
    $who != null && $message != null && $dest != null /*&& strlen($message) <= 128*/) {
            
    $result2 mysqli_query($con,"SELECT * FROM users WHERE address='" $dest "'");
            
    $row mysqli_fetch_array($result2);
            if(
    $row != null) {
                
    $result3 mysqli_query($con,"SELECT * FROM users WHERE auth='" $who "'");
                
    $row mysqli_fetch_array($result3);
                if(
    $row != null && $_GET[i] != null) {
                    
    $from $row['address'];
                    
    $dest str_replace(".","d",$dest);
                    
    mysqli_query($con,"INSERT INTO messages VALUES ('" $dest "', '" $from "', '" $message "', " $_GET[i] . ")");
                    echo(
    'y');
                } else {
                    echo(
    'n');
                }
            } else {
                echo(
    'n');
            }
        }
         
    }
    if(
    $type == 3) {
        if(
    $who != null) {
            
    $result4 mysqli_query($con,"SELECT * FROM users WHERE auth='" $who "'");
            
    $row mysqli_fetch_array($result4);
            if(
    $row != null) {
                
    $rec $row['address'];
                
    $quer "SELECT * FROM messages WHERE goto='" $rec "'";
                
    $result5 mysqli_query($con,$quer);
                
    $row mysqli_fetch_array($result5);
                if(
    $row != null) {
                    echo(
    "m:" str_replace("d",".",$row['from']) . ":" $row['message']);
                    
    mysqli_query($con,"DELETE FROM messages WHERE id=" $row['id']);
                } else {
                    echo(
    'n');
                }
           
            }
        }
    }
     
    ?>

    Also note, you will need a database with these settings:
    SQL Code to Generate Tables:
    -- phpMyAdmin SQL Dump
    -- version 2.11.11.3
    -- http://www.phpmyadmin.net
    --
    -- Host: **.***.***.***
    -- Generation Time: Mar 20, 2014 at 05:18 PM
    -- Server version: *.*.**
    -- PHP Version: *.*.*

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

    --
    -- Database: `weaskonline`
    --

    -- --------------------------------------------------------

    --
    -- Table structure for table `messages`
    --

    CREATE TABLE `messages` (
    `goto` varchar(16) NOT NULL,
    `from` varchar(16) NOT NULL,
    `message` varchar(128) NOT NULL,
    `id` int(16) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

    --
    -- Dumping data for table `messages`
    --


    -- --------------------------------------------------------

    --
    -- Table structure for table `users`
    --

    CREATE TABLE `users` (
    `username` varchar(25) NOT NULL,
    `auth` varchar(60) NOT NULL,
    `address` varchar(16) NOT NULL
    ) ENGINE=MyISAM DEFAULT CHARSET=utf8;

    --
    -- Dumping data for table `users`
    --

    Just credit me guys, and thanks for being an awesome community.

    Sincerely,
    Weaversam8 The Conquerer
     
  6. gknova61

    gknova61 Farbes Lover

    Joined:
    Mar 17, 2012
    Messages:
    1,238
    Likes Received:
    350
    If you want, I can throw this up on a LAMP server for you :)
     
  7. weaversam8

    weaversam8 New Member

    Joined:
    Jan 29, 2014
    Messages:
    7
    Likes Received:
    0
    I might take you up on that offer, I actually already have a server where this is running, MySQL and everything. I just haven't had the in-game resources to market it yet.