Link to Mod Share Mod Share

  Users Browse Upload Forums Log in

Mod Share Forums

Welcome to the Mod Share forums.

You are not logged in.

#1 2012-01-25 17:30:22

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Validating against Scratch servers

Is it possible that you could let me use the script for validating usernames and passwords against Scratch for my website?


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#2 2012-01-25 19:03:37

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

SJRCS_011 wrote:

Is it possible that you could let me use the script for validating usernames and passwords against Scratch for my website?

Certainly. (once I get FTP working, the stupid program crashed)
In PHP:

<?php
if(stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $someusername . '&password=' . $somepassword), 'false')) {
     echo 'Wrong';
     die;
}
?>

Just the URL:

http://scratch.mit.edu/api/authenticateuser?username=SOMEUSERNAME&password=SOMEPASSWORD

Last edited by jacob (2012-06-20 19:03:39)


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#3 2012-01-25 21:33:13

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Validating against Scratch servers

Thanks.
In the credits, I'll give you guys credit for that.

Do you have to md5 the password?
Cause I tried it on mine, and with the real password it said false and a fake password said false.


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#4 2012-01-25 21:47:24

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

SJRCS_011 wrote:

Thanks.
In the credits, I'll give you guys credit for that.

Do you have to md5 the password?
Cause I tried it on mine, and with the real password it said false and a fake password said false.

Are you sure? It appeared to work when you are registering, and I just checked it again with my username!
The following code did work.

http://scratch.mit.edu/api/authenticateuser?username=jvvg&password=*****

zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#5 2012-01-26 18:27:15

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Validating against Scratch servers

I found why.
Your password cannot contain symbols.  Only letters and numbers.
That would explain my difficulty signing up and my inability to log in to Clutter.

Last edited by SJRCS_011 (2012-01-26 18:27:34)


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#6 2012-04-26 10:16:55

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Validating against Scratch servers

jacob wrote:
SJRCS_011 wrote:

Is it possible that you could let me use the script for validating usernames and passwords against Scratch for my website?

Certainly. (once I get FTP working, the stupid program crashed)
In PHP:

<?php
if(stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $someusername . '&password=' . $somepassword, 'false')) {
}
?>

Just the URL:

http://scratch.mit.edu/api/authenticateuser?username=SOMEUSERNAME&password=SOMEPASSWORD

wait, shouldn't it be

<?php
if(stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $someusername . '&password=' . $somepassword),'false', TRUE) == FALSE) {
}

because otherwise it would always return false?


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#7 2012-04-26 11:01:44

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

Um, I don't think so...


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#8 2012-04-26 12:06:13

LS97
Mod Share Team
Registered: 2012-01-14
Posts: 218

Re: Validating against Scratch servers

SJRCS is right, Jacob-- you forgot a !

The correct boolean expression is
!stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $someusername . '&password=' . $somepassword), 'false')


LS97 - Mod Share Admin

Offline

#9 2012-04-26 14:21:26

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Validating against Scratch servers

ls97 wrote:

SJRCS is right, Jacob-- you forgot a !

The correct boolean expression is

!stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $someusername . '&password=' . $somepassword), 'false')

you forgot a parentheses though tongue

Last edited by SJRCS_011 (2012-04-26 14:22:34)


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#10 2012-04-26 16:03:20

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

I program a lot better when I have Notepad++ and I'm actually testing my code. I may have also meant to put a die; statement in there or something.

Yay! Fixed quick quote, it now should work with everything! smile


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#11 2012-04-27 07:39:44

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

stevetheipad wrote:
jacob wrote:

Yay! Fixed quick quote, it now should work with everything! smile

Yay! tongue

If a message had an & (ampersand) or 'single quotes', then the quick quote didn't work. I fixed it now.


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#12 2012-06-18 08:27:52

magmawulf
Mod Share-er
Registered: 2012-01-16
Posts: 11

Re: Validating against Scratch servers

I get Parse error: syntax error, unexpected '{' in /hermes/waloraweb025/b1275/pow.halfabee/ckc/mw/contact.php on line 4?


rktimage.png

cmimg.png                  bmimg.png

Offline

#13 2012-06-18 10:00:23

SJRCS_011
Community Moderator
From: Northeastern United States
Registered: 2012-01-15
Posts: 143
Website

Re: Validating against Scratch servers

magmawulf wrote:

I get Parse error: syntax error, unexpected '{' in /hermes/waloraweb025/b1275/pow.halfabee/ckc/mw/contact.php on line 4?

check your coding; you made a mistake somewhere in your code, on line 4


Mod Share- with Collab Features!
vQqtH.png
Learning Programming in a Nutshell: "You're missing a closing parenthesis" - LS97

Offline

#14 2012-06-18 17:15:13

magmawulf
Mod Share-er
Registered: 2012-01-16
Posts: 11

Re: Validating against Scratch servers

SJRCS_011 wrote:
magmawulf wrote:

I get Parse error: syntax error, unexpected '{' in /hermes/waloraweb025/b1275/pow.halfabee/ckc/mw/contact.php on line 4?

check your coding; you made a mistake somewhere in your code, on line 4

I used the one that was provided ;_;
I checked over and over again


rktimage.png

cmimg.png                  bmimg.png

Offline

#15 2012-06-18 20:12:25

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

magmawulf wrote:
SJRCS_011 wrote:
magmawulf wrote:

I get Parse error: syntax error, unexpected '{' in /hermes/waloraweb025/b1275/pow.halfabee/ckc/mw/contact.php on line 4?

check your coding; you made a mistake somewhere in your code, on line 4

I used the one that was provided ;_;
I checked over and over again

Can you provide the complete file?


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

#16 2012-06-19 03:31:19

magmawulf
Mod Share-er
Registered: 2012-01-16
Posts: 11

Re: Validating against Scratch servers

<?php
$username = $_POST["username"];
$password = $_POST["password"];
if(!stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $username . '&password=' . $password), 'false'){	
echo "This is a test";
	}
?>

I know I got something obvious wrong, just can't place it.  sad


rktimage.png

cmimg.png                  bmimg.png

Offline

#17 2012-06-19 03:58:45

LS97
Mod Share Team
Registered: 2012-01-14
Posts: 218

Re: Validating against Scratch servers

magmawulf wrote:
<?php
$username = $_POST["username"];
$password = $_POST["password"];
if(!stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $username . '&password=' . $password), 'false'){	
echo "This is a test";
	}
?>

I know I got something obvious wrong, just can't place it.  sad

You're missing a closing parenthesis


LS97 - Mod Share Admin

Offline

#18 2012-06-19 05:50:02

magmawulf
Mod Share-er
Registered: 2012-01-16
Posts: 11

Re: Validating against Scratch servers

LS97 wrote:
magmawulf wrote:
<?php
$username = $_POST["username"];
$password = $_POST["password"];
if(!stristr(file_get_contents('http://scratch.mit.edu/api/authenticateuser?username=' . $username . '&password=' . $password), 'false'){	
echo "This is a test";
	}
?>

I know I got something obvious wrong, just can't place it.  sad

You're missing a closing parenthesis

Thanks.


rktimage.png

cmimg.png                  bmimg.png

Offline

#19 2012-06-20 19:03:55

jacob
Mod Share Team (now jvvg)
From: Eastern United States
Registered: 2011-12-25
Posts: 375
Website

Re: Validating against Scratch servers

I updated the above code, so it should be correct now.


zwgbewe1gbewzygbewizgbew
Fear me, all powerful forum moderator! tongue

Offline

Board footer

This is part of Mod Share v4.0