Welcome to Gaia! ::

Reply THIS IS FECKIN' SATAH TERRITORY NOW, DUDES
Guess what this long line of code does. :o Goto Page: [] [<] 1 2 3

Quick Reply

Enter both words below, separated by a space:

Can't read the text? Click here

Submit

angryfisheatenbycat
Crew

Virtuous Saint

1,700 Points
  • Treasure Hunter 100
  • Dressed Up 200
  • Signature Look 250
PostPosted: Sun Jun 12, 2005 8:01 am


Drachyench_The_Eternal
The Satah
Mwa
DING DING DING! biggrin
I'll go through it when I've got time, k? :3
Satah, I'll also do whatever I promised when I have time. razz

*Par-tays!* ^_^

*Brings Party Mix.*
*hangs balloons from rafters*
PostPosted: Sun Jun 12, 2005 8:03 am


*Puts on the Casino music and turns it waaaay up* << >>

*Just got three giftboxes, twice in a row* O_O

emily swashbuckle
Captain

7,250 Points
  • Gender Swap 100
  • Nudist Colony 200
  • Risky Lifestyle 100

Drachyench

PostPosted: Sun Jun 12, 2005 8:04 am


The Satah
*Puts on the Casino music and turns it waaaay up* << >>

*Just got three giftboxes, twice in a row* O_O


Lucky...
PostPosted: Sun Jun 12, 2005 8:06 am


Drachyench_The_Eternal
Lucky...

*Is now out of tokens* ... e_e

emily swashbuckle
Captain

7,250 Points
  • Gender Swap 100
  • Nudist Colony 200
  • Risky Lifestyle 100

angryfisheatenbycat
Crew

Virtuous Saint

1,700 Points
  • Treasure Hunter 100
  • Dressed Up 200
  • Signature Look 250
PostPosted: Sun Jun 12, 2005 8:19 am


The Satah
Drachyench_The_Eternal
Lucky...

*Is now out of tokens* ... e_e
gonk
PostPosted: Sun Jun 12, 2005 9:09 am


First part of the explanation stuff:

I've seperated out the code to be more readable.
I have also returned the variables to their less cryptic names.
$theNum is now $number_of_pictures. The cookie 'cookie' is now 'mwarotate'.

header("location: ./".(
( ($number = (
($number_of_pictures = 7) &&
($temp = ( isset( $_COOKIE['mwarotate'] ) )?( $_COOKIE['mwarotate']+1):1) &&
($temp == $number_of_pictures)
)?0:$temp ) &&
( setcookie("mwarotate", $number, time()+60*60*24*365, "/") || 1 )
)?(
($number==0)? $number_of_pictures - 1 : $number - 1
) : "error" )
.".png")

It also just so happens that I've split the code up into blocks that I'm going to address one at a time.
But first, a bit of general knowlage that you need to know to understand this.
One;
Variables are text with the dollar sign in front of them. ($).
This means that it contains a value, that can be changed, using the = operator.

$variable = "Value";
$foo = "bar";

Code between brackets, ()s, is executed as it's reached, but the rest of the code pauses, and the brackets turn into a literal constant. (A value.)
Logic, true or false, is represented by the numbers 1 and 0, representing true and false respectively. In fact, anything except 0 and NULL evaluates to true.
The operator '==' seems rather strange at first, but it means 'If this and this is equal'. It evaluates as true if it is, and false if not.
'=' is an assignment operator. It evaluates to true if the assignment is successful.
This code uses the Ternary operator a lot. The syntax is "( expression to test)?value to return if expression is true:value to return if expression is false".
You can use this for assignment:

$foo = ( $Mwa == "1337" )?"bar":"wtf";

You can also use it in the middle of another expression.

$foo = ( $Mwa == "1337" )?((xhtml > HTML)?"bar":"flawed"):"wtf";


Onwards!

header("location: ./".(

The first line indicates that we are going to use the header(); function, which allows you to set the outgoing headers.
If you don't understand this, don't worry, all you need to know is that header( "Location: URL" ); will redirect the user to another page.
We speficy './' meaning in the current driectory, then close the speachmarks. We place a period, '.' to signify that this isn't the end of the string, and there is more to come.
Then we open the brackets that enclose the giant ternary operator that sets the URL that the user is redirected to.

Mwa


enshokukitsune
Vice Captain

PostPosted: Sun Jun 12, 2005 11:08 am


GAR. O.< I knew it! ...Well, sorta. But I did know it was a picture-thing, but I don't use the randomizers! gonk >__>;
PostPosted: Sun Jun 12, 2005 1:58 pm


Mwa
-snip-

That made my head hurt. cry

bathysphere

Reply
THIS IS FECKIN' SATAH TERRITORY NOW, DUDES

Goto Page: [] [<] 1 2 3
 
Manage Your Items
Other Stuff
Get GCash
Offers
Get Items
More Items
Where Everyone Hangs Out
Other Community Areas
Virtual Spaces
Fun Stuff
Gaia's Games
Mini-Games
Play with GCash
Play with Platinum