BetaArchive Logo
Navigation Home Screenshots Image Uploader Server Info FTP Servers Wiki Forum RSS Feed Rules Please Donate
UP: 3d, 4h, 43m | CPU: 29% | MEM: 2293MB of 3961MB used
{The community for beta collectors}

Forum rules


Any off topic discussions should go in this forum. Post count is not increased by posting here.
FTP Access status is required to post in this forum. Find out how to get it


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPost subject: Problem with PHP        Posted: Sun Nov 18, 2007 10:20 am 
Reply with quote
Donator
User avatar
Offline

Joined
Thu Aug 31, 2006 2:45 pm

Posts
1432

Location
UK

Favourite OS
Longhorn 4074
So i was making my new website in PHP and i got a problem.
I was trying to make a simple menu and i wrote this:
Code:
<div>
<ul><li><a  href="?view=home">Home</a><br></li>
<li><a  href="?view=downloads">Downloads</a></li></ul>
</div>
and after that:
Code:
 if ($view=='home')
   {
   include('welcome.htm');
   }
elseif ($view=='')
   {
   echo "go away";
   }
elseif ($view=='downloads')
   {
   echo "If there are any problems with our downloads system (broken links, something not working as it should, etc.)contact admininstator <a>via e-mail</a> or <a>via personal messages system</a>. <br><br>";
   include('Downloads.php');
   }
and i've placed files on my localhost server (using apache, php4, mysql, phpmyadmin and few other things). I go to the site and i see "go away". I click on 'Home' and i see the content of welcome.htm, i click on downloads and i see everything ok. So i think everythings ok.

But than i've uploaded the file to a 110mb.com server. I typed url i've seen 'go away'. I click on 'Home' but i still see 'go away', i click on 'Downloads' but i still see 'go away'...
So, WTF?!


Top  Profile  WWW
 PostPost subject:        Posted: Sun Nov 18, 2007 4:02 pm 
Reply with quote
FTP Access
Offline

Joined
Wed Jun 27, 2007 8:13 pm

Posts
130

Location
France
If i say Global Variable, do this made you react ?

And
Code:
$view = $_GET['view'];

On top of your script
Will Probably Solve
Your Problem


Top  Profile  WWW
 PostPost subject:        Posted: Sun Nov 18, 2007 6:36 pm 
Reply with quote
Donator
User avatar
Offline

Joined
Thu Aug 31, 2006 2:45 pm

Posts
1432

Location
UK

Favourite OS
Longhorn 4074
Thank you, it worked :)
The fact is, i've never learned PHP. All i do is viewing some scripts and discovering how they work, watching what will happen if i will delete or add something... :P


Top  Profile  WWW
 PostPost subject:        Posted: Mon Nov 19, 2007 2:13 am 
Reply with quote
Donator
Offline

Joined
Sat Aug 19, 2006 1:25 am

Posts
590

Location
Israel
IIRC one of the main differences between PHP4 and PHP5 had something to do with automatic HTTP variable filling (so you don't have to use $_GET[] and $_POST[]). I think it was disabled by default starting with PHP5 (for obvious security reasons).

BTW w3cshools's PHP pages are very good for reference (here).


Top  Profile
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 




Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Jump to:  

All views expressed in these forums are those of the author and do not necessarily represent the views of the BetaArchive site owner.

Powered by phpBB® Forum Software © phpBB Group

Copyright © 2006-2018

 

Sitemap | XML | RSS