What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Can someone edit this script?

Pages: (3): « First [ 1 ] 2 3 » Last »
Can someone edit this script?
Author: Message:
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. Can someone edit this script?
<?
$num = $_GET['num'];
if(!isset($_GET['num'])){
$num = "1";
}
?>
<img src="http://www.hobbes.weirdfish.net/strips/strip<?echo $num;?>.jpg" alt="strip<?echo $num;?>.jpg error">

<a href="http://hobbes.weirdfish.net/strip.php?num=<?echo $num+1;?>">Foward</a>
<a href="http://hobbes.weirdfish.net/strip.php?num=<?echo $num-1;?>">Back</a>

Wel can someone edit this script so the smallest number is 1 and it cant go any lower. And it cant go higher then the images i have. I want it to auto detect the last one.
03-26-2005 12:12 PM
Profile PM Web Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: Can someone edit this script?
To do that you would need a way to count how many images you have, so no one can edit your script to do that until they know how your images are saved.
03-26-2005 12:15 PM
Profile PM Find Quote Report
Ash_
Senior Member
****

Avatar

Posts: 638
Reputation: 31
35 / Male / –
Joined: Aug 2004
RE: RE: Can someone edit this script?
quote:
Originally posted by Madman
To do that you would need a way to count how many images you have, so no one can edit your script to do that until they know how your images are saved.


*cough* scandir() *cough*
[Image: jeansiger5.jpg]
03-26-2005 12:16 PM
Profile PM Find Quote Report
.Roy
Veteran Member
*****

Avatar

Posts: 1526
Reputation: 11
20 / Male / –
Joined: Aug 2004
O.P. RE: Can someone edit this script?
strip1.jpg
strip2.jpg
strip3.jpg

and so forth.
but i every day i add another one. so i dont want to edit this script every day.
03-26-2005 12:44 PM
Profile PM Web Find Quote Report
Ash_
Senior Member
****

Avatar

Posts: 638
Reputation: 31
35 / Male / –
Joined: Aug 2004
RE: RE: Can someone edit this script?
quote:
Originally posted by Hobbes
strip1.jpg
strip2.jpg
strip3.jpg

and so forth.
but i every day i add another one. so i dont want to edit this script every day.

seriosuly dude, code it yourself ¬¬, i thoguht you were learning PHP anyway. think of this as a test.
[Image: jeansiger5.jpg]
03-26-2005 01:19 PM
Profile PM Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: Can someone edit this script?
Blah i should have been able to work that our myself :dodgy:
anyway this should work, although i havnt tested it.
code:
<?
$num = $_GET['num'];
if(!isset($_GET['num']) OR $num < 1){ //If the input is less than one correct it
$num = "1";
}
?>
<img src="http://www.hobbes.weirdfish.net/strips/strip<?echo $num;?>.jpg" alt="strip<?echo $num;?>.jpg error">
<?php
//first we count the files in the strips
$files = scandir("strips");
$fileno = count($files) - 2;//ignore the . and .. entries
if($num != $fileno){//If we are on the last line dont echo a link other wise do
echo "<a href=\"http://hobbes.weirdfish.net/strip.php?num=" . $num+1 . "\">Foward</a>";
}
if($num > 1){ //check to see if the number is greater than one, if so echo the back link
echo "<a href=\"http://hobbes.weirdfish.net/strip.php?num=" . $num-1 . "\">Back</a>";
}
//other wise just dont echo anything
?>

But as ash said you should try and work these things out for yourself.
http://www.php.net will become your bibble :p

This post was edited on 03-26-2005 at 01:22 PM by Plik.
03-26-2005 01:21 PM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: Can someone edit this script?
quote:
Originally posted by Ash_
when echo. you should use the "s use ' otherwise it causes errors :cheesy:
err wtf? you can use " and ' in echo? =/
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-26-2005 01:30 PM
Profile PM Web Find Quote Report
Ash_
Senior Member
****

Avatar

Posts: 638
Reputation: 31
35 / Male / –
Joined: Aug 2004
RE: RE: Can someone edit this script?
quote:
Originally posted by -dt-
quote:
Originally posted by Ash_
when echo. you should use the "s use ' otherwise it causes errors :cheesy:
err wtf? you can use " and ' in echo? =/

lol i know, but using " for the whole echo, and ' for stuff inside the echo will make it easier in the long run :P.
[Image: jeansiger5.jpg]
03-26-2005 01:31 PM
Profile PM Find Quote Report
Plik
Veteran Member
*****

Avatar

Posts: 1489
Reputation: 46
35 / Male / –
Joined: Jun 2004
RE: Can someone edit this script?
quote:
Originally posted by Ash_
lol i know, but using " for the whole echo, and ' for stuff inside the echo will make it easier in the long run :P.

or you escape the "s like i did :-/ it all depends on how you want the output to look.

This post was edited on 03-26-2005 at 01:34 PM by Plik.
03-26-2005 01:33 PM
Profile PM Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: Can someone edit this script?
quote:
Originally posted by Ash_
lol i know, but using " for the whole echo, and ' for stuff inside the echo will make it easier in the long run :P.

depends what happens if you just want pure text in the varible? (and dont feel like using <<<x   x; )

This post was edited on 03-26-2005 at 01:36 PM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-26-2005 01:35 PM
Profile PM Web Find Quote Report
Pages: (3): « First [ 1 ] 2 3 » Last »
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On