This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#301 2012-08-03 14:01:16

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

fg123 wrote:

Hopefully. It's mostly complex math that's not at my level.  tongue

Oh! But it's possible? I'd love to try, math is my favourite subject and I've got a decent year 11 preparation...

Offline

 

#302 2012-08-05 06:44:06

lallaway12
Scratcher
Registered: 2012-01-04
Posts: 500+

Re: Scratch API 2.0

Can you make the font in the text optons to be the forums?


http://i49.tinypic.com/2re4ied.png

Offline

 

#303 2012-08-05 09:54:18

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

lallaway12 wrote:

Can you make the font in the text optons to be the forums?

What's wrong with the font?

Offline

 

#304 2012-08-06 00:42:45

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Scratch API 2.0

LS97 wrote:

fg123 wrote:

Hopefully. It's mostly complex math that's not at my level.  tongue

Oh! But it's possible? I'd love to try, math is my favourite subject and I've got a decent year 11 preparation...

I'm pretty sure it's possible... Just how... ?  tongue


Hai.

Offline

 

#305 2012-08-06 06:45:30

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

fg123 wrote:

LS97 wrote:

fg123 wrote:

Hopefully. It's mostly complex math that's not at my level.  tongue

Oh! But it's possible? I'd love to try, math is my favourite subject and I've got a decent year 11 preparation...

I'm pretty sure it's possible... Just how... ?  tongue

Well, what's the complex math you're having trouble with?

Offline

 

#306 2012-08-06 13:25:41

lallaway12
Scratcher
Registered: 2012-01-04
Posts: 500+

Re: Scratch API 2.0

LS97 wrote:

lallaway12 wrote:

Can you make the font in the text optons to be the forums?

What's wrong with the font?

It looks well funny it not being the same as the forums


http://i49.tinypic.com/2re4ied.png

Offline

 

#307 2012-08-07 06:02:48

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

lallaway12 wrote:

LS97 wrote:

lallaway12 wrote:

Can you make the font in the text optons to be the forums?

What's wrong with the font?

It looks well funny it not being the same as the forums

But it's not supposed to have anything to do with the forums... Every site can have its own font and we chose to copy Scratch 2.0's!

Offline

 

#308 2012-08-07 06:13:08

BirdByte
Scratcher
Registered: 2012-07-07
Posts: 1000+

Re: Scratch API 2.0

I love the 404 page  tongue


http://i50.tinypic.com/312u714.jpg

Offline

 

#309 2012-08-07 18:03:55

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Scratch API 2.0

I know it's math. I just don't know what math exactly...  sad

IDK where to get started...


Hai.

Offline

 

#310 2012-08-09 09:10:21

sparks
Community Moderator
Registered: 2008-11-05
Posts: 1000+

Re: Scratch API 2.0

Sorry about this, but the commission I'm working on at the moment it taking up a lot of my time. I don't know how much work on this I'll be able to do in the next few weeks  hmm


http://img541.imageshack.us/img541/7563/scratchbetabanner.png

Offline

 

#311 2012-08-09 14:09:58

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

sparks wrote:

Sorry about this, but the commission I'm working on at the moment it taking up a lot of my time. I don't know how much work on this I'll be able to do in the next few weeks  hmm

No problem, it's important you do your real work best you can, just like school comes before leisure (usually)  smile

Honestly, it would be nice if you actually did some work eventually, especially since we're kinda stuck now, but there's no hurry.

Offline

 

#312 2012-08-13 12:09:10

MathWizz
Scratcher
Registered: 2009-08-31
Posts: 1000+

Re: Scratch API 2.0

I didn't make a drag and drop interface for JsScratch, but I have for a few other projects.  tongue  I suppose I could help if you need any.


http://block.site90.net/scratch.mit/text.php?size=30&text=%20A%20signature!&color=333333

Offline

 

#313 2012-08-16 05:09:56

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

MathWizz wrote:

I didn't make a drag and drop interface for JsScratch, but I have for a few other projects.  tongue  I suppose I could help if you need any.

Well, not any substantial help since we already have plenty developers for this project, but just some useful examples or code to get us started on this... we really can't get it to work otherwise!

Offline

 

#314 2012-08-16 20:11:10

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: Scratch API 2.0

Hey, would you mind me peeking at your PHP code? I'm making a website, and I'd love to see how you did the Scratch authentication.  smile


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#315 2012-08-17 05:27:58

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

technoboy10 wrote:

Hey, would you mind me peeking at your PHP code? I'm making a website, and I'd love to see how you did the Scratch authentication.  smile

Sure! Someone please paste the code, I can't possibly access the FTP at 52kbps internet  smile

Offline

 

#316 2012-08-17 13:59:39

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Scratch API 2.0

Yea of course, my awesome login.php code coming up  big_smile

That first include should be require, but oh well.

Code:

<?php
include("includes/settings.php");

if (isset($_POST['loginForm']))
{
    $username = $_POST['username'];
    $rawPassword  = $_POST['password'];
    $password = md5($rawPassword);
    
    $res = mysql_query("SELECT * FROM users WHERE username = '$username' ");
    if (mysql_num_rows($res) == 0) //username doesn't exist
    {
        header("Location: login.php?error=1");
    }
    else
    {
        while($data=mysql_fetch_array($res,MYSQL_ASSOC))
        {
            $passwordFromDB = $data['password']; //retreive the password from the database
            $admin = $data['admin'];
            $scratchid = $data['scratchUserID'];
            $scratchun = $data['scratchUsername'];
        }
        if ($password != $passwordFromDB) //checking password
        {
            header("Location: login.php?error=1"); //wrong password
        }
        else //correct, logging in
        {
            session_set_cookie_params(3600 * 24 * 6);
            $_SESSION['login'] = 1;
            $_SESSION['username'] = $username;
            $_SESSION['admin'] = $admin;
            $_SESSION['scratchid'] = $scratchid;
            $_SESSION['scratchun'] = $scratchun;
            $_SESSION['password'] = $passwordFromDB;
            $ip = $_SERVER['REMOTE_ADDR']; //not always reliable, if better way, please replace
            $res = mysql_query("UPDATE users SET lastip = '$ip' WHERE username = '$username'"); //set login ip
        }
    }
}

if (isset($_SESSION['login']))
{
        header("Location: index.php");
}
?>
<!DOCTYPE HTML5>

<html>

<head>
<title>Login | Scratch Forum API</title>
<? include(SRV_ROOT . '/includes/head.php'); ?>
</head>

<body>

<? include(SRV_ROOT . '/includes/header.php'); ?>

<div class="box">
    <div class = 'box-head'>
        <h4>Login</h4>
    </div><!--/box-head-->
    <div class='box-content'>
        <div class='inner'>
            <p>
            <?php
                    if(isset($_GET['error']))
                        {
                            echo('<div class="ui-state-error ui-corner-all" style="padding: 0 .7em;">
                <p><span class="ui-icon ui-icon-alert" style="float: left; margin-right: .3em;"></span>');
                            if($_GET['error'] == 1)
                            {
                                echo("Username Not Found or Password Incorrect");
                            }
                            else if($_GET['error'] == 2)
                            {
                                echo("You must login to create an image!");
                            }
                            else
                            {
                                echo("Unknown Error...");
                            }
                            echo("</p></div><br>");
                        }
                    
                    if(isset($_GET['success']))
                        {
                            echo("<div id='TxtSuccess'>");
                            if($_GET['success'] == 1)
                            {
                                echo("Registration success! Please login!");
                            }
                            else
                            {
                                echo("Unknown success, but I suppose it's happy!");
                            }
                            echo("</div><br>");
                        }
            ?>
            
                <form action="login.php" method="POST">
                    <b>
                    Username: <input type="text" style="color:#333;" name="username" id="username"><br>
                    Password: <input type="password" style="color:#333;" name="password" id="password"> 
                    </b>
                    <input type="hidden" name="loginForm" value="1"><br><br>
                    <input type="submit" name="loginBtn" value="Log in!" style="padding:15px;"><input type="button" name="registerBtn" value="Sign Up!" style="padding:15px;" onclick="window.location = 'register.php'">
                </form>
            </p>
        </div><!--/inner-->
    </div><!--/box-content-->
</div><!--/box-->
<?php include(SRV_ROOT . '/includes/footer.php'); ?>
</body>
</html>

Last edited by fg123 (2012-08-17 14:00:58)


Hai.

Offline

 

#317 2012-08-17 19:38:40

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: Scratch API 2.0

big_smile  Thanks! Can I use some of your code for my site if I give credit?


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#318 2012-08-18 17:08:46

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: Scratch API 2.0

hmm  I tried to implement this on my site, but it gave me an error. The error was
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /login.php on line 59 . Any ideas?


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#319 2012-08-19 00:19:06

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Scratch API 2.0

Sure, if you give credit. Can you post the code in question?


Hai.

Offline

 

#320 2012-08-19 02:51:03

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Offline

 

#321 2012-08-19 10:07:59

technoboy10
Scratcher
Registered: 2007-08-25
Posts: 1000+

Re: Scratch API 2.0

fg123 wrote:

Sure, if you give credit. Can you post the code in question?

I just pasted in your code (replacing SRV_ROOT . /includes/head.php with includes:header.php). I couldn't pinpoint the line in question, as my text editor isn't great.  tongue


So long, 1.4.
http://goo.gl/3JEV9

Offline

 

#322 2012-08-20 05:39:30

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

technoboy10 wrote:

fg123 wrote:

Sure, if you give credit. Can you post the code in question?

I just pasted in your code (replacing SRV_ROOT . /includes/head.php with includes:header.php). I couldn't pinpoint the line in question, as my text editor isn't great.  tongue

OK, seems like that is exactly the problem.
line 59 is, in our code, right after the body tag:
<? include(SRV_ROOT . '/includes/header.php'); ?>

I first want to point out that head.php and header.php aren't the same file, as the head and the header aren't the same thing on a web page.

head.php basically contains stylesheet and favicon information that is common to all pages on our site (which is why we used the include) and is outputted into the <head> element.

the visual navigation bar header, stored in header.php itself, is the blue top bar that helps users find their way throughout the site. It's part of the body of the site and has no special code.

So now, as for the error, could you paste us those few lines of code? You probably forgot a closing quote while replacing that text.

Offline

 

#323 2012-08-20 11:25:19

fg123
Scratcher
Registered: 2008-11-13
Posts: 1000+

Re: Scratch API 2.0

He says he can't exactly pinpoint the line, could you post the whole code for both files on something like pastebin, so we don't clog up the FluxBB database with code?  tongue

And backing onto topic, since sparks can't work on it, I guess I will do a little more testing and work to try to get this back and up and running...


Hai.

Offline

 

#324 2012-08-20 12:51:12

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

fg123 wrote:

He says he can't exactly pinpoint the line, could you post the whole code for both files on something like pastebin, so we don't clog up the FluxBB database with code?  tongue

And backing onto topic, since sparks can't work on it, I guess I will do a little more testing and work to try to get this back and up and running...

I meant please paste the lines around the include, which I said to be line 59  wink

It would be absolutely great if you worked on it, but whatever you do NEVER touch the viewer directory! I am actively creating the renderer.

Also, it's the third time I'm changing all the header items back to absolute links. Remember your backslashes  roll   tongue

Offline

 

#325 2012-08-20 17:46:43

LS97
Scratcher
Registered: 2009-06-14
Posts: 1000+

Re: Scratch API 2.0

(update)
I started the viewer and it's working pretty well so far (done error handling, database reading, and a couple of elements).
you can already kind of test it out by manually setting the database values

Offline

 

Board footer