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?Failed Login
<edit> New rule: No WoW stuff! ;)It was a test... and it worked.
There are no pictures of me.
Read the caption!
Add a last updated timestamp on the users sections.
Moor Pictures > ospap
Unknown usernameLogin failed Redirecting....Bah, I fixed that, but overwrote the fix. oops!
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!)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.
Security zealot.
# Redistribution and use in source and binary forms
/compile =p
Make it not so dull looking. Make it have some character. :Diago doesn't do layouts.
[Edit]
I can't spell..
To-do+:
make it templated/skinnable
edit thread title
should I hand out that site to freinds?
iago doesn't do layouts.Damn right!
rabbit's already provided the solution to your request, though.Yeah, somebody else (Romi, I think?) asked me to do that as well.To-do+:
make it templated/skinnable
edit thread title
Posted by <b>{postedBy}</b> at <b>{postedTime}</b> on <b>{postedDate}</b>
<hr />
<h3>{title}</h3>
{text}
should I hand out that site to freinds?
Try to break it!
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:Cool.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. :)
The best way to break it is to let lots of people to use it.should I hand out that site to freinds?QuoteTry to break it!
He sounds confident about its stability to me. =p
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
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.
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.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.Just put them in a different database! :)
mysql -u root -p -D ospap < create_tables.sql
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!Yes.Just put them in a different database! :)
mysql -u root -p -D ospap < create_tables.sql
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.
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. :)
#1 - No.
#2 - No.
It's not about you, its the "consumer"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.
yes to both.
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.
Question2: Should users be able to choose skins for each of their categories?No.
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.
A couple of suggestions instead of doing things likeI 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.
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.Good point. Why don't you hover your mouse over the arrow ("-->"), since that doesn't move? I'll fix that up anyway
Error!After logging out in my private category, and it keeps refreshing.
invalid category_id
Oh?
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22
That's the URL to one of your picture thumbnails.
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");
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.
http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22
Doesn't look like an image extention to me.http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg
orhttp://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.
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 doCode: [Select]http://www.javaop.com/~iago/ospap/picture.php?tn=true&picture_id=22.jpg
orCode: [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.
Whats that checkbox next to "Create" do? (Create a category)Makes the category private, if you read the mouse over. :P
Yep, and that loads the thumbnail file:Your code could be more efficient ^^Quoteif(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");
Yep, and that loads the thumbnail file:Your code could be more efficient ^^Quoteif(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");
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.
class img {
var $img;
var $color_back;
...
}
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?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).
On Perl, it's "use strict;"
Is there some way to make it show an error if you don't declare variables like that?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.
On Perl, it's "use strict;"
error_reporting = E_COMPILE_ERROR|E_ERROR|E_CORE_ERROR
error_reporting = E_ALL
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
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.
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.
You can of course filter the notice messages to the one you need :p
Quite useless.
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)
$int_variable = 0;
$str_variable = '0';
$flt_variable = '1.0';
$bol_variable = true;
$db = new mysql_db();
function get_username($user_id, $db) {
// ...
}
get_username(1, $db);
$db = new mysql_db();
function get_username($user_id) {
global $db;
// ...
}
get_username(1);
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.
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');
}
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>