How To Create an App Like Instagram With a Web Service Backend - Part 1/2

Discussion of the official tutorials published on raywenderlich.com. Please only discuss the official tutorials here - for general questions, use the General Discussion forum instead.

How To Create an App Like Instagram With a Web Service Backend - Part 1/2

Postby rwenderlich » Tue Jul 10, 2012 11:00 am

This is the official thread to discuss the following blog post: How To Create an App Like Instagram With a Web Service Backend - Part 1/2
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
Ray Wenderlich
Blog: http://www.raywenderlich.com
Twitter: http://twitter.com/rwenderlich
- - - - - - - - - - - - - - - - - - - - - - - - - - - -
User avatar
rwenderlich
Team Member
Site Admin
 
Posts: 2166
Joined: Thu Dec 23, 2010 4:14 pm
Has thanked: 28 times
Been thanked: 348 times

Re: How To Create an App Like Instagram With a Web Service B

Postby zeiteisen » Tue Jul 10, 2012 9:15 pm

Me and Databases are no friends :(
The last time I touched this stuff was as I followed Rays tutorial about redeeming promo codes.
The SQL command throws an error:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"login" (
"IdUser" int(11) NOT NULL AUTO_INCREMENT,
"username" varchar(45)' at line 1
zeiteisen
Uber Haxx0r
 
Posts: 77
Joined: Mon May 02, 2011 8:41 pm
Has thanked: 5 times
Been thanked: 4 times

Re: How To Create an App Like Instagram With a Web Service B

Postby pinc » Wed Jul 11, 2012 8:18 am

I know the focus of this article isn't security, but anyone using the API php code should be aware. Setting a static salt in the app defeats the whole purpose of salting. Obtaining that one salt can result in the entire database being brute forced at once. The password should be hashed on the server with a unique salt per password and communication between the server and the app should be done over HTTPS (SSL). Also, I would recommend using prepared statements for SQL quries. Prepared statements make SQL injection not possible if done right. When you create SQL queries by joining strings, you are vulnerable to SQL injection.
pinc
n00b
 
Posts: 2
Joined: Fri Apr 15, 2011 4:37 am
Has thanked: 0 time
Been thanked: 0 time

Re: How To Create an App Like Instagram With a Web Service B

Postby icanzilb » Wed Jul 11, 2012 8:47 am

@zeiteisen - not sure what's the problem with importing the SQL at your place, but here's a bit simplified version of the SQL script (for compatibility with older versions of MySQL, etc) give this version a try - maybe it'll go trough:

Code: Select all
CREATE TABLE `login` (
  `IdUser` int(11) NOT NULL AUTO_INCREMENT,
  `username` varchar(45) NOT NULL,
  `pass` varchar(45) NOT NULL,
  PRIMARY KEY (`IdUser`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;

CREATE TABLE `photos` (
  `IdPhoto` int(11) NOT NULL AUTO_INCREMENT,
  `title` varchar(100) NOT NULL,
  `IdUser` int(11) NOT NULL,
  PRIMARY KEY (`IdPhoto`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8;


Let me know if that works out. Marin
User avatar
icanzilb
Team Member
iOS Tutorial Team Member
 
Posts: 373
Joined: Tue Jan 11, 2011 10:33 am
Has thanked: 12 times
Been thanked: 17 times

Re: How To Create an App Like Instagram With a Web Service B

Postby jlchapman » Wed Jul 11, 2012 12:43 pm

icanzilb,

I was getting the same error and your SQL script worked. Thanks!

zeiteisen,

I'm using XAMPP from the link in the tutorial. Bring up the phpMyAdmin in XAMPP, create the database, 'iReport'. Click the SQL tab, copy and paste the script from icanzib, click go. It should work for you.

JC
jlchapman
Subscriber since Feb 21, 2014
Hacker
 
Posts: 14
Joined: Thu Nov 10, 2011 11:50 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How To Create an App Like Instagram With a Web Service B

Postby zeiteisen » Wed Jul 11, 2012 7:14 pm

Thanks you. The new sql commands are working.
zeiteisen
Uber Haxx0r
 
Posts: 77
Joined: Mon May 02, 2011 8:41 pm
Has thanked: 5 times
Been thanked: 4 times

Re: How To Create an App Like Instagram With a Web Service B

Postby icanzilb » Wed Jul 11, 2012 7:31 pm

awesome guys, I'm glad you can go on with the tutorial!
User avatar
icanzilb
Team Member
iOS Tutorial Team Member
 
Posts: 373
Joined: Tue Jan 11, 2011 10:33 am
Has thanked: 12 times
Been thanked: 17 times

Re: How To Create an App Like Instagram With a Web Service B

Postby shippo0708 » Thu Jul 12, 2012 5:01 pm

[s]umm if using XAMPP on mac, how do i do the SQL statements? lol[/s]

Nevermind... didn't know you could do it thru the XAMPP page using phpMyAdmin
Last edited by shippo0708 on Fri Jul 13, 2012 12:03 am, edited 1 time in total.
User avatar
shippo0708
Uber Haxx0r
 
Posts: 682
Joined: Fri Apr 15, 2011 4:06 am
Location: Texas
Has thanked: 2 times
Been thanked: 51 times

Re: How To Create an App Like Instagram With a Web Service B

Postby William » Thu Jul 12, 2012 8:00 pm

When I try to Register with the app I get the following Error:

"Expected status code in (200-299), got 404"

can anyone tell me what I might have done wrong?
William
Subscriber since Mar 30, 2014
n00b
 
Posts: 4
Joined: Wed Apr 20, 2011 1:09 pm
Has thanked: 1 time
Been thanked: 0 time

Re: How To Create an App Like Instagram With a Web Service B

Postby shippo0708 » Thu Jul 12, 2012 8:07 pm

William wrote:When I try to Register with the app I get the following Error:

"Expected status code in (200-299), got 404"

can anyone tell me what I might have done wrong?



Do you have your app pointing to the right "server" 404 usually means page not found
(could be wrong though)
User avatar
shippo0708
Uber Haxx0r
 
Posts: 682
Joined: Fri Apr 15, 2011 4:06 am
Location: Texas
Has thanked: 2 times
Been thanked: 51 times

Next

Return to Official Tutorials

Who is online

Users browsing this forum: Exabot [Bot] and 12 guests