|
|
#251 (permalink) |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
Never tried to debug with textmate I'll try that, textmate is the shit.
I've written everything for this program that I didn't do in xcode in textmate. I jump in and out of it a hundred times a day and it is the shit. If I could get some combination of codesense and textmates autoformatting and stuff like show invisibles (i think xcode can do this, but i don't know where) and being able to tab in big blocks all at once I would be a truly happy nerd. Before I had the moola to buy it I used to uninstall and reinstall it every 30 days. I had a folder with all my bundles and themes so I could get my settings back real quick. And that is all for my textmate nerdgasm.
__________________
KATGIPHONE Donation ![]()
Last edited by hayroob; 05-06-2009 at 11:15 AM. |
| (Offline) |
|
|
|
#252 (permalink) | |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
Quote:
EDIT: Seems better than what I had, but it's still not detecting duplicates. I'm just gonna do this with MySQL. Last edited by hayroob; 05-06-2009 at 11:51 AM. |
|
| (Offline) |
|
|
|
#253 (permalink) |
|
Senior Member
Join Date: Nov 2006
Location: My Place: Liverpool. Born and raised in Berlin.
Posts: 771
|
I purchased it three days into using the trial, because I liked it so much. The integration with Cyberduck sealed the deal for me and I use it exclusively for any HTML / PHP stuff I do...
|
| (Offline) |
|
|
|
#254 (permalink) |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
So here's my final solution (not THAT final solution):
I'm not really supposed to post this on a public forum, but I figure enough of you are developers to claim no foul. This is dbcon.php: Code:
<?php
$db_user = "root";
$db_pass = "password";
$db = "tokenServer";
$db_host = "localhost";
$con = mysql_connect($db_host, $db_user, $db_pass);
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db($db);
?>
Code:
<?php
$deviceTokenUF = $_GET['dev'];
$deviceToken = substr($deviceTokenUF, 1, -1);
include("dbcon.php");
if (mysql_query("INSERT INTO `tokenServer`.`deviceTokens` (
`deviceToken` ,
`Time`
)
VALUES (
'$deviceToken', ''
)")) {
echo '
Success';
} else {
echo '
Fail';
}
mysql_close($con);
?>
Code:
<?php
include("dbcon.php");
$result = mysql_query("SELECT DISTINCT* FROM `deviceTokens`");
$front = '<device><deviceToken>';
$back = '</deviceToken></device>
';
echo '<?xml version="1.0" encoding="utf-8"?>';
echo '<root>
';
while($row = mysql_fetch_array($result))
{
echo $front. $row['deviceToken'].$back;
}
mysql_close($con);
echo '</root>';
?>
Code:
-- phpMyAdmin SQL Dump
-- version 2.10.2
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: May 06, 2009 at 04:00 PM
-- Server version: 5.0.41
-- PHP Version: 5.2.5
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
--
-- Database: `tokenServer`
--
CREATE DATABASE `tokenServer` DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci;
USE `tokenServer`;
-- --------------------------------------------------------
--
-- Table structure for table `deviceTokens`
--
CREATE TABLE `deviceTokens` (
`deviceToken` varchar(72) NOT NULL,
`Time` time NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `deviceTokens`
--
INSERT INTO `deviceTokens` VALUES ('c32f8b7c e8d02a51 ce296c62 d3da4cb3 84fed78d b24545db fd949a73 132f2b50', '00:00:00');
Push XCode Project I need to add something like INSERT INTO TABLENAME(col1, col2) VALUES (’xxx’, ‘yyy’) ON DUPLICATE KEY UPDATE col1 = ‘zzz’ so that duplicate keys never get added to the DB and I need to add authentication and move it onto an SSL server so I don't have to worry about people polling my deviceToken lists. Last edited by hayroob; 05-06-2009 at 05:32 PM. |
| (Offline) |
|
|
|
#256 (permalink) |
|
Member
Join Date: Mar 2006
Posts: 42
|
I would sanitize your devicetoken before doing the insert so no one does any sql injection. I don't know what the possible values are but some sort of regex like this will remove out anything not alphanumeric while also keeping spaces (theoretically, haven't tested):
Code:
<?php
$deviceTokenUF = $_GET['dev'];
$deviceToken = substr($deviceTokenUF, 1, -1);
$deviceToken = preg_replace("/[^0-9a-zA-Z\s]/",'',$deviceToken);
...
|
| (Offline) |
|
|
|
#257 (permalink) | |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
Quote:
Done and Done. It's a string of hexadecimal values in blocks of 8 so I just checked for hex values. Code:
<?php
$deviceTokenUF = $_GET['dev'];
$deviceToken = substr($deviceTokenUF, 1, -1);
$deviceToken = preg_replace("/[^0-9a-fA-F\s]/",'',$deviceToken);
...
Last edited by hayroob; 05-06-2009 at 08:52 PM. |
|
| (Offline) |
|
|
|
#258 (permalink) |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
so i tossed in some stufff to prevent duplicate table rows and integrated the regex stuff. Had to mark the deviceToken column in the database as a unique key. I've also got some mostly functional authorization stuff of the tokenLog side so that deviceTokens aren't being broadcast to the world.
Code:
<?php
$deviceToken = $_GET['dev'];
$deviceToken = preg_replace("/[^0-9A-Fa-f\s]/",'',$deviceToken);
include("dbcon.php");
if (mysql_query("INSERT INTO deviceTokens( `deviceToken` , `Time` ) VALUES ('$deviceToken', '00:00:00') ON DUPLICATE KEY UPDATE Time = ''"))
{
echo '
Success';
} else {
echo '
Fail';
}
mysql_close($con);
?>
|
| (Offline) |
|
|
|
#259 (permalink) |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
And the app has been rejected for Objectionable Content and because if it's not online the events feed is empty. I have made a version with only the streamer and events feed and will be making it work offline tonight. Hopefully with the youtube and shit pics removed they will approve the app. Then I can submit the app with twitter reintegrated as an upgrade and go from there.
|
| (Offline) |
|
|
|
#260 (permalink) | |
|
Administrator
Join Date: Mar 2008
Location: Detroitish
Posts: 1,654
|
Quote:
If the app gets rejected as just a streaming radio, I will be waiting til june and trying again then. |
|
| (Offline) |
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|