Author Topic: ospap - Alpha1  (Read 27402 times)

0 Members and 1 Guest are viewing this topic.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
ospap - Alpha1
« on: September 14, 2005, 06:46:00 pm »
ospap = Open Source Photo Album Program. 

Well, I have something that works.  I'll let y'all give it a try, if you want. I have a demo site set up:
http://www.javaop.com/~iago/ospap/index.php
Or you can download the source:
http://www.javaop.com/~iago/ospap.tgz

To run it yourself, you need the "imagemagick" program installed (specifically, the 'convert' utility).  Using that was faster and easier than gd, so I'm sticking with it for now.  Plus, gd tended to crash on larger images, and that just wasn't cool!

What I need to do:
- Remember the last category used. - done
- Allow comment posting. - done
- Add a button to promote/demote users to/from admin (this can be done with admin.php?action=promote&user_id=##).
- Let a user mark their images as "private"
- Allow users to delete their own images/categories (or admins delete them)
<edit> - Make default background color of JPEG's not-black.  - don't think it's possible

Any other suggestions would be great!

Also, keep an eye out for XSS or SQL Injection or doing things a dumb way.  This is the first time I ever used PHP, so I might be doing some things wrong. :)

The Demo site doesn't require admin authorization (which will be required in the final version). Do what you want with it, and try to break it.  I'm going to wipe it before I call it done anyways. 


Good luck!
« Last Edit: September 15, 2005, 12:36:49 am by iago »

Offline Quik

  • Webmaster Guy
  • x86
  • Hero Member
  • *****
  • Posts: 3262
  • \x51 \x75 \x69 \x6B \x5B \x78 \x38 \x36 \x5D
    • View Profile
Re: ospap - Alpha1
« Reply #1 on: September 14, 2005, 07:12:59 pm »
Looks neat.

In your directory, what's that glowing thing in your lap? ;)
Quote
[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #2 on: September 14, 2005, 07:14:58 pm »
There are no pictures of me. 

Read the caption!

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #3 on: September 14, 2005, 07:21:54 pm »
Add line breaks in the error messages. :P

edit:
http://www.javaop.com/~iago/ospap/show_picture.php?picture_id=4#picture

Good work!  :-*
« Last Edit: September 14, 2005, 07:25:13 pm by Blaze »
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #4 on: September 14, 2005, 07:39:52 pm »
Add line breaks in the error messages. :P

edit:
http://www.javaop.com/~iago/ospap/show_picture.php?picture_id=4#picture

Good work!  :-*

Which error message? 

<edit> New rule: No WoW stuff! ;)

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #5 on: September 14, 2005, 07:42:51 pm »
Which error message? 
Failed Login

<edit> New rule: No WoW stuff! ;)
It was a test... and it worked.
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #6 on: September 14, 2005, 07:46:17 pm »
Oops, that message was for debugging, it shouldn't have even been there.  I fixed it. 

Offline Quik

  • Webmaster Guy
  • x86
  • Hero Member
  • *****
  • Posts: 3262
  • \x51 \x75 \x69 \x6B \x5B \x78 \x38 \x36 \x5D
    • View Profile
Re: ospap - Alpha1
« Reply #7 on: September 14, 2005, 08:00:22 pm »
There are no pictures of me.

Read the caption!


Haha, should have realized it was wires!
Quote
[20:21:13] xar: i was just thinking about the time iago came over here and we made this huge bomb and light up the sky for 6 min
[20:21:15] xar: that was funny

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #8 on: September 14, 2005, 08:12:16 pm »
Once I'm satisified with the whole thing, I'll post some pictures of myself.  Hopefully by early next week. 

Offline Towelie

  • pwnstar
  • x86
  • Hero Member
  • *****
  • Posts: 4873
    • View Profile
Re: ospap - Alpha1
« Reply #9 on: September 14, 2005, 08:54:22 pm »
what about guild wars pictures :-) ???

Offline AntiVirus

  • Legendary
  • x86
  • Hero Member
  • *****
  • Posts: 2521
  • Best
    • View Profile
Re: ospap - Alpha1
« Reply #10 on: September 14, 2005, 10:43:39 pm »
I guess I should delete my post that I posted right before I read this.. Lmao!!
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #11 on: September 14, 2005, 11:22:19 pm »
Moor Pictures > ospap

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #12 on: September 14, 2005, 11:35:50 pm »
Add a last updated timestamp on the users sections.
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #13 on: September 15, 2005, 12:43:29 am »
Add a last updated timestamp on the users sections.

That'll be a little trickier, but for sure!  I'll do that tomorrow. 

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #14 on: September 15, 2005, 09:09:40 pm »

Offline deadly7

  • 42
  • x86
  • Hero Member
  • *****
  • Posts: 6496
    • View Profile
Re: ospap - Alpha1
« Reply #15 on: September 15, 2005, 09:34:33 pm »
haha ron that thing is leet. You got pwned by the backstabbers. ;)
[17:42:21.609] <Ergot> Kutsuju you're girlfrieds pussy must be a 403 error for you
 [17:42:25.585] <Ergot> FORBIDDEN

on IRC playing T&T++
<iago> He is unarmed
<Hitmen> he has no arms?!

on AIM with a drunk mythix:
(00:50:05) Mythix: Deadly
(00:50:11) Mythix: I'm going to fuck that red dot out of your head.
(00:50:15) Mythix: with my nine

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #16 on: September 15, 2005, 11:02:08 pm »
Woah, 2 replies since I was fixing stuff!

Anyways, I just updated to ALPHA2.  It has the changes I suggested for myself in the first post.

My new to-do list:
- Show a "last updated" on each page
- On the main page, show categories/total pictures
<edit> - Number of comments
<edit> - Email on new comment to one of my images
<edit> - (Optional) Email on any new picture
« Last Edit: September 15, 2005, 11:52:23 pm by iago »

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #17 on: September 15, 2005, 11:37:39 pm »
Alpha 2's comments are a good idea. :)

Very good job so far iago.
And like a fool I believed myself, and thought I was somebody else...

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #18 on: September 15, 2005, 11:39:22 pm »
Unknown usernameLogin failed  Redirecting....
Hm, do I detect a bit of a.. missing <br />?

Please enter a password that is at least 6 characters (it's for your own protection!)
Security zealot.

# Redistribution and use in source and binary forms
/compile =p
« Last Edit: September 15, 2005, 11:44:58 pm by Joe[e2] »
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #19 on: September 15, 2005, 11:45:24 pm »
Unknown usernameLogin failed  Redirecting....
Hm, do I detect a bit of a.. missing <br />?
Bah, I fixed that, but overwrote the fix.  oops!

And no, I'm missing a <BR>.  I'm using HTML 4.01, not XHTML. 

Please enter a password that is at least 6 characters (it's for your own protection!)
Security zealot.
Well, anybody who uses a password shorter than 8 characters is stupid anyway.  My original requirement was 8-character passwords, but I decided to let people be dumb and use 6 characters passwords. 

And incidentally, the passwords are hashed; however, it's being sent over a plaintext link, so it's not totally safe. 

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #20 on: September 16, 2005, 07:38:56 am »
Couldn't they be scrambled clientside? I'll write a quck VBScript hash() function if you'd like.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #21 on: September 16, 2005, 08:33:54 am »
VBScript is garbage.  Primarely because it only works on Linux, but also because if you're allowing VBScript to be run on your computer, the website can do anything it wants to you.  I don't want to force people to do that. 

The other option is to do it in JavaScript.  But I don't like the idea of depending on JavaScript. 


Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #22 on: September 17, 2005, 12:55:19 pm »
Looking awesome, will check out source when I get my comp fixed. :)
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #23 on: September 17, 2005, 02:50:06 pm »
As far as I see it, VBScript is JavaScript in a different language. The only difference is the language="" variable of <script>, they even use the same tag to be executed.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #24 on: September 17, 2005, 03:05:56 pm »
Will it run on non-Windows systems? 

Perhaps I misunderstand VBScript, but I thought you need a Windows system for it?

Anyway, hashing it before sending still doesn't protect against replay attacks. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #25 on: September 17, 2005, 04:20:21 pm »
# Redistribution and use in source and binary forms
/compile =p

Hmm @ editing your post while I was replying, I didn't even see that. 

Yes, I'm aware that the license mentions binary forms.  And if somebody wants to compile PHP to a binary form (which is possible -- there's a program that converts PHP to C++, I'm told) and distribute it, I don't care.  I mostly left that in because I wanted to leave the BSD license intact. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #26 on: September 17, 2005, 11:37:43 pm »
I updated to Alpha3 just now.  I had to wipe the database, unfortunately.  I have completed all the goals for this version successfully, and think it's ready to post.  I shouldn't have to change the database anymore, so hopefully I won't have to wipe it again. 

Please, everybody, try it!  Try to break it!

And you can still get it at http://www.javaop.com/~iago/ospap.tgz

To-do:
- Handle newlines in comments properly
- "Cancel" after uploading picture
- Fix the "back" jumps
- Allow .bmp and other formats that "convert" can handle
- Display the newly-uploaded filename on the preview page (helps me with naming, others too probably)
- Allow each table to be sorted by different criteria
« Last Edit: September 17, 2005, 11:51:49 pm by iago »

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #27 on: September 18, 2005, 11:37:45 am »
To-do+:
make it templated/skinnable
edit thread title

Offline Towelie

  • pwnstar
  • x86
  • Hero Member
  • *****
  • Posts: 4873
    • View Profile
Re: ospap - Alpha1
« Reply #28 on: September 18, 2005, 08:05:55 pm »
should I hand out that site to freinds?

Offline AntiVirus

  • Legendary
  • x86
  • Hero Member
  • *****
  • Posts: 2521
  • Best
    • View Profile
Re: ospap - Alpha1
« Reply #29 on: September 18, 2005, 10:11:54 pm »
Make it not so dull looking.  Make it have some character. :D

[Edit]
I can't spell..
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #30 on: September 18, 2005, 10:27:25 pm »
Make it not so dull looking.  Make it have some character. :D

[Edit]
I can't spell..
iago doesn't do layouts.

rabbit's already provided the solution to your request, though.
To-do+:
make it templated/skinnable
edit thread title

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #31 on: September 18, 2005, 11:43:49 pm »
should I hand out that site to freinds?

At this point, you can, provided they know that I may wipe it if I need to.  When I decide that I'm done with it (hopefully soon)  then sure!

iago doesn't do layouts.
Damn right!


rabbit's already provided the solution to your request, though.
To-do+:
make it templated/skinnable
edit thread title
Yeah, somebody else (Romi, I think?) asked me to do that as well. 

Perhaps this belongs in a different thread, but what's the common way to make a php program skinnable? I can think of ways, but I'm sure there's a "right way" (or maybe common way).. can somebody shared?

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #32 on: September 19, 2005, 12:26:47 am »
Hm.  Not realy.  Most programs have their own, custom template engine and several template files.  As an example, a template file for a news post may look like:

Code: [Select]
Posted by <b>{postedBy}</b> at <b>{postedTime}</b> on <b>{postedDate}</b>
<hr />
<h3>{title}</h3>
{text}

This is just a very simple example.  I'm sure you get the idea.  :)

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #33 on: September 19, 2005, 12:50:24 am »
should I hand out that site to freinds?

Quote
Try to break it!

He sounds confident about its stability to me. =p
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #34 on: September 19, 2005, 02:39:50 pm »
Hm.  Not realy.  Most programs have their own, custom template engine and several template files.  As an example, a template file for a news post may look like:

Code: [Select]
Posted by <b>{postedBy}</b> at <b>{postedTime}</b> on <b>{postedDate}</b>
<hr />
<h3>{title}</h3>
{text}

This is just a very simple example.  I'm sure you get the idea.  :)
Cool. 

Next question then: how do you parse that?  I know that regex's are pretty slow, especially doing them every line, but is there a better way to do it in PHP?

should I hand out that site to freinds?

Quote
Try to break it!

He sounds confident about its stability to me. =p
The best way to break it is to let lots of people to use it. 

Another thing, though, I don't plan on using ads or anything like that, so if a lot of people are using it, and I can't handle it with my connection, I will have to make it private.  That, or be a whore and put an ad on it to make enough money to pay for a real connection :).  But I don't see that happening. 

Offline AntiVirus

  • Legendary
  • x86
  • Hero Member
  • *****
  • Posts: 2521
  • Best
    • View Profile
Re: ospap - Alpha1
« Reply #35 on: September 19, 2005, 04:54:40 pm »
Quote
That, or be a whore and put an ad on it to make enough money to pay for a real connection Smiley.  But I don't see that happening.
Private sounds good to me. :D
The once grove of splendor,
Aforetime crowned by lilac and lily,
Lay now forevermore slender;
And all winds that liven
Silhouette a lone existence;
A leafless oak grasping at eternity.


"They say that I must learn to kill before I can feel safe, but I rather kill myself then turn into their slave."
- The Rasmus

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #36 on: September 19, 2005, 06:58:44 pm »
I really don't want it to be private :-/

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #37 on: September 19, 2005, 07:03:16 pm »
Why not ask Thing for some bandwith then, hes good like that. :)
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #38 on: September 19, 2005, 07:08:47 pm »
Lately, whenever I talk to him, he always seems pretty hostile.  I assume it's because he's always busy (what with WoW and stuff), and I just annoy him.  Half the time he doesn't reply. 

So yeah, I don't want to bug him. 

The image sizes are pretty small, though.  The biggest one is 103kb.  640x480 with 85% compression is pretty good.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #39 on: September 19, 2005, 09:03:14 pm »
str_replace usually, iago.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #40 on: September 19, 2005, 09:53:04 pm »
Awesome, I'll do that for the next release :D

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #41 on: September 19, 2005, 10:03:37 pm »
Well, this is the best photo album I've ever seen, and will be using it instead of my own code when I get a server up.  Amazing job, iago.
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #42 on: September 20, 2005, 12:06:22 am »
Well, this is the best photo album I've ever seen, and will be using it instead of my own code when I get a server up.  Amazing job, iago.

Thanks :-D

Feel free to host images on mine, at least, once it's done.  I doubt I'll be wiping the db again, but you never know :)

Offline Newby

  • x86
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: ospap - Alpha1
« Reply #43 on: September 20, 2005, 01:31:24 am »
You should thank me for the name! =P
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #44 on: September 20, 2005, 09:38:59 am »
This may or may not be a "working name".  I still haven't decided whether or not I love it :)

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #45 on: September 20, 2005, 09:46:25 am »
Question: What about for the tables and the album page?  In a template, how would you indicate a list? 

Again, I could figure this out myself, but there is probably a "right"er way of doing it :)

<edit> Also, do you think each user should be able to choose a different template for his pages?  Or an individual template for each category, maybe?

<edit2> To answer my first question, I've decided to go with a .php template system, like SMF does.  Hopefully that'll work out ok, it seems like the better way for what I need to do :)

<edit3> Warning: once I get this template stuff set up, I'm probably going to wipe the database again, so don't bother uploading anything complicated :)
« Last Edit: September 20, 2005, 10:11:37 am by iago »

Offline Newby

  • x86
  • Hero Member
  • *****
  • Posts: 10877
  • Thrash!
    • View Profile
Re: ospap - Alpha1
« Reply #46 on: September 20, 2005, 05:24:30 pm »
I liked OPM (opium) more, but eh, ospap for the win! ;p
- Newby
http://www.x86labs.org

Quote
[17:32:45] * xar sets mode: -oooooooooo algorithm ban chris cipher newby stdio TehUser tnarongi|away vursed warz
[17:32:54] * xar sets mode: +o newby
[17:32:58] <xar> new rule
[17:33:02] <xar> me and newby rule all

I'd bet that you're currently bloated like a water ballon on a hot summer's day.

That analogy doesn't even make sense.  Why would a water balloon be especially bloated on a hot summer's day? For your sake, I hope there wasn't too much logic testing on your LSAT. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #47 on: September 20, 2005, 05:51:20 pm »
Why do you wipe the DB anyway, iago?  =p

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #48 on: September 20, 2005, 08:25:24 pm »
Because I want to make sure my create_tables.sql file works, and because dropping the tables is easier than modifying them :)

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #49 on: September 20, 2005, 09:30:08 pm »
ALPHA 1 IS NO LONGER!!!!

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #50 on: September 20, 2005, 11:14:35 pm »
Because I want to make sure my create_tables.sql file works, and because dropping the tables is easier than modifying them :)
Is create_talbes.sql a sort of installation file?

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #51 on: September 21, 2005, 08:30:14 am »
Because I want to make sure my create_tables.sql file works, and because dropping the tables is easier than modifying them :)
Is create_talbes.sql a sort of installation file?
Yes. 

mysql -u root -p -D ospap < create_tables.sql

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #52 on: September 21, 2005, 09:10:54 am »
Yes. 

mysql -u root -p -D ospap < create_tables.sql
Just put them in a different database! :)

Offline Mythix

  • The Dude
  • x86
  • Hero Member
  • *****
  • Posts: 1569
  • Victory
    • View Profile
    • Dark-Wire
Re: ospap - Alpha1
« Reply #53 on: September 21, 2005, 11:57:42 am »
I suggest on your next major release, you dub the version "Opium". I'll even make you a catchy slogan for it!
Philosophy, n. A route of many roads leading from nowhere to nothing.

- Ambrose Bierce


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #54 on: September 21, 2005, 02:36:05 pm »
Yes. 

mysql -u root -p -D ospap < create_tables.sql
Just put them in a different database! :)
What difference would that make? Once I change how the database is being used, the original database is completely useless.  It doesn't contain the proper columns!

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #55 on: September 21, 2005, 04:49:06 pm »
You should make a column for the database version, and have a routine in the code to upgrade the database.
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #56 on: September 21, 2005, 04:57:12 pm »
Two problems there
1. I don't plan on changing the database, which isn't a big deal; but
2. I don't want to give my mysql user that much power over the database.  He has select/insert/update/delete, and that's all I'm comfortable with.  I don't even want create/drop. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #57 on: September 21, 2005, 05:21:45 pm »
Or make new code in a different area, and assign it to another database containing the other tables.  It's your project though, so there's no use in me arguing lol.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #58 on: September 22, 2005, 02:05:04 am »
Or make new code in a different area, and assign it to another database containing the other tables.  It's your project though, so there's no use in me arguing lol.

Well, arguing is good, because it helps me learn! I've never used PHP before this, and I've never used MySQL from a user perspective either. 

I don't really understand what you're saying.  What do you mean by "different area"? 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #59 on: September 22, 2005, 09:15:56 am »
Make a copy of the files, then have it get its information from a different database (a near copy of the one that your users are using).  Then you can apply the changes when you're sure it works.  :)

Also -- if you run your queries correctly, you can add and drop columns with little problems.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #60 on: September 22, 2005, 11:26:58 am »
Ah, ok.  That would be useful in a production-type system, but this is "Alpha" and I tell people I'm going to be wiping it when I need to, so it's not such a big deal :)


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #61 on: September 22, 2005, 12:54:07 pm »
Ah, ok.  That would be useful in a production-type system, but this is "Alpha" and I tell people I'm going to be wiping it when I need to, so it's not such a big deal :)


hehe.  :)

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #62 on: September 23, 2005, 08:39:33 pm »
Ok, I did some adding.  I added skinnability, but I suck at design so I just made a boring skin modelled after vL's old forum. 

To-do:
- Fix require_authorization
- Fix require_registration
- Add more comments to default skin
- Extra information in the categories table (owner, private)

http://www.javaop.com/~iago/ospap/index.php
http://www.javaop.com/~iago/ospap.tgz

Let me know what you think!  And if somebody is feeling energetic, make me a skin.  Or even design the pages in static html, and I'll convert them to PHP, that's fine too. 

« Last Edit: September 24, 2005, 12:26:13 am by iago »

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #63 on: September 23, 2005, 11:07:52 pm »
Very, very nice work iago.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #64 on: September 24, 2005, 12:20:44 am »
:)

Question1: Do you think users should be able to choose their own skins that they view?
I'm thinking no, because the person running the album might want it to have a particular look and feel, depending on what he's doing with it. 

Question2: Should users be able to choose skins for each of their categories?
I'm thinking yes, because some categories might be special (Christmas one, for example).  But I'm also thinking no, because the skin changing from page-to-page might be a little annoying to users. 

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #65 on: September 24, 2005, 12:30:00 am »
Question1: I agree.
Question2: Maybe a user preference to not show the theme?
And like a fool I believed myself, and thought I was somebody else...

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #66 on: September 24, 2005, 12:36:48 am »
#1 - No.

#2 - No.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #67 on: September 24, 2005, 01:43:56 am »
#1 - No.

#2 - No.

I like those answers best, because that's how it is now and I don't have to implement anything new :)

Offline Mythix

  • The Dude
  • x86
  • Hero Member
  • *****
  • Posts: 1569
  • Victory
    • View Profile
    • Dark-Wire
Re: ospap - Alpha1
« Reply #68 on: September 24, 2005, 02:39:44 am »
It's not about you, its the "consumer"

yes to both.
Philosophy, n. A route of many roads leading from nowhere to nothing.

- Ambrose Bierce


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #69 on: September 24, 2005, 03:01:42 am »
It's not about you, its the "consumer"

yes to both.
I was actually thinking in the mindset of the type of program it is, not just the amount of work iago would have to put in to implement these features.

Quote
I'm thinking no, because the person running the album might want it to have a particular look and feel, depending on what he's doing with it. 
No.
Justification:  What iago said.  The user may have a look/feel that they want to go along with that album, and allowing users to automatically overwrite that (often without their knowledge -- they probably won't know that the set template is different then the one they've specified they want globally) doesn't really seem sensical to me.

Quote
Question2: Should users be able to choose skins for each of their categories?
I'm thinking yes, because some categories might be special (Christmas one, for example).  But I'm also thinking no, because the skin changing from page-to-page might be a little annoying to users. 
No.
Justification:  What iago said.  I don't know about you, but I really don't like having a layout change on me that often.  Especially when navigation and things of this manner are changed (which they often are from template to template).

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: ospap - Alpha1
« Reply #70 on: September 25, 2005, 05:18:56 pm »
A couple of suggestions instead of doing things like

function display_footer()
{
	
print(
"<HR>\n");
	
print(
"Written by <A HREF=\"mailto:iago@valhallalegends.com\">Ron Bowes</A>, 2005.  Comments welcome!\n");
	
print(
"</BODY>\n");
	
print(
"</HTML>\n");
}

in the skins try something like

function display_footer()
{
	
$footer = <<< FOOTER
<HR>
Written by <A HREF="mailto:iago@valhallalegends.com">Ron Bowes</A>, 2005.  Comments welcome!
</BODY>
</HTML>

FOOTER;
	
print(
$footer);
}

Much friendlier when you want to go and change it.

Also when viewing images you should use Previous/Next vs the image's title because it makes it nicer and prevents someone from making a short title and forcing me to move my mouse.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #71 on: September 25, 2005, 05:21:36 pm »
I'd recommend making a file 'header.php' or something to that affect.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #72 on: September 25, 2005, 06:26:01 pm »
A couple of suggestions instead of doing things like

function display_footer()
{
	
print(
"<HR>\n");
	
print(
"Written by <A HREF=\"mailto:iago@valhallalegends.com\">Ron Bowes</A>, 2005.  Comments welcome!\n");
	
print(
"</BODY>\n");
	
print(
"</HTML>\n");
}

in the skins try something like

function display_footer()
{
	
$footer = <<< FOOTER
<HR>
Written by <A HREF="mailto:iago@valhallalegends.com">Ron Bowes</A>, 2005.  Comments welcome!
</BODY>
</HTML>

FOOTER;
	
print(
$footer);
}

Much friendlier when you want to go and change it.
I personally like print's better, in every language I've used I've stuck with that, but since I hope that Templates will be used by others, I'll change it. 

Also when viewing images you should use Previous/Next vs the image's title because it makes it nicer and prevents someone from making a short title and forcing me to move my mouse.
Good point.  Why don't you hover your mouse over the arrow ("-->"), since that doesn't move?  I'll fix that up anyway

Thanks!

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #73 on: September 25, 2005, 11:08:46 pm »
I think your picture.php is broken right now, none of the pictures are working.
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #74 on: September 26, 2005, 03:13:07 pm »
hmm, they work for me!

Can you view the picture alone (right click -> view image), then view source.  Is there some kind of english text being stuck in there?

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #75 on: September 26, 2005, 10:32:18 pm »
Your username is Blaze, but it requires authorization by an administrator<BR>In the meantime, you can log into a different account<BR><HR>

:-\
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #76 on: September 26, 2005, 10:55:19 pm »
Fixed!

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #77 on: September 26, 2005, 11:05:09 pm »
http://www.javaop.com/~iago/ospap/show_category.php?category_id=6
Quote
Error!
invalid category_id
After logging out in my private category, and it keeps refreshing.

Thats two so far. :P
And like a fool I believed myself, and thought I was somebody else...

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #78 on: September 27, 2005, 10:37:48 am »
Hmm, yeah, I could see that..

Ok, I'll make it so if it has to refresh more than once, it'll refresh to index.php :)

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #79 on: October 10, 2005, 10:08:53 pm »
Sorry for digging up this topic, but I have a quick suggestion for you iago.

As you've probably noticed, thumbnails that are generated on the fly aren't cached, which can be somewhat annoying when you're navigating through a photo album like that.

You may want to consider generating a thumbnail file for each picture added to your gallery.

Offline deadly7

  • 42
  • x86
  • Hero Member
  • *****
  • Posts: 6496
    • View Profile
Re: ospap - Alpha1
« Reply #80 on: October 10, 2005, 11:58:03 pm »
Why not just have a link to the image where if it's bigger then say, 300w or 300h then make it have one side that is 300 w/h?
Example: I uploaded a 300x300 file. It stays that size, that's "thumbnail" size.
I uploaded a 500x400 file.  It reduces in size by 25% to 375 x 300
[17:42:21.609] <Ergot> Kutsuju you're girlfrieds pussy must be a 403 error for you
 [17:42:25.585] <Ergot> FORBIDDEN

on IRC playing T&T++
<iago> He is unarmed
<Hitmen> he has no arms?!

on AIM with a drunk mythix:
(00:50:05) Mythix: Deadly
(00:50:11) Mythix: I'm going to fuck that red dot out of your head.
(00:50:15) Mythix: with my nine

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #81 on: October 11, 2005, 12:20:43 am »
Because that's a waste of bandwidth.

Since all thumbnails are displayed at the same size (or nearly the same size), resizing them in the image HTML tag is a complete waste of resources.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #82 on: October 11, 2005, 08:04:05 pm »
I generate thumbnails when images are uploaded. 


Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #83 on: October 11, 2005, 08:14:44 pm »
Oh?

http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22

That's the URL to one of your picture thumbnails.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #84 on: October 11, 2005, 08:21:27 pm »
Oh?

http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22

That's the URL to one of your picture thumbnails.

Yep, and that loads the thumbnail file:
Quote
        if(isset($_GET['tn']) && $_GET['tn'] == "true")
                $tn = true;
        else
                $tn = false;

// ...................

        if($tn == true)
                show_image("$upload_directory/tn-$file");
        else
                show_image("$upload_directory/$file");

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #85 on: October 11, 2005, 09:25:46 pm »
Oh, I see what you're doing.

However, you may want to veer form using that methodology because it still prevents the thumbnails from caching.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #86 on: October 11, 2005, 11:21:13 pm »
Does it? I made sure I didn't put header("pragma: no-cache") in the thumbnail code.. :/

I wanted to make it possible to have "private" images, and to do that it has to go through the .php file. 

Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #87 on: October 11, 2005, 11:24:31 pm »
Couldn't people just type in the picture name manually then?
And like a fool I believed myself, and thought I was somebody else...

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #88 on: October 12, 2005, 12:52:17 am »
Yeah, the thumbnails don't cache -- it's annoying for navigating, but I suppose it makes sense if you're trying to accomplish some level of private-ness.

Additionally, if you want images to be REALLY private, you could store them in a mysql database as blob data.

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: ospap - Alpha1
« Reply #89 on: October 12, 2005, 02:47:54 am »
You should be able to append a .jpg/.gif/.whatever to the end of the url and have the browser cache it. Then use mod_rewrite or such on the server to fix it so that it gets processed by the php script.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #90 on: October 12, 2005, 06:00:48 pm »
You should be able to append a .jpg/.gif/.whatever to the end of the url and have the browser cache it. Then use mod_rewrite or such on the server to fix it so that it gets processed by the php script.

The thumbnail files do end in image extentions, but he's listing them in the gallery using his php script to load them.  He wanted to do that so the URL's of the thumbnails weren't public, but I'm suggesting that he doesn't load them through the script because they don't cache.

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: ospap - Alpha1
« Reply #91 on: October 12, 2005, 11:10:02 pm »

The thumbnail files do end in image extentions, but he's listing them in the gallery using his php script to load them.  He wanted to do that so the URL's of the thumbnails weren't public, but I'm suggesting that he doesn't load them through the script because they don't cache.

No they don't.
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22
Doesn't look like an image extention to me.

What I am suggesting is that he could do
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg
or
Code: [Select]
http://www.javaop.com/~iago/ospap/picture/tn-22.jpg
and then use mod_rewrite to force his php script (picture.php) to handle the request. This will allow browsers to cache the images but also allow access control in the event of private images.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #92 on: October 12, 2005, 11:39:42 pm »

The thumbnail files do end in image extentions, but he's listing them in the gallery using his php script to load them.  He wanted to do that so the URL's of the thumbnails weren't public, but I'm suggesting that he doesn't load them through the script because they don't cache.

No they don't.
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22
Doesn't look like an image extention to me.

What I am suggesting is that he could do
Code: [Select]
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg
or
Code: [Select]
http://www.javaop.com/~iago/ospap/picture/tn-22.jpg
and then use mod_rewrite to force his php script (picture.php) to handle the request. This will allow browsers to cache the images but also allow access control in the event of private images.

I don't think the prior would work (I know you could get it to work, but it would defeat the purpose of what you're trying to accomplish), but the second thing you suggested is what I recommended to begin with.

Offline zorm

  • Hero Member
  • *****
  • Posts: 591
    • View Profile
    • Zorm's Page
Re: ospap - Alpha1
« Reply #93 on: October 12, 2005, 11:52:27 pm »
I don't think the prior would work (I know you could get it to work, but it would defeat the purpose of what you're trying to accomplish), but the second thing you suggested is what I recommended to begin with.

Its not at all, stop getting caught up in the urls and go read+learn about lovely things like mod_rewrite.
"Frustra fit per plura quod potest fieri per pauciora"
- William of Ockham

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #94 on: October 13, 2005, 12:04:13 am »
Hmm, that seems like a lot of trouble :-/

And yeah, if they're stored on a public path, then yeah, they can be viewed by directly typing in the URL.  But I don't store them on a public path. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #95 on: October 13, 2005, 12:15:07 am »
* Sidoh shrugs.

'twas a simple suggestion.  :P

I don't really see the big deal behind having users knowing the URL to the thumbnail files.  :P
« Last Edit: October 13, 2005, 12:17:09 am by Sidoh »

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #96 on: October 13, 2005, 09:14:57 pm »
Whats that checkbox next to "Create" do? (Create a category)

Log me in immediatly after registering =)
I'd personally do as Joe suggests

You might be right about that, Joe.


Offline Blaze

  • x86
  • Hero Member
  • *****
  • Posts: 7136
  • Canadian
    • View Profile
    • Maide
Re: ospap - Alpha1
« Reply #97 on: October 14, 2005, 01:17:51 pm »
Whats that checkbox next to "Create" do? (Create a category)
Makes the category private, if you read the mouse over. :P
And like a fool I believed myself, and thought I was somebody else...

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #98 on: October 14, 2005, 08:14:28 pm »
Yep, and that loads the thumbnail file:
Quote
        if(isset($_GET['tn']) && $_GET['tn'] == "true")
                $tn = true;
        else
                $tn = false;

// ...................

        if($tn == true)
                show_image("$upload_directory/tn-$file");
        else
                show_image("$upload_directory/$file");

Your code could be more efficient ^^
IE: $tn is already assigned the value of $_GET['tn'], and since there is no type declaration, you can use true instead of "true".  There, I just saved you a cycle or two.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #99 on: October 14, 2005, 08:28:36 pm »
Hehe.

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #100 on: October 14, 2005, 10:34:34 pm »
Yep, and that loads the thumbnail file:
Quote
        if(isset($_GET['tn']) && $_GET['tn'] == "true")
                $tn = true;
        else
                $tn = false;

// ...................

        if($tn == true)
                show_image("$upload_directory/tn-$file");
        else
                show_image("$upload_directory/$file");

Your code could be more efficient ^^
IE: $tn is already assigned the value of $_GET['tn'], and since there is no type declaration, you can use true instead of "true".  There, I just saved you a cycle or two.

Yeah, but I like my way better.  It's a little more clear to read, in my opinion. 

I really hate untyped languages.  I even like Perl, which lets me declare variables (my $var), but php doesn't let me declare the existance of a variable.  That bugs me. 

But yeah, a couple cycles isn't worth a reduction in clarity. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #101 on: October 14, 2005, 10:58:08 pm »
Yes it does.

Code: [Select]

class img {

  var $img;
  var $color_back;

  ...

}

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #102 on: October 14, 2005, 11:22:54 pm »
Hell, you don't even need a class to do it :\

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #103 on: October 14, 2005, 11:35:38 pm »
Is there some way to make it show an error if you don't declare variables like that?

On Perl, it's "use strict;"

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #104 on: October 15, 2005, 02:01:11 am »
Hell, you don't even need a class to do it :\
Hehe, yeah.  Was just an example.  :)

Is there some way to make it show an error if you don't declare variables like that?

On Perl, it's "use strict;"
You might check in php.ini, but I kinda doubt it's possible.  All PHP articles/books I've read state that PHP variable declarations are soley implicit (at least the datatype can never be explicitly defined, or at least that I'm aware of).

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #105 on: October 15, 2005, 11:31:26 am »
Is there some way to make it show an error if you don't declare variables like that?

On Perl, it's "use strict;"
Use error_reporting(E_ALL); at the beginning of your core file (IE: the one that's always there, like the index.php or something).  It will throw a warning when you use a variable that isn't $_GET[], $_POST[], $_SESSION[], or my.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #106 on: October 15, 2005, 11:36:05 am »
There's also this entry in the php.ini file which usually (by default, on my box anyway) this:

Code: [Select]
error_reporting  = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
Obviously, just change it to:

Code: [Select]
error_reporting = E_ALL
However, that's not going to stop your code from running, it will just display a Notice.

Offline rabbit

  • x86
  • Hero Member
  • *****
  • Posts: 8092
  • I speak for the entire clan (except Joe)
    • View Profile
Re: ospap - Alpha1
« Reply #107 on: October 15, 2005, 11:51:55 am »
Just a note: using the error_reporting() function is easier than changing the PHP hard configuration.

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #108 on: October 15, 2005, 11:56:19 am »
Just a note: using the error_reporting() function is easier than changing the PHP hard configuration.
Not if you want to make a global change on your server.  :P

It's easier to develop with E_ALL on in PHP.ini, then you don't have to worry about removing it when you deploy it (because people don't like error reporting in E_ALL, especially on scripts that are included as an addon or something to that affect).

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #109 on: October 16, 2005, 03:54:46 pm »
Install a custom error handlers in your PHP code and treat the notices as fatal exceptions and exit your code.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #110 on: October 16, 2005, 05:01:39 pm »
Install a custom error handlers in your PHP code and treat the notices as fatal exceptions and exit your code.
That would be way too much work for such a silly thing.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #111 on: October 16, 2005, 06:38:10 pm »
It's surprisingly easy but yea I think it might be overdoing it a bit. Should help for other things though too.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #112 on: October 16, 2005, 10:08:33 pm »
It's surprisingly easy but yea I think it might be overdoing it a bit. Should help for other things though too.
I know, I've done it before.  There's other unseen issues that it would affect too though.  Doing it would be stupid.  It's like having a car that doesn't work if it doesn't make a sound when the driver's side door is open.  Quite useless.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #113 on: October 16, 2005, 10:16:32 pm »
You can of course filter the notice messages to the one you need :p
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #114 on: October 16, 2005, 10:19:04 pm »
You can of course filter the notice messages to the one you need :p
Quite useless.

: - P

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #115 on: October 17, 2005, 12:07:08 am »
Don't see how it's still useless if I showed how it could be singled out into one exception and handled from there instead of making the entire thing croak becauause of every notice. (Even though IMHO it should, it enforces nice programming)

One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #116 on: October 17, 2005, 12:57:19 am »
Don't see how it's still useless if I showed how it could be singled out into one exception and handled from there instead of making the entire thing croak becauause of every notice. (Even though IMHO it should, it enforces nice programming)

I don't understand how not explicitly defining variables in a language that doesn't require it (or even imply that you should, unlike Visual Basic) is "nice programming."  PHP's variable declarations work completely well when defined implicitly and I don't see a purpose in forcing code to define them explicitly.  It's just stupid.

Having code croak on every notice would be stupid for the lack of a better word.

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #117 on: October 17, 2005, 05:38:05 am »
Forcing all variables to be declared not only helps when debugging code, wait sometimes it eliminates the need to debug since the reason is right there. I fail to see where there is no advantage to this.
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline iago

  • Leader
  • Administrator
  • Hero Member
  • *****
  • Posts: 17914
  • Fnord.
    • View Profile
    • SkullSecurity
Re: ospap - Alpha1
« Reply #118 on: October 17, 2005, 08:43:02 am »
You *should* declare all of a functions's variables at the top of the function, along with comments on what they do.  It helps you keep them straight, it forces you to stop and think about what you're doing, and it *greatly* helps anybody else who is looking at your code.  Doing it that way really is *nice* code.  Maybe it's not SO important in PHP, but right now I'm doing low level microcontroller programming, and it's very important. 

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #119 on: October 17, 2005, 01:11:20 pm »
It's not important in PHP.  Debugging is a pretty negligible challenge in PHP, IMO.

Warrior, I'm not saying there's no advantage, I'm just saying its a moot effort.  It's trying to make PHP something it's not.  You're adding another unnecessary failure point.

Besides, if you use intuitive, predictable variable names, it doesn't do much for you declaring them at the beginning of a function.  Most PHP code I use is outside of a function anyway.  Most variables I handle are in a superglobal array, so moving them to a variable of lower scope is often a waste of time and resources.

Secondly, since variable types in PHP are determined completely by implicit methods, declaring variables doesn't increase the clarity of the code by that much.  Declaring a variable in PHP (obviously) would look like this:

Code: [Select]
$int_variable = 0;
$str_variable = '0';
$flt_variable = '1.0';
$bol_variable = true;

Declaring a variable's scope in PHP is obviously a different story.  I ALWAYS do this because not doing it is a complete waste of time, cleanliness of code and intelligence.  If you have something like:

Code: [Select]
$db = new mysql_db();

function get_username($user_id, $db) {
  // ...
}

get_username(1, $db);

It's pretty stupid when you can save a lot of trouble by doing:

Code: [Select]
$db = new mysql_db();

function get_username($user_id) {
   global $db;

   // ...
}

get_username(1);
« Last Edit: October 17, 2005, 01:22:05 pm by Sidoh »

Offline Warrior

  • supreme mac daddy of trolls
  • Hero Member
  • *****
  • Posts: 7503
  • One for a Dime two for a Quarter!
    • View Profile
Re: ospap - Alpha1
« Reply #120 on: October 17, 2005, 03:43:18 pm »
You..actually use globals?
One must ask oneself: "do I will trolling to become a universal law?" And then when one realizes "yes, I do will it to be such," one feels completely justified.
-- from Groundwork for the Metaphysics of Trolling

Offline Sidoh

  • x86
  • Hero Member
  • *****
  • Posts: 17634
  • MHNATY ~~~~~
    • View Profile
    • sidoh
Re: ospap - Alpha1
« Reply #121 on: October 17, 2005, 04:08:53 pm »
You..actually use globals?
Sometimes complexity makes code suck, you need to realize this.  Developing some huge class hierarchy for some things is not only a complete waste of time, but you get caught up in doing that and it makes the entire system run slower and less efficiently.

This is straight from SMF's Sources/Profile.php.  Unmodified (but clipped because I didn't want to copy the entire function).

Code: [Select]
function saveProfileChanges(&$profile_vars, &$post_errors, $memID)
{
        global $db_prefix, $user_info, $txt, $modSettings, $user_profile, $newpassemail, $valida$

        // These make life easier....
        $old_profile = &$user_profile[$memID];

        // Permissions...
        if ($context['user']['is_owner'])
        {
                $changeIdentity = allowedTo(array('profile_identity_any', 'profile_identity_own'$
                $changeOther = allowedTo(array('profile_extra_any', 'profile_extra_own'));
        }
        else
        {
                $changeIdentity = allowedTo('profile_identity_any');
                $changeOther = allowedTo('profile_extra_any');
        }

Note the global.  :P

Don't think that I'm not capable of developing a class hierarchy, because it's quite easy.  However, there's just some things in which it's worth isn't quite good enough.
« Last Edit: October 17, 2005, 04:11:56 pm by Sidoh »

Offline Joe

  • B&
  • x86
  • Hero Member
  • *****
  • Posts: 10319
  • In Soviet Russia, text read you!
    • View Profile
    • Github
Re: ospap - Alpha1
« Reply #122 on: December 29, 2005, 11:17:14 pm »
Resurrected from the depths of page three, suggestion!

You might want to line up those rebelious textboxes in your register section.

Log in:<BR>
  <FORM ACTION="login.php" METHOD="POST">
    <TABLE>
      <TR><TD>Username:</TD> <TD><INPUT TYPE="text" NAME="username"></TD></TR>
      <TR><TD>Password:</TD> <TD><INPUT TYPE="password" NAME="password"></TD></TR>
      <TR><TD><INPUT TYPE="submit" VALUE="Log in"></TR><TD>
    </TABLE>
  </FORM>
<HR>
If you haven't registered already, register an account:<BR>

  <FORM ACTION="create_account.php" METHOD="post">
    <TABLE>
      <TR><TD>Username:</TD> <TD><INPUT TYPE="text" NAME="username" VALUE=""></TD></TR>
      <TR><TD>Password:</TD> <TD><INPUT TYPE="password" NAME="password" VALUE=""></TD></TR>
      <TR><TD>Confirm:</TD>  <TD><INPUT TYPE="password" NAME="password2" VALUE=""></TD></TR>
      <TR><TD>Email:</TD>    <TD><INPUT TYPE="text" NAME="email" value=""></TD></TR>
      <TR><TD>Email you when somebody posts a comment to your picture?</TD> <TD><INPUT TYPE="checkbox" NAME="notify_comments" CHECKED="checked"></TD></TR>
      <TR><TD>Email you when somebody posts a new picture? (Note: this will probably get annoying)</TD> <TD><INPUT TYPE="checkbox" NAME="notify_pictures" VALUE="0"></TD></TR>
      <TR><TD><INPUT TYPE="submit" VALUE="Create Account"></TR><TD>
    </TABLE>
  </FORM>
<HR>
I'd personally do as Joe suggests

You might be right about that, Joe.