Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
seadweller
Mar 30, 2010
Password changing. I'm setting up a Turn Key Linux wiki server and have got most of the things we need sorted out. Just need one more thing I need a method to change passwords (email is disabled as its going to be a private wiki so no reset via email). Here is my server information:

MySQL

* Server: Localhost via UNIX socket
* Server version: 5.1.41-3ubuntu12.8
* Protocol version: 10
* User: root@localhost
* MySQL charset: UTF-8 Unicode (utf8)

Web server

* Apache/2.2.14 (Ubuntu)
* MySQL client version: 5.1.41
* PHP extension: mysql

phpMyAdmin

* Version information: 3.3.2deb1ubuntu1

I'm in the php MyAdmin pages:

localhost - wiki_db

SQL tab

googling suggests that I use the following command:

mysql> UPDATE mysql.user SET Password = PASSWORD('monday')
-> WHERE Host = 'localhost' AND User = '53656e647362';
mysql> FLUSH PRIVILEGES;

The user "53656e647362" exists in the Browse tab as a user and corresponds to the person I'm experimenting on I get an error:

-----------------------------------------------------------------------------------
Error

There seems to be an error in your SQL query. The MySQL server error output below, if there is any, may also help you in diagnosing the problem

ERROR: Unknown Punctuation String @ 64
STR: ->
SQL: mysql> UPDATE mysql.user SET Password = PASSWORD('monday')
-> WHERE Host = 'localhost' AND User = '53656e647362';mysql> UPDATE mysql.user SET Password = PASSWORD('monday')
-> WHERE Host = 'localhost' AND User = '53656e647362';mysql> UPDATE mysql.user SET Password = PASSWORD('monday')
-> WHERE Host = 'localhost' AND User = '53656e647362';


SQL query:

mysql> UPDATE mysql.user SET Password = PASSWORD('monday') -> WHERE Host = 'localhost' AND User = '53656e647362';

MySQL said: Documentation
#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 'mysql> UPDATE mysql.user SET Password = PASSWORD('monday')
-> WHERE Host = ' at line 1
-----------------------------------------------------------------------------------

Sorry for the probably very basic query but am I going about this the right way?

Adbot
ADBOT LOVES YOU

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.
Well there's a -> right in the middle of your query before the WHERE statement.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Are you typing in "mysql>" and "->" command prompts literally as part of the query? Try just using the following:

UPDATE mysql.user SET Password = PASSWORD('monday') WHERE Host = 'localhost' AND User = '53656e647362';

seadweller
Mar 30, 2010

Hammerite posted:

Are you typing in "mysql>" and "->" command prompts literally as part of the query? Try just using the following:

UPDATE mysql.user SET Password = PASSWORD('monday') WHERE Host = 'localhost' AND User = '53656e647362';

nope not typing the mysql> part (figured that out a few days ago :D)

just ran the command and got the following:

0 row(s) affected. ( Query took 0.0017 sec )

so progress (it doesn't give an error) but not a result. I then tried using the user real id field at the end:

User = '4465616e204275726e657474' and again got:

0 row(s) affected. ( Query took 0.0018 sec )

any thoughts? I tried logging in using the username and the password its should have changed too 'monday' no joy.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Does this return any rows?

code:
select * from mysql.user where User = '53656e647362';

seadweller
Mar 30, 2010

fletcher posted:

Does this return any rows?

code:
select * from mysql.user where User = '53656e647362';

Tried

FLUSH PRIVILEGES;

no joy am rebooting the server to see if that has any effect.

reboot didn't touch it lets try your next step:

code:
select * from mysql.user where User = '53656e647362';
and the result:

MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0013 sec )

so it looks like I'm identifying the user wrong.

fletcher
Jun 27, 2003

ken park is my favorite movie

Cybernetic Crumb
Then just try (may not want to post the results of this query here):

code:
select * from mysql.user;
Use the output to figure out what the value for User and Host should actually be.

edit: also be aware there are people out there looking for ways into your system, I see poo poo like this in my logs daily:

code:
      /php-my-admin/index.php: 2 Time(s)
      /phpMyAdmin-2.2.3/index.php: 1 Time(s)
      /phpMyAdmin-2.2.6/index.php: 1 Time(s)
      /phpMyAdmin-2.5.1/index.php: 1 Time(s)
      /phpMyAdmin-2.5.4/index.php: 1 Time(s)
      /phpMyAdmin-2.5.5-pl1/index.php: 1 Time(s)
      /phpMyAdmin-2.5.5-rc2/index.php: 1 Time(s)
      /phpMyAdmin-2.5.5/index.php: 1 Time(s)
      /phpMyAdmin-2.5.6-rc1/index.php: 1 Time(s)
      /phpMyAdmin-2.5.6-rc2/index.php: 1 Time(s)
      /phpMyAdmin-2.5.6/index.php: 1 Time(s)
      /phpMyAdmin-2.5.7/index.php: 1 Time(s)
      /phpMyAdmin-2/index.php: 1 Time(s)
      /phpMyAdmin/index.php: 2 Time(s)
      /phpadmin/index.php: 1 Time(s)
      /phpmyadmin/index.php: 2 Time(s)
      /phpmyadmin1/index.php: 1 Time(s)
      /phpmyadmin2/index.php: 1 Time(s)

fletcher fucked around with this message at 10:55 on Mar 6, 2012

seadweller
Mar 30, 2010

fletcher posted:

Then just try (may not want to post the results of this query here):

code:
select * from mysql.user;
Use the output to figure out what the value for User and Host should actually be.

Get this:

Showing rows 0 - 4 (5 total, Query took 0.0013 sec)

Will get a screen shot:

as this is a temp setup to be rebuilt when I have the kinks worked out.

Edit - ye gods sorry about the screenshot size Edit 2 - this is not on the public internet its on a private ip range behind a proper firewall setup the address isn't publically available

Only registered members can see post attachments!

seadweller fucked around with this message at 11:02 on Mar 6, 2012

seadweller
Mar 30, 2010

seadweller posted:

Get this:

Showing rows 0 - 4 (5 total, Query took 0.0013 sec)

Will get a screen shot:

as this is a temp setup to be rebuilt when I have the kinks worked out.

Edit - ye gods sorry about the screenshot size Edit 2 - this is not on the public internet its on a private ip range behind a proper firewall setup the address isn't publically available

screenshot removed sorry again

How do I figure out which of the entries is the one I need?

The Gripper
Sep 14, 2004
i am winner

seadweller posted:

How do I figure out which of the entries is the one I need?
I have no idea what you've done/are doing that is giving you mysql.user table output like that. Mine is:
code:
mysql> SELECT host, user, password FROM user WHERE user='assass';
+-----------------+--------+------------------+
| host            | user   | password         |
+-----------------+--------+------------------+
| %.amazonaws.com | assass | (hashed pw)      |
+-----------------+--------+------------------+
1 row in set (0.00 sec)
Why are you updating mysql.user for changing passwords on a Wiki anyway? The wiki will have it's own table with users, mysql.user is the table for database access permissions.

The Gripper fucked around with this message at 13:13 on Mar 6, 2012

klem_johansen
Jul 11, 2002

[be my e-friend]
Facebook is killing off FBML. Unfortunately, that's the only way I know of to do the "invite friends to this site" thing. FB's own site includes a blurb about how some of these features are possible with social plugins but I can't find any tutorials or docs that point me in the right direction. Any ideas?

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

klem_johansen posted:

Facebook is killing off FBML. Unfortunately, that's the only way I know of to do the "invite friends to this site" thing. FB's own site includes a blurb about how some of these features are possible with social plugins but I can't find any tutorials or docs that point me in the right direction. Any ideas?

I'm no facebook expert but this blog was published today:
http://anandafit.info/2011/03/06/invite-friends-to-your-site-in-facebook-invite-app/

And has php examples.

486
Jun 15, 2003

Delicious soda

Scaramouche posted:

I'm no facebook expert but this blog was published today:

Check your year... That looks like an example of the code that is being deprecated.

Scaramouche
Mar 26, 2001

SPACE FACE! SPACE FACE!

Don't tell me you're one of those people who think 2000 actually counted as a year :colbert:

Leperkawn
Jan 2, 2008
Tires don exits!
edit: figured it out

spiritual bypass
Feb 19, 2008

Grimey Drawer
What's up with preg_match requiring you to delimit your regex with a special character? Wouldn't it make more sense if it just took the whole string and used it as a regex? Am I missing something huge here?

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

rt4 posted:

What's up with preg_match requiring you to delimit your regex with a special character? Wouldn't it make more sense if it just took the whole string and used it as a regex? Am I missing something huge here?

If you want to supply switches to modify the regex engine's behaviour, you add them after the ending character. Like i for case-insensitive matching.

code:
// 1 0
echo preg_match('/A/i', 'a');
echo ' ';
echo preg_match('/A/', 'a');

qntm
Jun 17, 2009
This makes perfect sense in Perl, where you don't need the single/double quotes as string delimiters, and you can just put m/blah/flags right there in the code literally. PHP just wrapped that up in a low-effort sort of way which makes it more inconvenient.

McGlockenshire
Dec 16, 2005

GOLLOCKS!
It's a wart of PCRE, really...

klem_johansen
Jul 11, 2002

[be my e-friend]

Scaramouche posted:

I'm no facebook expert but this blog was published today:
http://anandafit.info/2011/03/06/invite-friends-to-your-site-in-facebook-invite-app/

And has php examples.

Unfortunately, it is also based on FBML. When I look up the docs I get a big bold warning that FBML apps will no longer work as of June of this year. I'm not sure from the warning whether or not some of these functions will even be possible after that date.

TwystNeko
Dec 25, 2004

*ya~~wn*
So I'm working on a website for people to share PS Vita Wallpapers, and I'm looking for a good, secure login system. I've looked at frameworks like symfony and it just seems like trying to do brain surgery with a chainsaw.

I've also looked at using OpenID, and have a semi-functional "log in with google" button. Which is fine, except it seems a) no such thing as a logout, and b) I don't seem to have any persistance with the basic setup (I'm using LightOpenID). I realize I'm going to have to dump their login info into a database, just for sanity's sake, but I can't seem to get it to tell me if they're actually logged in..

Does anyone have any good suggestions? I'm okay with ditching OpenID, and implementing something entirely local, but I would like to get it working for that sweet Google e-cred.

coaxmetal
Oct 21, 2010

I flamed me own dad
I need to make an API for an existing PHP application (that I didn't write and is kind of a mess, but that's beside the point) and I was looking into some frameworks that claim to make writing a RESTful API easier.

Anyone have experience or opinions on any of these, or other suggestions? I was looking at

http://getfrapi.com/
http://www.slimframework.com/
http://www.recessframework.org
and https://github.com/evantahler/PHP-DAVE-API

I don't really want to use it for more than an API, so DAVE seems like the best for what I want, since it is the lightest weight, but if anyone has used one of these or something else and wants to weigh in, that would be cool.

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

coaxmetal posted:

I need to make an API for an existing PHP application (that I didn't write and is kind of a mess, but that's beside the point) and I was looking into some frameworks that claim to make writing a RESTful API easier.

Anyone have experience or opinions on any of these, or other suggestions? I was looking at

http://getfrapi.com/
http://www.slimframework.com/
http://www.recessframework.org
and https://github.com/evantahler/PHP-DAVE-API

I don't really want to use it for more than an API, so DAVE seems like the best for what I want, since it is the lightest weight, but if anyone has used one of these or something else and wants to weigh in, that would be cool.

I'm using Symfony2 to make a RESTful API, and I wrote a Bundle for it so it's dead simple - https://github.com/brightmarch/BrightmarchRestfulBundle

Symfony2 is pretty nice, I think.

Slim is nice and easy to set up, but it looks like it wouldn't scale well to writing large apps. Recess hasn't been updated in ages (https://github.com/recess/recess/) and doesn't require PHP5.3.


Edit: DAVE looks neat though, no experience with it, unfortunately.

musclecoder fucked around with this message at 20:35 on Mar 12, 2012

coaxmetal
Oct 21, 2010

I flamed me own dad
THanks, That looks cool, although symphony2 looks like a little more than what I want. Looking around some more I also found apify (https://github.com/apify/apify-library) so I'm going to check that out as well.

revmoo
May 25, 2006

#basta
What are the primary differences between symfony2 and codeigniter? (or Kohana)

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

revmoo posted:

What are the primary differences between symfony2 and codeigniter? (or Kohana)

I've never used Code Igniter or Kohana, so I can't give you much info there. Symfony2 is a total rewrite of the 1.x series. It requires PHP 5.3+ and is very large. It can be slow at times (especially Doctrine), but it enables you a great deal of freedom to fine tune it.

The nicest thing I like about Symfony2 is the bundle system. Everything (including the framework itself) lives inside a bundle. A bundle is pretty much a module that's dead simple to install. If you see my link above, I talk about installing the bundle. You update a file to include the Github location of the bundle, run a command, and edit a file and it's installed. Then to use it, you just tell your script to use the class and you're good to go.

Symfony2 is a memory hog. A basic request in the production environment is 8MB (on PHP5.4). Running my test suite of only 27 tests and 35 assertions yields 64MB of memory used by PHPUnit (you can get this way down by running each test in a separate process, but that takes a lot longer).

8MB per request is a lot for me, I usually shoot for between 1-2MB and after 2 I start feeling it's using too much RAM to satisfy requests.

I'm going to try to remove some unnecessary bundles to see if that helps as well.

Overall, I really dig it. I usually write my own frameworks, but for a new project I wanted to give another one a shot so I didn't have to worry about the boiler plate stuff. The documentation is getting there, but you'll still spend a fair amount of time on Stackoverflow, Google Groups, or browsing through the code to fully grok something.

seadweller
Mar 30, 2010
Got the password change thing worked out here is the working code if anyone else was interested

update user set user_password=md5(concat(user_id, '-', md5('NEWPASSWORD'))) where user_name='USERNAME';

NEWPASSWORD is the new password for the user, and USERNAME is the user's name (first letter must be capatalized!)

thanks for the help!

Optimus Prime Ribs
Jul 25, 2007

You really shouldn't be using MD5 for storing passwords: http://codahale.com/how-to-safely-store-a-password/

The Gripper
Sep 14, 2004
i am winner

Optimus Prime Ribs posted:

You really shouldn't be using MD5 for storing passwords: http://codahale.com/how-to-safely-store-a-password/
I believe the above is MediaWiki's password hashing scheme, in full. It's a pretty dumb scheme, and the salted version is pretty dumb too since it appends the salt to the password in the format :B:<salt>:<salted_password>. Protects the system, but is ineffective against any kind of attack against a single user.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
I'm really hoping someone can help me here because I'm completely stumped.

I have a CodeIgniter site which has a controller called "tip" (it's a football tipping site). The tip controller looks like this:

php:
<?
include_once 'app.php';

class Tip extends App
{
    function __construct()
    {
        parent::__construct();
    }
    
    function index()
    {
        echo 'test';
    }
    
    function save()
    {
        echo 'test';
    }
}
?>
The problem is, whenever I try to access that controller it gives a HTTP500 error:

quote:

HTTP Error 500 (Internal Server Error): An unexpected condition was encountered while the server was attempting to fulfil the request.

The bizarre part here is that exact page works if I rename the file and the class to something else and try that instead, but if I try to call it 'tip' it doesn't work. I even had that specific controller, named tip, working perfectly before and it had a lot worse code in it than what is there now. At some point the whole thing fell over so I dumbed the code down to the bare essentials for the sake of debugging, but no luck - even with the code so dumbed down it doesn't work with that specific name.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Does "app" work?

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

rt4 posted:

Does "app" work?

Yeah sorry, forgot to mention that all of other functioning controllers start the same way.

Also this specific file works fine if I simply change its name and nothing else, so I don't think app is causing it.

It's making my head hurt.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Gnack posted:

Yeah sorry, forgot to mention that all of other functioning controllers start the same way.

Also this specific file works fine if I simply change its name and nothing else, so I don't think app is causing it.

It's making my head hurt.

The behaviour you describe is strange, because "Tip" is not a keyword in PHP.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Any funny business going on in your .htaccess? Any hooks?

qntm
Jun 17, 2009

Gnack posted:

Yeah sorry, forgot to mention that all of other functioning controllers start the same way.

Also this specific file works fine if I simply change its name and nothing else, so I don't think app is causing it.

It's making my head hurt.

What's the name of the file? i.e. what's the name of the file when it doesn't work, and what its name when it does work?

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION
Oh sweet jesus I'm sorry guys, I found the problem.

I had another class being created elsewhere called 'Tip'... ugh! I think this is evidence that I've been up too long.

spiritual bypass
Feb 19, 2008

Grimey Drawer
Was it a model? I really wish I could give models and controllers the same name.

Bloembak
Aug 11, 2007

klem_johansen posted:

Unfortunately, it is also based on FBML. When I look up the docs I get a big bold warning that FBML apps will no longer work as of June of this year. I'm not sure from the warning whether or not some of these functions will even be possible after that date.

Facebook has completely migrated all of the FBML functionality to their Javascript SDK. You can find the docs about this sdk here: https://developers.facebook.com/docs/reference/javascript/

A more specific example about inviting friends (app requests) can be found here:
https://developers.facebook.com/docs/reference/dialogs/requests/

musclecoder
Oct 23, 2006

I'm all about meeting girls. I'm all about meeting guys.

rt4 posted:

Was it a model? I really wish I could give models and controllers the same name.

You can with namespaces.

Adbot
ADBOT LOVES YOU

oRenj9
Aug 3, 2004

Who loves oRenj soda?!?
College Slice
edit: fixed.

oRenj9 fucked around with this message at 21:34 on Mar 22, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply