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

#76 2012-09-27 15:14:13

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

Re: Website Scripting (Official Topic)

mythbusteranimator wrote:

Ugh. And I STINK at PHP, did I mention that?  tongue

Don't worry, I do too  tongue

I plan to learn it for Scratch Art Gallery to automate users and uploads.


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

Offline

 

#77 2012-09-27 15:30:46

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Website Scripting (Official Topic)

funelephant wrote:

I want to create a login/registering process on a website I'm working on, but I don't know how to  tongue

Can I have any help?

I can't be bothered to write out a long piece of code so I'll just write the steps and let you work out the code  smile

1) Provide a form, containing username, password, etc.
2) Validate form, check the passwords match, etc. (the entered values will be in the $_POST array, with the keys being the name of the element
3) If everything is okay, connect to database and insert the values, else, display errors in a <ul>, and go back to step 1
4) Set the $_SESSION variables accordingly ($_SESSION variables travel from page to page so you can use the data on all pages). Make sure to do session_start(); before using any of the $_SESSION variables
5) Enjoy the registration form you've just made

Do the same for the login form, basically, except for step 4 don't insert the values, just check whether they're correct (e.g. whether there's a user with that password). Make sure to hash the passwords securely too

If you need account activation (where the user needs to go to a link sent to their email to activate their account, until then they won't have any priveleges) then I'd be happy to give it to you, it's quite complicated though


Why

Offline

 

#78 2012-09-27 15:34:44

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Website Scripting (Official Topic)

O_O

Now I really want to learn PHP....


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#79 2012-09-27 15:36:08

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Website Scripting (Official Topic)

c:


Why

Offline

 

#80 2012-09-27 16:18:47

Firedrake969
Scratcher
Registered: 2011-11-24
Posts: 1000+

Re: Website Scripting (Official Topic)

slinger wrote:

Copying and pasting will do you no good. You should follow a whole HTML tutorial then learn about the canvas tag.

I just want a squar canvas......


Click the sign.
https://s3.amazonaws.com/eterna/eterna2/logo2.png

Offline

 

#81 2012-09-27 16:23:09

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

Re: Website Scripting (Official Topic)

Firedrake969 wrote:

slinger wrote:

Copying and pasting will do you no good. You should follow a whole HTML tutorial then learn about the canvas tag.

I just want a squar canvas......

Are exactly do you mean by "canvas"? I know there's a tag, but do you mean that? Describe what you want.  tongue

I think you mean, a container. These are divs, like this:

Code:

<div style="width: 100px; height: 100px;">Inside</div>

Last edited by BirdByte (2012-09-27 16:23:55)


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

Offline

 

#82 2012-09-27 22:51:19

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Website Scripting (Official Topic)

Divs? Like dishes?

Loljk.  tongue


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#83 2012-09-28 07:18:34

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

Re: Website Scripting (Official Topic)

mythbusteranimator wrote:

Divs? Like dishes?

Loljk.  tongue

tongue


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

Offline

 

#84 2012-09-28 07:29:17

PikachuXionLover
Scratcher
Registered: 2012-09-02
Posts: 52

Re: Website Scripting (Official Topic)

[scratchblocks]
when gf clicked
forever
change color by (25)
think [people please make your sites good because they look interesting] for (2) secs


http://www.minecraftanonymous.com/assets/banners/banner_45.png

Offline

 

#85 2012-09-28 07:32:24

jontmy00
Scratcher
Registered: 2011-11-28
Posts: 1000+

Re: Website Scripting (Official Topic)

Please do not block spam. You can just type it out in text without the need of the blocks.


FOR ALL THE NEWS ON UPDATES FOR SIMPLISTICRAFT, CLICK HERE.

Offline

 

#86 2012-09-28 08:42:55

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Website Scripting (Official Topic)

jontmy00 wrote:

Please do not block spam. You can just type it out in text without the need of the blocks.

+1


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#87 2012-09-28 10:35:04

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Website Scripting (Official Topic)

I'm working on codeacademy and this is probably a stupid question, but what's wrong with my syntax here? The SyntaxError keeps giving me "errors" that if I corrected, would mess up the code. (Lesson is Functions in JavaScript: The lost numbers)

Code:

var isLost = function (n) {
  for (i=0, i<6, i++) {
    if ( n === lost[i]) {
      return;
    }
  }
}

Last edited by soupoftomato (2012-09-28 10:35:57)


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#88 2012-09-28 10:54:00

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Website Scripting (Official Topic)

soupoftomato wrote:

I'm working on codeacademy and this is probably a stupid question, but what's wrong with my syntax here? The SyntaxError keeps giving me "errors" that if I corrected, would mess up the code. (Lesson is Functions in JavaScript: The lost numbers)

Code:

var isLost = function (n) {
  for (i=0, i<6, i++) {
    if ( n === lost[i]) {
      return;
    }
  }
}

I'm not claiming to be an expert in JS so I wouldn't trust everything I say about it but I'm not sure if you can directly set a variable using a function in that way. I mean, I'd've thought you'd need to make the function first, then use a function call, if that makes sense

Also whatever happens, isLost would always be NULL, I think

EDIT; Oh wait, I spotted it. In the for loop, use semi-colons to separate the things, not commas. So,

for (i=0; i<6; i++)

not

for (i=0, i<6, i++)

Last edited by RedRocker227 (2012-09-28 10:54:58)


Why

Offline

 

#89 2012-09-28 10:56:14

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Website Scripting (Official Topic)

Ah, good job, Red. Got there before I could.  tongue
Yeah, I think that is probably the problem.  smile

Offline

 

#90 2012-09-28 10:57:17

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Website Scripting (Official Topic)

RedRocker227 wrote:

soupoftomato wrote:

I'm working on codeacademy and this is probably a stupid question, but what's wrong with my syntax here? The SyntaxError keeps giving me "errors" that if I corrected, would mess up the code. (Lesson is Functions in JavaScript: The lost numbers)

Code:

var isLost = function (n) {
  for (i=0, i<6, i++) {
    if ( n === lost[i]) {
      return;
    }
  }
}

I'm not claiming to be an expert in JS so I wouldn't trust everything I say about it but I'm not sure if you can directly set a variable using a function in that way. I mean, I'd've thought you'd need to make the function first, then use a function call, if that makes sense

Also whatever happens, isLost would always be NULL, I think

EDIT; Oh wait, I spotted it. In the for loop, use semi-colons to separate the things, not commas. So,

for (i=0; i<6; i++)

not

for (i=0, i<6, i++)

I declared the variable earlier but didn't copypaste it in to this thread.

However, thank you! I'm starting on the site again after a break so I forgot about needing semicolons there.

Also, that chunk isn't finished yet.

Last edited by soupoftomato (2012-09-28 10:58:51)


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#91 2012-09-28 10:58:45

RedRocker227
Scratcher
Registered: 2011-10-26
Posts: 1000+

Re: Website Scripting (Official Topic)

soupoftomato wrote:

RedRocker227 wrote:

soupoftomato wrote:

I'm working on codeacademy and this is probably a stupid question, but what's wrong with my syntax here? The SyntaxError keeps giving me "errors" that if I corrected, would mess up the code. (Lesson is Functions in JavaScript: The lost numbers)

Code:

var isLost = function (n) {
  for (i=0, i<6, i++) {
    if ( n === lost[i]) {
      return;
    }
  }
}

I'm not claiming to be an expert in JS so I wouldn't trust everything I say about it but I'm not sure if you can directly set a variable using a function in that way. I mean, I'd've thought you'd need to make the function first, then use a function call, if that makes sense

Also whatever happens, isLost would always be NULL, I think

EDIT; Oh wait, I spotted it. In the for loop, use semi-colons to separate the things, not commas. So,

for (i=0; i<6; i++)

not

for (i=0, i<6, i++)

I declared the variable earlier but didn't copypaste it in to this thread.

However, thank you! I'm starting on the site again after a break so I forgot about needing semicolons there.

Oh, okay

You're welcome


Why

Offline

 

#92 2012-09-28 11:24:12

soupoftomato
Scratcher
Registered: 2009-07-18
Posts: 1000+

Re: Website Scripting (Official Topic)

RedRocker227 wrote:

soupoftomato wrote:

RedRocker227 wrote:


I'm not claiming to be an expert in JS so I wouldn't trust everything I say about it but I'm not sure if you can directly set a variable using a function in that way. I mean, I'd've thought you'd need to make the function first, then use a function call, if that makes sense

Also whatever happens, isLost would always be NULL, I think

EDIT; Oh wait, I spotted it. In the for loop, use semi-colons to separate the things, not commas. So,

for (i=0; i<6; i++)

not

for (i=0, i<6, i++)

I declared the variable earlier but didn't copypaste it in to this thread.

However, thank you! I'm starting on the site again after a break so I forgot about needing semicolons there.

Oh, okay

You're welcome

Managed to pass with this:

Code:

var lost = [4, 8, 15, 16, 23, 42];
var count = lost.length;

var isLost = function (n) {
  for (var i=0; i<6; i++) {
    if ( n === lost[i]) {
        return true;
    }
  }
        return false;
};

if (isLost(12)) {
  console.log('12 is a lost number');
}

if ( isLost(16) ) {
  console.log('16 is a lost number');
}

http://i.imgur.com/x0ml8.png


I'm glad to think that the community will always be kind and helpful, the language will always be a fun and easy way to be introduced into programming, the motto will always be: Imagine, Program, Share - Nomolos

Offline

 

#93 2012-09-28 11:47:11

ProgrammingFreak
Scratcher
Registered: 2010-09-04
Posts: 1000+

Re: Website Scripting (Official Topic)

I feel exactly the same with my code most times. xD

Offline

 

#94 2012-09-28 11:58:12

mythbusteranimator
Scratcher
Registered: 2012-02-28
Posts: 1000+

Re: Website Scripting (Official Topic)

ProgrammingFreak wrote:

I feel exactly the same with my code most times. xD

+1
When I learn javascript, the same thing will happen.  lol


http://www.foxtrot.com/comics/2012-04-01-fdb37077.gif
clicky

Offline

 

#95 2012-09-28 22:58:50

PikachuXionLover
Scratcher
Registered: 2012-09-02
Posts: 52

Re: Website Scripting (Official Topic)

You are amazing. What I mean is everybody is amazing.  smile


http://www.minecraftanonymous.com/assets/banners/banner_45.png

Offline

 

#96 2012-09-28 23:04:46

PikachuXionLover
Scratcher
Registered: 2012-09-02
Posts: 52

Re: Website Scripting (Official Topic)

hey guys u dont need to code use the URL

http://kidswebsitecreator.com/#/build-a-site


http://www.minecraftanonymous.com/assets/banners/banner_45.png

Offline

 

#97 2012-09-29 08:20:05

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: Website Scripting (Official Topic)

PikachuXionLover wrote:

hey guys u dont need to code use the URL

http://kidswebsitecreator.com/#/build-a-site

*facepalm*

Hand coding outranks that stuff any day.

Offline

 

#98 2012-09-29 09:14:11

jji7skyline
Scratcher
Registered: 2010-03-08
Posts: 1000+

Re: Website Scripting (Official Topic)

Is that like weebly?  tongue


I don't know why you say goodbye, I say hello!  big_smile

Offline

 

#99 2012-09-29 09:34:03

funelephant
Scratcher
Registered: 2010-07-02
Posts: 1000+

Re: Website Scripting (Official Topic)

Yes.

I agree with Gravitation


nicki begs to differ
http://24.media.tumblr.com/ab0e6e8fd347c5e39c2821bcab9d16e6/tumblr_mgu35sui1L1rfb7aqo2_500.gif

Offline

 

#100 2012-09-30 10:40:38

Gravitation
New Scratcher
Registered: 2012-09-26
Posts: 500+

Re: Website Scripting (Official Topic)

I'm making a website for myself, you can see my progress on gravi.tation.tk (Best viewed in Chrome or Safari, but works in others too)

Offline

 

Board footer