Critique of this script?

Status
Not open for further replies.

[R]DeVore

Banned
Jul 12, 2006
700
14
0
Michigan, USA
www.cre8tiv-vision.com
I am new to writing php so bare with me if this seems a little "newbie" style or a veryyyyy simple script, but I wanted to get everyones opinions on it.

It's basically a Pic of the Day script that reads the name of an image file in date format and the current date's picture is shown.

IE: 2007-01-27.jpg would be today's date and would show the pic. I have it to where if theres no pic for the current date, a default.jpg pic is shown.

I figure this would be good to use on a babe site, or car site, or some other site that a random DAILY pic would be good.

Let me know what you all think about it.

download here: http://www.educatedchaos.com/dailypic_educatedchaos.zip

Thanks
 


Little shit i'm pointing out, but i figured it's the kind of feedback you were looking for........


Echoing large amounts of html is not the best way to go about things. Also, you have a bit of duplicate code in there. Best practice would be to go from this.......

Code:
<?
include ("config.php");

if (file_exists ( $photo)) { 

echo "
<div align=center>
<a href='$image_url/$date" . $ext . "' target='_blank'><IMG SRC='$thumb_url/$date" . $ext . "' border=0></A><br /><br />
<font size=2>Powered by: <a href='http://www.educatedchaos.com' target='_blank'>Educated Chaos</a></font><br />
</div>    
"; 
} else { 

echo "
<div align=center>
<IMG SRC='$default' border=0><br /><br />
<font size=2>Powered by: <A HREF='http://www.educatedchaos.com' target='_blank'>Educated Chaos</a></font><br />
</DIV>
"; 
}

?>
.....to this.....

Code:
<?
include ("config.php");

if (file_exists ($photo) ) {
    $default = $thumb_url . "/" . $date . "." . $ext;
}
?>
<div align=center>
<a href='<?= echo $default; ?>' target='_blank'><IMG SRC='<?= echo $default; ?>' border=0></A><br /><br />
<font size=2>Powered by: <a href='http://www.educatedchaos.com' target='_blank'>Educated Chaos</a></font><br />
</div>
I just did this off the top of my head, so it may not compile correctly. I also noticed you are doing something where you only show the url if the pic exists.....i didn't account for that here. Anyways, you get the general idea.
 
[R]DeVore - Could you please look at the link I pasted again and let me know if you can find an affiliate ID attached to it?

You won't be able to. I wasn't trying to spam my affiliate link. If anyone is trying to spam their affiliate link in a response to a forum posting hoping they'll make a measly $5 in the process, they should be banned.

I simply looked up a link to a book I believe in 100%.
 
However if anyone IS looking for an affiliate link to that book, I could probably oblige.... haha :D
 
Note to self: Read the forum, found a question I felt I could contribute on, sent a direct link to a book I wholeheartedly believed in. No spamming. No aff garbage. Just my way of lending a hand.

What do I get: Got bashed and got negative -3 million reputation points from [R]DeVore.

Lesson: Stay dormant.

--

Nah, that's no fun. Just sucks that some people here are all about crapping on others. So juvenile.
 
  • Like
Reactions: stoxup
Status
Not open for further replies.