Skip to content
Nov 6 / Greg

RadiusManager Time Expiration Update Script

RadiusManager by DMASoftlabs is a cheap, easy to use radius front end that will authenticate pppoe, hotspot, whatever accounts. One downside is the support isn’t the greatest. You occasionally have to do some hacking on your own.

The particular fix I made with this script is that if you have date expiration customers(as in they have access for a month at a time), and they add credits before they expire…it does nothing. It doesn’t extend their expiration date…nor does it add credits. It just eats their money. Needless to say, users aren’t happy about it.

So this script is meant to be run once a day around 11:57PM. It will look in the financials for anyone who made a purchase that day, but had 0 days added to their total. It will then take the number of months they purchased, and that to their existing expiration date. It then emails you the list.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "radius";
 
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";
 
//days is the number of days the transaction added.  Expiration is the date currently set as expiration.  Amount is the number of months they just purchased.  
$sql = "SELECT username, date, days, expiration, DATE_ADD(expiration, INTERVAL amount * 4 WEEK) as expirationNew, amount, price FROM rm_invoices WHERE days='0' AND date=CURDATE()";
$result = $conn->query($sql);
$message = "";
if ($result->num_rows > 0) {
    // output data of each row if there were 1 or more
    while($row = $result->fetch_assoc()) {
	$sql2 = "UPDATE rm_users set expiration = '" . $row["expirationNew"]. " 00:00:00' WHERE username='" . $row["username"]. "'";//update the users with their new expiration date.
//	echo $sql2;
	if ($conn->query($sql2) === TRUE) {
	    echo "Record updated successfully". "\r\n";
	} else {
	    echo "Error updating record: " . $conn->error. "\r\n";
	}//message to be added to the email.
	$message = $message . "username: " . $row["username"]. " - date: " . $row["date"]. " - days: " . $row["days"]. " - Original expiration: " . $row["expiration"]. " - New expiration: " . $row["expirationNew"]. " - amount: " . $row["amount"]. " - price: " . $row["price"]. "\r\n";
 
       echo "username: " . $row["username"]. " - date: " . $row["date"]. " - days: " . $row["days"]. " - expiration: " . $row["expiration"]. " - expirationNew: " . $row["expirationNew"]. " - amount: " . $row["amount"]. " - price: " . $row["price"]. "\r\n";
    }
    $eSubject = "Radius Expire Update - " . $result->num_rows;
} else {
    echo "0 results". "\r\n";
    $eSubject = "Radius Expire Update - 0";
}
$headers = 'From: radius@myserver.com';//setup from address
mail('whoever@gregsowell.com', $eSubject, $message, $headers);//send the email
 
$conn->close();
 
?>
Sep 29 / Greg

NES Zapper Converted To Shoot Light!

I thought it would be a pretty cool companion piece to my power glove light suit to have an NES Zapper that strobes. You can pick these babies up for just a few bones on ebay.

One could use a micro controller and do everything in software, but that’s far too high tech for what we are trying to accomplish. Instead we are using a simple 555 circuit.

I based mine off of this great instructable, to get a good fast strobe.

It uses:

  • 9V battery
  • 9V battery snap
  • two 180ohm resistors
  • 0,22 uF cap
  • 555 IC
  • 10mm super bright LED
  • 330ohm resistor to protect the LED
  • All components sourced from ebay/amazon should run you around $3-4.

    DSC06443

    DSC06444
    DSC06445
    DSC06446

    Guts of the zapper.  The only thing we care about here is the switch.  You can see all of the optical parts and the weights...it makes it feel more substantial.

    Guts of the zapper. The only thing we care about here is the switch. You can see all of the optical parts and the weights…it makes it feel more substantial.

    DSC06448

    DSC06449

    DSC06450

    The switch pulls, clicks, and disengages.  What we want to happen is for you to pull the trigger, and have the switch stay engaged.  Soooo I glued a ziptie in the base of the trigger to act as a shunt...it works a treat!

    The switch pulls, clicks, and disengages. What we want to happen is for you to pull the trigger, and have the switch stay engaged. Soooo I glued a ziptie in the base of the trigger to act as a shunt…it works a treat!

    DSC06454
    DSC06455

    DSC06458

    We had to cut off one of the screw posts, and clean out the plastic that held the weight to make room for the battery.

    We had to cut off one of the screw posts, and clean out the plastic that held the weight to make room for the battery.


    DSC06464

    DSC06465

    DSC06466

    DSC06467

    DSC06468

    Testing our 555 circuit to strobe our 10mm super bright LED.

    Testing our 555 circuit to strobe our 10mm super bright LED.


    The bench setup.

    The bench setup.

    My bench supply kicking 9V to simulate our 9V battery.

    My bench supply kicking 9V to simulate our 9V battery.

    DSC06473

    How beautiful is this circuit!

    How beautiful is this circuit!


    Super bright LED wired in.

    Super bright LED wired in.

    DSC06476

    9V hookup wired through the switch to our 555 circuit.

    9V hookup wired through the switch to our 555 circuit.


    DSC06478

    Squeezing everything into the guy...fits quite nicely.

    Squeezing everything into the guy…fits quite nicely.

    Sep 17 / Greg

    NES Power Glove Light Suit!!!

    I’ve been cooking this up in my head for a while now, and here it is…or at least the first version of it. This is technically my 4th light suit to make, and my best yet :)

    One of my favorite bands Hypercrush had a video where one of the guys was wearing a power glove that had lasers coming out of the ends. I had already made a light suit, and thought…what a waste. I thought “Why not control the suit with the power glove?” And thus it was born.

    This new generation uses individually addressable LEDs that are controlled by a single pin…no pulse width, no mosfets…soooo siimple.

    Since you are here to watch the video, here it is. The build log follows after.

    Cut to 6:23 for the suit in action.

    Materials are:

  • NES Power Glove – It’s sooo bad
  • Arduino Pro Mini
  • 12 – 10k resistors – pull down for buttons and voltage divider for bend sensors
  • WS2812 RGB LED strip – Adafruit, Sparkfun I’m working with the 5 meter strips
  • 300 ohm resistor to protect data pin
  • 1000 uF cap just before the light strip – protects lights
  • 2 USB cables to power the system
  • 5V 2A USB battery pack
  • 2 – 10mm super bright LEDs
  • 10′ stranded cat5 cable
  • The O-mazing neopixel library from Adafruit
  • There’s a nice teardown here. I followed his example when I gutted the circuit boards, but my wiring differs, though.

    dry fitting the 10mm lights where the ultrasonics once were

    dry fitting the 10mm lights where the ultrasonics once were


    DSC06436

    DSC06437

    DSC06438
    DSC06439

    LED dry run

    LED dry run


    One frosted, one not

    One frosted, one not


    The 5 meter ws2812 strip

    The 5 meter ws2812 strip

    DSC06461
    DSC06462

    Test rig for the lights...just to try them out.

    Test rig for the lights…just to try them out.


    DSC06481

    The strip cut in half.  I then trimmed the rubber sheath back.  They already have tiny holes ready to go!

    The strip cut in half. I then trimmed the rubber sheath back. They already have tiny holes ready to go!


    The data flows in a single direction, so you connect the out to the in.  There are tiny arrows that show you.  I take data and power/ground and tie them together.

    The data flows in a single direction, so you connect the out to the in. There are tiny arrows that show you. I take data and power/ground and tie them together.

    DSC06484

    DSC06485

    DSC06487

    DSC06488
    DSC06489

    DSC06490

    DSC06491

    This is wiring into the bend sensors to test.

    This is wiring into the bend sensors to test.


    The diodes pull power reverse of what I wanted, soooo I bridged them all together to test.

    The diodes pull power reverse of what I wanted, soooo I bridged them all together to test.

    As you can see the top of the board is gone, and a lot of wires have been freed up.

    As you can see the top of the board is gone, and a lot of wires have been freed up.

    DSC06495
    DSC06496

    DSC06497

    I used 10K resistors on each bend sensor to act as a voltage divider.

    I used 10K resistors on each bend sensor to act as a voltage divider.


    I'm using liquid electrical tape to protect everything.

    I’m using liquid electrical tape to protect everything.

    DSC06501
    DSC06502

    DSC06503

    I'm using 10K pull down resistors for each button.  This keeps the buttons digital pins from floating.

    I’m using 10K pull down resistors for each button. This keeps the buttons digital pins from floating.


    DSC06505

    DSC06506

    The two LEDs are wired together sharing a single resistor and a single digital pin.  I PWM the light level in half. The two LEDs are wired together sharing a single resistor and a single digital pin. I PWM the light level in half.

    DSC06512

    DSC06513

    DSC06514

    DSC06515

    DSC06516

    DSC06517

    DSC06518

    DSC06519/09/DSC06507.jpg” alt=”These are the buttons wired into the pull downs and then to the digital pins.” width=”640″ height=”480″ class=”size-full wp-image-4971″ /> These are the buttons wired into the pull downs and then to the digital pins.[/caption]

    One frosted and one not.  I like to sand them to diffuse the light.

    One frosted and one not. I like to sand them to diffuse the light.


    The arduino pro mini

    The arduino pro mini


    DSC06522

    Pins bent to save space.

    Pins bent to save space.


    DSC06524

    DSC06525

    DSC06526

    300 ohm protection resistor on the data pin.

    300 ohm protection resistor on the data pin.


    DSC06528

    DSC06529

    All the connections on.  The ends are hot glued together to keep everything solid.

    All the connections on. The ends are hot glued together to keep everything solid.

    DSC06531

    Glove all closed up.

    Glove all closed up.

    My test station setup.

    My test station setup.

    A sketch I wrote that shows bend sensor readings and button outputs.

    A sketch I wrote that shows bend sensor readings and button outputs.


    Cheap-o dollar store USB cables.

    Cheap-o dollar store USB cables.

    The gauge of the wire is thin, so I use two.

    The gauge of the wire is thin, so I use two.


    DSC06539

    I'm using an Ikea cutting board to join the two pieces in the center.  It is strong, flexible, and cheap( about a dollar).

    I’m using an Ikea cutting board to join the two pieces in the center. It is strong, flexible, and cheap( about a dollar).


    DSC06541

    DSC06542

    DSC06543

    DSC06544

    1000 uF cap...helps protect the LEDs.

    1000 uF cap…helps protect the LEDs.

    DSC06546

    DSC06547
    DSC06548

    Everything joined together.

    Everything joined together.

    DSC06551
    DSC06552

    DSC06553

    Heat shrinking the cap/power cables together...keeping it all safe and sound.

    Heat shrinking the cap/power cables together…keeping it all safe and sound.


    DSC06554

    You can see both the FTDI cable and the LED strip connection.  The arduino pulls power via the red and yellow wires.

    You can see both the FTDI cable and the LED strip connection. The arduino pulls power via the red and yellow wires.

    DSC06556

    Next step is to make a suit for each of my two boys, and a variation for my wife. I’ve got arduinos with radios so we can all be synchronized…muhahahaha

    Let me know what you think in the comments kids!

    Sep 16 / thebrotherswisp

    TheBrothersWISP 19 – US MUM 2014, New Gear, Impressions

    So juuuust after the 2014 US MUM, Greg Sowell, Justin Wilson, Mike Hammett, Tom Smyth, JJ Boyd, and special guests Thomas, Wayne, Gabe, Drew, and Brian join us.

    Thomas is a genius engineer/instructor from Slovakia who currently works for RF Elements.

    The audio is a little wacky since we recorded from Tom’s phone, but hopefully I’ve cleaned it up enough to be tolerable…if not, suffer in silence ;)

    Some of the things discussed:
    Mimosa gear
    CCR 1072
    CCR Status Update
    New Gear – FTC media converter, New CRS, cAP, mAP
    The Dude
    NetXMS monitoring system – Latvian monitoring system
    CAPsMAN – centralized management
    Mikrotik Partitions

    Click here to view the post!

    Sep 12 / Greg

    CCR Status Update

    Talk about FEEDBACK. I believe this marks a turning point for Mikrotik, and definitely for the best. Read and enjoy my friends…tons of great information…I would talk more about it, but it’s lunch time, and I’m starving…Tom had us out all flippin night…hehehe

    IMG_6584

    IMG_6585

    IMG_6586

    IMG_6587

    IMG_6588

    IMG_6589

    IMG_6590

    IMG_6594

    IMG_6595

    IMG_6596

    IMG_6597

    IMG_6598

    IMG_6599

    IMG_6600

    IMG_6601

    IMG_6602

    IMG_6603

    IMG_6604

    IMG_6605

    IMG_6606

    IMG_6607

    IMG_6608

    IMG_6609

    IMG_6610

    Sep 12 / Greg

    MUM 2014 Pittsburgh New Gear

    Sooo, there were a few new product announcements, nothing mind blowing, but always good. Here’s some images for your viewing pleasure.

    It looks like all of the CRS1XX series devices are your higherpower guys, while the CCR2XX series are going to be your lighter power units. All CRS8′s are supposed to be available in October.
    IMG_6510
    Super cool all SFP unit…great for aggregation. 1 SFP+ to uplink to the core. I can see using this at an MDU site to aggregate all of the buildings, then uplink to your core CCR for routing.
    IMG_6509

    IMG_6508

    IMG_6507
    The cAP is the answer to unifi…the idea is to pair this with CAPsMan for centralized management.

    IMG_6511

    IMG_6512
    The FTC is Fiber to Copper. It is basically a gigabit media converter…what’s so cool about that? Well, it is waterproof. This means we can strap this guy to a tower, to the side of a building…it doesn’t matter. I suppose you could even use this for a FttX deployment in an active environment.

    IMG_6513

    IMG_6514
    The CCR1072 isn’t new, but what is new is that it has a ship date…they are saying November “of this year”…heh. This device ONLY runs v7 which means if we see this in November, then expect to see V7 slightly before. Just told this is incorrect information…sometimes the rumor mill isn’t so accurate :P

    Cheers to all my old mates, and the new ;)

    Aug 27 / Greg

    Mikrotik Newsletter 61

    Find the newsletter here.

    NetMetal5

    netmetal5
    netmetal5b

  • 2X2 dual chain
  • 802.11AC
  • datarates of up to 866Mbps (for D models)256-QAM modulation
  • 20/40/80MHz channels
  • JJ might see 80MHz channels out in the mountains, but not in my town…too dirty for that here.

    mANT30 Dishes

    mant30
    A new round of 30dBi dishes. They look to be modeled after rocket dishes along with a quick mount for the mANT. They look very UBNT-esqe, and with the Mikrotik logo on the side I’m betting they are going to be solid pieces of kit.

    SXT AC

    sxtac

  • Up to 1300mW RF output
  • Up to 540Mbps throughput
  • Supports passive PoE and 802.3af/at PoE input (15-60V)
  • These cute little SXTs run AC. Claims of 540Mb P2P have me all a twitter. If this is exaggerated I’d still be pleased to see 220Mb.

    mAP 2n

    map

  • PoE in 10-57V
  • Built in 2GHz AP
  • microUSB for a 3G/4G modem (includes adapter to standard USB), or for power input
  • Station or AP mode wireless
  • Any type PoE input 802.3af and 802.3at
  • Passive PoE output (same as input voltage)
  • These cute little guys are more expensive than I would have liked(I believe the 951 is cheaper), but they look fun non-the-less…and they are giving them out at the MUM!

    CRS109

    crswireless

  • Full wire speed switching
  • Configure ports as switch, or for routing
  • If required, full RouterOS routing power right there
  • Built in 802.11b/g/n Wireless AP 1000mW
  • Desktop case
  • Color touchscreen LCD
  • So I was waaaay off on my price guest. So I know Cox has one of these and he says they are getting better…perhaps it’s time to try one? Line-rate gig with an SFP port…it appears to have built in wireless. I think if I wanted a gig switch with SFP uplinks I would check out the TP-Link. What the Link doesn’t have is an SFP+ port…nor does it route. The routing performance on the CRS is equivalent to a 2011. I suppose it may fit well in a small soho.

    So you guys excited about the AC stuff or what?