Closed Thread Icon

Topic awaiting preservation: this may sound stupid, but I'm no genius at php (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=12036" title="Pages that link to Topic awaiting preservation: this may sound stupid, but I&amp;#039;m no genius at php (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: this may sound stupid, but I&#039;m no genius at php <span class="small">(Page 1 of 1)</span>\

 
sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 02-05-2002 10:58

trying to learn it actually.. well I have a question....
how do you make the script print out different HTML?
(eg something.php?command)
and make it change the page in new HTML?

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 02-05-2002 11:32

if i understand you well:

code:
<? if ($command=='intro') {?>
<html><head><title>Intro</title></head><body>dasdadasdasd</body></html>
<?else if ($command == 'action') { ?>
<html>
<head>
<title>Action page...</title></head><body>dasdadasdasd</body>
</html>
<?}?>



etc....



[This message has been edited by lallous (edited 02-05-2002).]

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 02-10-2002 13:43

thanks much.

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 02-15-2002 06:08

actually I found a MUCH better way which is 100% more efficient. http://slashdot.co.uk/test.phps
guy at irc.php.net named MarkL helped me with that..

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 02-15-2002 12:55

your link is dead: http://slashdot.co.uk/test.phps

can you plz try to paste the code in here ?

i'm interested.

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 02-16-2002 04:32

http://www.gamersmix.gametribe.net/cgi-bin/ftpex/FTPex.cgi?browse&scripts/PHP

on my site...hurry, since it's gonna get moved, etc.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 02-16-2002 05:31

If you're referring to the phpbrowsingswitch.php page, here is how I would do it:


<?php
switch ($command) {
case test:
$title = "test page";
$body = "test.html";
break;
case action:
$title = "action page";
$body = "action.html";
break;
default:
echo "Invalid Option";
}
?>
<html>
<head>
<title><?php echo $title; ?></title>
</head>
<body>
<?php
include("$body");
?>
</body>
</html>


Then call phpbrowsingswitch.php?command=action.......



[This message has been edited by Pugzly (edited 02-16-2002).]

[This message has been edited by Pugzly (edited 02-16-2002).]

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 02-16-2002 23:04

same same....all still works.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-17-2002 00:49

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 02-17-2002 05:51

Good point. I like your example. I was merely showing that SWITCH is a good way to do things. We can beef up security and stuff, but I think people don't use SWITCH as much as they could. I've seen code with more IF statements than you can shake a stick at......

We could also reset $body to "" at the beginning of the script, and then go from there.....



[This message has been edited by Pugzly (edited 02-17-2002).]

Dark Phoenix
Paranoid (IV) Inmate

From: Harrow, Ontario, Canada
Insane since: Feb 2002

posted posted 02-20-2002 17:08

One of these days people are going to wake up and realize that PHP's true power is not in it's ability to display different pages based on a single GET variable...

It is just me, or do all n00bs to PHP start with that?

"No one's going to give you a map; you've got to walk your own path." = Hot Ice Hilda, Outlaw Star.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-20-2002 17:17

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dark Phoenix
Paranoid (IV) Inmate

From: Harrow, Ontario, Canada
Insane since: Feb 2002

posted posted 02-20-2002 19:04

Actually, I already know Java.

And I didn't call anyone a n00b; what I meant was, why do n00bs always want to start with this?

"No one's going to give you a map; you've got to walk your own path." = Hot Ice Hilda, Outlaw Star.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-20-2002 19:16

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dark Phoenix
Paranoid (IV) Inmate

From: Harrow, Ontario, Canada
Insane since: Feb 2002

posted posted 02-20-2002 19:20

True; that is very basic.

When I started PHP, I started with a login system backed by a MySQL database that uses cookies and forms, with a working uploader.

I think I might have started with something that is too hard for n00bs to grasp; but I always had a gift for programming.

"No one's going to give you a map; you've got to walk your own path." = Hot Ice Hilda, Outlaw Star.

InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 02-20-2002 19:51

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

Dark Phoenix
Paranoid (IV) Inmate

From: Harrow, Ontario, Canada
Insane since: Feb 2002

posted posted 02-20-2002 19:53

Who's bragging?

"No one's going to give you a map; you've got to walk your own path." = Hot Ice Hilda, Outlaw Star.

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 09-14-2002 00:10

actually a much simpler method is to put your index stuff as default :P
and have actual data. but yeah, I may have to do that for anyone else who uses that.

maninacan
Paranoid (IV) Inmate

From: Seattle, WA, USA
Insane since: Oct 2001

posted posted 09-14-2002 02:45

how about everybody stops arguing and realizes that I am the 1337est of you all

seriously though, this is no place for calling people n00bs, bragging about how good you are, or yelling at people. We're all just trying to get some help, and help others.

behmer

sonic_tsunami
Bipolar (III) Inmate

From: some evil place, the evil little atoll
Insane since: Jan 2002

posted posted 06-14-2003 16:34

actually, if you know your box has a secure php set up, you need not worry about such security measures, becuase I know my friend has a set up with php that disables off-site linking, however, I do see where you're coming from, and how it could be used for internal security breaches.
but then again, that depends on the server set up and how secure someone made it.
sorry if I bumped up a year-old topic, but I was in search of some of my old scripts (lost the back up to my old web site, and my memory is shit.)
I now run an irc network and I've been working on various things.
hell, I also stopped using windows, I have to laugh at some of my old posts at this board, makes me realize how much I've learned within the past year.
anyways yeah...
I'll probably test the security thing out, but I dont think I'll need it becuase of my current set up..
that and you can always do it another way too
cheaper, easier method is to simply add a $body variable to the default switch
this was only a structural script, the final product is more secure
becuase if there's never a case that doesnt have a variable missing, then no one could take advantage of the script. becuase they cant put in their own crap if there's a variable in the way
So, sometimes the answer is simpler than you'd think..
may be cheap, but it gets the job done.

CPrompt
Maniac (V) Inmate

From: there...no..there.....
Insane since: May 2001

posted posted 06-15-2003 10:48

well, call me a n00b or whatever but why not use SSI?
Same security reasons?

Later,

C:\

<edit>I'd love it if we could have the buttons for posts like at Gurur's My stupid fingers can't type what I want sometimes</edit>


~Binary is best~

[This message has been edited by CPrompt (edited 06-15-2003).]

Tyberius Prime
Paranoid (IV) Mad Scientist with Finglongers

From: Germany
Insane since: Sep 2001

posted posted 06-15-2003 12:21

as if off site likning would be the only problem with that approach...

and InI, while java may be vastly superior in many regards,
it is just not appropriate for this task (which would be 'display different pages according to a get variable).

Now, if I implemented a Modell-View-Control pattern, I wouldn't use php, but for something as simple as this...

so long,

Tyberius Prime

« BackwardsOnwards »

Show Forum Drop Down Menu