Re: [PHP] Re: process creation

2009-01-24 Thread Per Jessen
Török Alpár wrote:

> as i said it's hate here, and i might be wrong but consider the
> following  :
> 
> for($icount=0;$icount<11;$icount++)
> {
>   $iPid  =  pcntl_fork();
>   $iChildrenCount = 0;
>   if ($iPid == 0)
>   {
> // child
> echo ("child $icount\n");
>   }
>   else
>   {
> // parrent
>   }
> }
> 
> this is essential what you do in your example? If so, this code does
> not start 10 children. It starts more.

Thats right - with the code above, each new child will continue creating
more processes. To get exactly 10 children running the same code:

if ($iPid == 0)
{
   // child
   echo ("child $icount\n");
   
   // do childish stuff
   // then exit
   exit;
}


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Make New-Age Money Online with Google

2009-01-24 Thread Ashley Sheridan
On Sat, 2009-01-24 at 10:14 +0200, Dora Elless wrote:
> That's why I am sending this email only to people I know and care
> about.
And they send to a mailing list. Come again?


Ash
www.ashleysheridan.co.uk


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP 5.2.8 fails to find libiconv

2009-01-24 Thread Ro Achterberg
At 11:51 23-1-2009, Thodoris wrote:

>>Hi,
>>
>>I'm attempting to install PHP 5.2.8 on CentOS 5.2 x86_64. The glibc iconv 
>>doesn't seem to function very well, leading to a bunch of failed tests when 
>>running 'make test' (see below). After a bit of Googling I stumbled upon 
>>http://nl2.php.net/manual/en/intro.iconv.php which suggests to install 
>>libiconv instead of relying on glibc's iconv, when things go wrong.
>>
>>My configure line reads as follows:
>>
>>./configure --prefix=/chroot/apache2/php 
>>--with-apxs2=/chroot/apache2/bin/apxs --disable-cgi --with-zlib 
>>--with-gettext --enable-sockets --with-xmlrpc --with-xsl 
>>--with-config-file-path=/php/etc --with-mcrypt --enable-mbregex --with-gd 
>>--with-mime-magic=/usr/share/mime/magic --enable-mbstring=all --with-openssl 
>>--with-mysql=/chroot/mysql --with-curl=/usr/lib64 --enable-zip 
>>--with-freetype-dir=/usr/lib64 --with-png-dir --with-jpeg-dir 
>>--with-libdir=lib64 --with-gnu-ld --with-iconv=/usr/local/lib
>>
>>which yields the following result:
>>
>>
>>checking for iconv support... yes
>>configure: error: Please reinstall the iconv library.
>>
>>
>>Configure runs fine when I omit the path in the --with-iconv directive, but 
>>that will use glibc's iconv, which results in the following failed tests when 
>>running make check:
>>
>>
>>Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
>>iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
>>Test session_decode() function : variation 
>>[ext/session/tests/session_decode_variation3.phpt]
>>Test session_encode() function : variation 
>>[ext/session/tests/session_encode_variation8.phpt]
>>Test tempnam() function: usage variations - permissions( to 0777) of dir 
>>[ext/standard/tests/file/tempnam_variation4.phpt]
>>htmlentities() test 2 (setlocale / fr_FR.ISO-8859-15) 
>>[ext/standard/tests/strings/htmlentities02.phpt] (warn: possibly braindead 
>>libc)
>>htmlentities() test 4 (setlocale / ja_JP.EUC-JP) 
>>[ext/standard/tests/strings/htmlentities04.phpt] (warn: possibly braindead 
>>libc)
>>htmlentities() test 15 (setlocale / KOI8-R) 
>>[ext/standard/tests/strings/htmlentities15.phpt] (warn: possibly braindead 
>>libc)
>>
>>
>>Any thoughts/suggestions/ideas on how to solve this would be greatly 
>>appreciated!
>>
>>Regards,
>>Ro
>>
>>
>>  
>Although this not strictly a PHP question you could try to update first.
>
>#yum update
>
>Just in case something went wrong
>
>-- 
>Thodoris

How is this not a PHP question? Other programs have no trouble finding, linking 
with and using libiconv, and the failed tests are reported by PHP, on a fully 
updated CentOS 5.2.
Any further insights would be very much appreciated, since I still haven't 
found a solution to this problem. I'd like my production environments to be as 
stable as possible.

Regards,
Ro


>-- 
>PHP General Mailing List (http://www.php.net/)
>To unsubscribe, visit: http://www.php.net/unsub.php
>


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Php error

2009-01-24 Thread mattias
ERR_DB_NO_DB_PASS
What will this meen?


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Php error

2009-01-24 Thread Per Jessen
mattias wrote:

> ERR_DB_NO_DB_PASS
>What will this meen?


No database password has been set in config.


/Per Jessen, Zürich


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: Php error

2009-01-24 Thread Carlos Medina

mattias schrieb:

ERR_DB_NO_DB_PASS
What will this meen?



The Database is a foreign DB without passport

Carlos

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] PHP webhosting - USA

2009-01-24 Thread Martin Zvarík

Hi,

I currently host my site by Powweb, and I am WANT to change it - can you 
guys recommend me something good?


Powweb's website looks awesome and it's the best marketing I think I had 
saw! After a minute it makes you think there is NO better hosting - and 
it's a LIE.


What happened to me?

- database connection were exceeded, I read many people had problems 
with their phorums not working etc., the solution: I put a message to 
the visitor that he has to wait (it was not frequent so I didn't care much)


- my client stopped receiving orders, he called me after a week 
something is wrong. I found out that Powweb changed a MySQL settings, 
which nobody informed me about - they restricted a JOIN limit max to 3, 
the mysql_query SQL thus did not work and orders were not storing for 7 
days!


- the suport is HORRIBLE - they don't give you email, but they have this 
ONLINE support, meaning: you wait 10-20 minutes on queue, and then they 
talk to you like a robots and usually tell you something you already know.


- now they automatically changed all my passwords so they can keep me 
secure! what's cool is that I cannot change it back to what I have! Hey, 
the chance of getting me hit by bus is higher than someone cracking my 
15 letter password with numbers! Thank you powweb for keeping me secure.


Thanks for reading my story,
now, does someone know a better hosting alternative?

Martin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] Re: PHP webhosting - USA

2009-01-24 Thread Tony Marston
I have been using www.lypha.com for 5 years without experiencing any of 
those problems.

-- 
Tony Marston
http://www.tonymarston.net
http://www.radicore.org

""Martin Zvarík""  wrote in message 
news:ed.1b.55096.ccd2b...@pb1.pair.com...
> Hi,
>
> I currently host my site by Powweb, and I am WANT to change it - can you 
> guys recommend me something good?
>
> Powweb's website looks awesome and it's the best marketing I think I had 
> saw! After a minute it makes you think there is NO better hosting - and 
> it's a LIE.
>
> What happened to me?
>
> - database connection were exceeded, I read many people had problems with 
> their phorums not working etc., the solution: I put a message to the 
> visitor that he has to wait (it was not frequent so I didn't care much)
>
> - my client stopped receiving orders, he called me after a week something 
> is wrong. I found out that Powweb changed a MySQL settings, which nobody 
> informed me about - they restricted a JOIN limit max to 3, the mysql_query 
> SQL thus did not work and orders were not storing for 7 days!
>
> - the suport is HORRIBLE - they don't give you email, but they have this 
> ONLINE support, meaning: you wait 10-20 minutes on queue, and then they 
> talk to you like a robots and usually tell you something you already know.
>
> - now they automatically changed all my passwords so they can keep me 
> secure! what's cool is that I cannot change it back to what I have! Hey, 
> the chance of getting me hit by bus is higher than someone cracking my 15 
> letter password with numbers! Thank you powweb for keeping me secure.
>
> Thanks for reading my story,
> now, does someone know a better hosting alternative?
>
> Martin 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP webhosting - USA

2009-01-24 Thread Martin Zvarík

That's an awful looking website, but thanks for reply.

I am looking for rather a US hosting company.


Andrew Williams napsal(a):

go to www.willandy.co.uk  best value for money

On Sat, Jan 24, 2009 at 3:03 PM, Martin Zvarík > wrote:


Hi,

I currently host my site by Powweb, and I am WANT to change it -
can you guys recommend me something good?

Powweb's website looks awesome and it's the best marketing I think
I had saw! After a minute it makes you think there is NO better
hosting - and it's a LIE.

What happened to me?

- database connection were exceeded, I read many people had
problems with their phorums not working etc., the solution: I put
a message to the visitor that he has to wait (it was not frequent
so I didn't care much)

- my client stopped receiving orders, he called me after a week
something is wrong. I found out that Powweb changed a MySQL
settings, which nobody informed me about - they restricted a JOIN
limit max to 3, the mysql_query SQL thus did not work and orders
were not storing for 7 days!

- the suport is HORRIBLE - they don't give you email, but they
have this ONLINE support, meaning: you wait 10-20 minutes on
queue, and then they talk to you like a robots and usually tell
you something you already know.

- now they automatically changed all my passwords so they can keep
me secure! what's cool is that I cannot change it back to what I
have! Hey, the chance of getting me hit by bus is higher than
someone cracking my 15 letter password with numbers! Thank you
powweb for keeping me secure.

Thanks for reading my story,
now, does someone know a better hosting alternative?

Martin

-- 
PHP General Mailing List (http://www.php.net/)

To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] PHP webhosting - USA

2009-01-24 Thread Alpár Török
I liked

http://www.slicehost.com/

very much, but might not be what you want.

2009/1/24 Martin Zvarík 

> Hi,
>
> I currently host my site by Powweb, and I am WANT to change it - can you
> guys recommend me something good?
>
> Powweb's website looks awesome and it's the best marketing I think I had
> saw! After a minute it makes you think there is NO better hosting - and it's
> a LIE.
>
> What happened to me?
>
> - database connection were exceeded, I read many people had problems with
> their phorums not working etc., the solution: I put a message to the visitor
> that he has to wait (it was not frequent so I didn't care much)
>
> - my client stopped receiving orders, he called me after a week something
> is wrong. I found out that Powweb changed a MySQL settings, which nobody
> informed me about - they restricted a JOIN limit max to 3, the mysql_query
> SQL thus did not work and orders were not storing for 7 days!
>
> - the suport is HORRIBLE - they don't give you email, but they have this
> ONLINE support, meaning: you wait 10-20 minutes on queue, and then they talk
> to you like a robots and usually tell you something you already know.
>
> - now they automatically changed all my passwords so they can keep me
> secure! what's cool is that I cannot change it back to what I have! Hey, the
> chance of getting me hit by bus is higher than someone cracking my 15 letter
> password with numbers! Thank you powweb for keeping me secure.
>
> Thanks for reading my story,
> now, does someone know a better hosting alternative?
>
> Martin
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


-- 
Alpar Torok


Re: [PHP] PHP webhosting - USA

2009-01-24 Thread TG
I've worked with a few different host providers in the course of my work.  We 
have clients on CrystalTech, GoDaddy, HostMonster/BlueHost,  HostMySite, and 
probably some others.

I've had my own hosting at DreamHost for years now and I love them.  They have 
their own homegrown control panel and one click installer, but they work great 
and have lots of options.  Also, they don't seem to include apps that are 
crappy but popular.  Most of the ones I've used that they have are all top 
notch examples of their genre.

They communicate constantly via blog and RSS fees.  Some people will say "they 
have so many problems!" but I think the majority of this comes from the fact 
that they do communicate so much.

I will say that they had two moderate to severe outages in the time I've had 
them, but when I was keeping track of the minor hiccup type things, they never 
seemed to last more than a couple minutes, if that.


One of our big sites is having issues with HostMonster right now with 
mysterious CPU Exceeded/Slow MySQL queries errors, so if you're running a 
fairly high traffic site, I'd recommend against them.   Although their support 
has been great, in general, but I can't recommend them if you have a good bit 
of traffic.

I think HostMySite had good support too, if I recall.  But again, I like 
DreamHost's system better.

Anyway, just my 2cents.  I'm sure there'll be a million other responses.

Good luck!

-TG

- Original Message -
From: Martin Zvarík 
To: php-general@lists.php.net
Date: Sat, 24 Jan 2009 16:03:48 +0100
Subject: [PHP] PHP webhosting - USA

> Hi,
> 
> I currently host my site by Powweb, and I am WANT to change it - can you 
> guys recommend me something good?
> 
> Powweb's website looks awesome and it's the best marketing I think I had 
> saw! After a minute it makes you think there is NO better hosting - and 
> it's a LIE.
> 
> What happened to me?
> 
> - database connection were exceeded, I read many people had problems 
> with their phorums not working etc., the solution: I put a message to 
> the visitor that he has to wait (it was not frequent so I didn't care much)
> 
> - my client stopped receiving orders, he called me after a week 
> something is wrong. I found out that Powweb changed a MySQL settings, 
> which nobody informed me about - they restricted a JOIN limit max to 3, 
> the mysql_query SQL thus did not work and orders were not storing for 7 
> days!
> 
> - the suport is HORRIBLE - they don't give you email, but they have this 
> ONLINE support, meaning: you wait 10-20 minutes on queue, and then they 
> talk to you like a robots and usually tell you something you already know.
> 
> - now they automatically changed all my passwords so they can keep me 
> secure! what's cool is that I cannot change it back to what I have! Hey, 
> the chance of getting me hit by bus is higher than someone cracking my 
> 15 letter password with numbers! Thank you powweb for keeping me secure.
> 
> Thanks for reading my story,
> now, does someone know a better hosting alternative?
> 
> Martin
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
>

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP webhosting - USA

2009-01-24 Thread Stephen

Martin Zvarík wrote:
- my client stopped receiving orders, he called me after a week 
something is wrong. I found out that Powweb changed a MySQL settings, 
which nobody informed me about - they restricted a JOIN limit max to 
3, the mysql_query SQL thus did not work and orders were not storing 
for 7 days!
You are hosting a business website, that processes orders, on a shared 
server?


That is very false economy.

You want a dedicated server that has only you as root.

Stephen


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP webhosting - USA

2009-01-24 Thread Daniel Brown
On Sat, Jan 24, 2009 at 10:03, Martin Zvarík  wrote:
> Hi,
>
> I currently host my site by Powweb, and I am WANT to change it - can you
> guys recommend me something good?
>
> Powweb's website looks awesome and it's the best marketing I think I had
> saw! After a minute it makes you think there is NO better hosting - and it's
> a LIE.

It's not necessarily a lie.  The possibility always remains that
you were just on a "lemon" server --- one that may be experiencing
major technical difficulties, or which was not properly configured
from the get-go.

> What happened to me?
>
> - database connection were exceeded, I read many people had problems with
> their phorums not working etc., the solution: I put a message to the visitor
> that he has to wait (it was not frequent so I didn't care much)

This is a problem with a lot of hosts: maximizing profits by
overcrowding servers and overselling resources.

> - my client stopped receiving orders, he called me after a week something is
> wrong. I found out that Powweb changed a MySQL settings, which nobody
> informed me about - they restricted a JOIN limit max to 3, the mysql_query
> SQL thus did not work and orders were not storing for 7 days!

Changing settings like that should never be done without giving
folks advance notice, if even at all.  That again comes down to
improper configuration, mismanagement, and overselling.  However, if
you're sending advanced queries to the database, maybe you should
re-think your hosting solution: you should probably consider moving to
a dedicated server, if even just a budget server.

> - the suport is HORRIBLE - they don't give you email, but they have this
> ONLINE support, meaning: you wait 10-20 minutes on queue, and then they talk
> to you like a robots and usually tell you something you already know.

Here combines two major entities that can be compressed to a
singularity (a pun for those who enjoy physics): support availability
and proper server/network administration.  Just like in programming
and web development - if you take the extra time to set things up
properly from the beginning, you can spend less time on bug fixes and
support, and more time focusing on advancing the script (or network).

> - now they automatically changed all my passwords so they can keep me
> secure! what's cool is that I cannot change it back to what I have! Hey, the
> chance of getting me hit by bus is higher than someone cracking my 15 letter
> password with numbers! Thank you powweb for keeping me secure.

It's Microsoftian Protection Tactics[TM] (MPT's) - protect the
users from themselves by treating them like technological toddlers.
"We appreciate the fact that you don't know what's good for you as
well as we do, so Big Brother will watch over you."  Companies really
should only step in if the customer has asked for that assistance from
the beginning, or in dire emergencies (security breeches, etc.).

> Thanks for reading my story,
> now, does someone know a better hosting alternative?

Again, it sounds like you are technologically-apt and capable of
holding your own; with hints at multiple websites and financial
transactions taking place on at least one of them, you'd be
well-advised for security and availability purposes to look into
moving to a dedicated server.  You'd have full control over it,
customizing it to meet your own needs, maximizing resource
availability to your sites, et cetera.

We sell shared hosting and dedicated servers (as well as
colocation services), and there are a few other companies that I would
also recommend based on their levels of service and support.  You may
want to check them out:

http://www.liquidweb.com/
http://www.softlayer.com/
http://www.layeredtech.com/
http://www.fastservers.com/

Regardless of who you choose, or if you decide to stick with
PowWeb, best of luck.  Don't let anyone else tell you how you should
run your websites.

-- 

daniel.br...@parasane.net || danbr...@php.net
http://www.parasane.net/ || http://www.pilotpig.net/
Unadvertised dedicated server deals, too low to print - email me to find out!

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] PHP webhosting - USA

2009-01-24 Thread Michael Kubler

Hi,
If your a windows user, then ignore the text below.

Quantact.com are great. Great value, great support, I've been with them 
for a few years now.
I guess the only downside is that while the bandwidth is great (both 
quota and speed), and the hard drive access is fast, the memory usage is 
usually much lower, although on the OpenVZ plans can burst up higher if 
needed.


You get full root access (SSH), and I've installed Apache, PHP, MySQL, 
Exim, and Mailman, and could do more if I wanted (FTP, DNS, SVN), except 
I run most of the other services on other boxes.
The uptime is usually pretty great, although I've had two issues in 
recent memory where something major has died (like the hard drive raid 
array, or the motherboard), taking the server down for >1 hour, which 
may not be acceptable if your doing financial transactions, but ask them 
about the Xen hosting, which might have better data replication.


I know they have snapshot capabilities, although you need to stop the 
server for a while to do that, so I just run a daily rsync onto a Linux 
box at home. rSnapshot is great for that.


Running your own server may be a bit more work, but it's so much more 
customisable. Don't have PERL? apt-get install it (assuming Debian or 
Ubuntu), need to probe a server? Run nmap.


I have a script that emails me the compressed MySQL database, and also 
have a PHP CLI script that I cronjob daily to send me the server stats, 
membership details of various mailman mailing lists, amount of data 
transferred, HDD space left, ram used, uptime, and current load, and all 
sorts of things.


Michael Kubler
*G*rey *P*hoenix *P*roductions 



Daniel Brown wrote:

On Sat, Jan 24, 2009 at 10:03, Martin Zvarík  wrote:
  

Hi,

I currently host my site by Powweb, and I am WANT to change it - can you
guys recommend me something good?

Powweb's website looks awesome and it's the best marketing I think I had
saw! After a minute it makes you think there is NO better hosting - and it's
a LIE.


[PHP] Re: PHP webhosting - USA - conclusion

2009-01-24 Thread Martin Zvarík
I should have said in the beginning it's a small website and I am not 
looking for a dedicated server.


Howewer, I decided to move to Lypha.com

Thanks for all your fruitful* comments :)
Martin


PS: PHP mailgroup rulz

*) that was in dictionary

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] New PHP User with a simple question

2009-01-24 Thread Christopher W
At least I hope it is simple...

I am trying to get an HTML menu link to set a variable's value.  For 
example, when a user clicks the "Home" button on my page it would cause 
$page = "home"; or clicking the "About Us" button will set $page="about_us"; 
etc.

I think this should be fairly simple but being completely new to php I just 
cannot seem to get it right.

Any help would be greatly appreciate.

Thank you in advance.
-- 




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New PHP User with a simple question

2009-01-24 Thread Michael Kubler

The easiest way would be to use GET parameters (i.e data in the actual URL).
There are a number of ways you can structure a HTML link to get what you 
want.
You can have something basic (but not very elegant looking), like 


   Home

Then in your index.php code you'd probably have something like :

   


This is approximately how I do it although sometimes have a functions 
file I call, or a config file with basic presets, and various other 
things. I use .inc (for inclusion) as the file extension, so I can 
easily differentiate between .php files that customers will use (such as 
index.php, admin.php, login.php, etc..), and the included files.


In the header file I usually have something like that below.

--- header.inc starts below this line ---

   
   
   

- Insert Company or Website Name

   
   
   

   
   
   
   
   
   
   HEADER INFORMATION (or image) HERE
   
   
   
   
array( 'name' => 'Home',
  
   'url' => 'index.php?page=Contact',
   
   'title' => 'The home page'),
  
1 => array('name' =>

   'Contact' ,
 'url'
   => 'index.php?page=Contact',

   'title' => 'The contact details')

   );
   ?>
   
*$nav_list*)
   {
   echo ''. *$nav_list*['name'] . '';
   }
   ?>
   
   
  
   

   

--- END header.inc --



In the header.inc I've manually created an array, then got PHP to go 
through the array to add the name, URL and other details from the array, 
but that's just to simplify this, usually I pull the navigation data 
from a database (or if there's no MySQL installed I might unserialise it 
from a file).


There are other ways of pulling the data. If you want nice URLs, you can 
have something like /pages/Home/ and then have a mod_rewrite rule in 
Apache to then change that into index.php?page=Home, (although you'll 
also need to change the  to the new links. If you aren't running 
on apache, you can manually find the page information by doing 
print_r($_SERVER), and seeing what bits and pieces you can put together, 
but that's not nearly as good or reliable.


Sorry if there's too much info, but I'm guessing this is roughly what 
you'll be doing.
If you want to have more than one variable (like say a sub page) then 
you add  *&* between each variable. E.g


   Home -
   Archived News

You can usually get away with just using *&* as the separator but it 
probably won't validate properly if your making it in xhtml (as you 
should be). Also, if your not sure what the %20 means (a space) then 
look up urlencode  
and urldecode .


Michael Kubler
*G*rey *P*hoenix *P*roductions 



Christopher W wrote:

At least I hope it is simple...

I am trying to get an HTML menu link to set a variable's value.  For 
example, when a user clicks the "Home" button on my page it would cause 
$page = "home"; or clicking the "About Us" button will set $page="about_us"; 
etc.


I think this should be fairly simple but being completely new to php I just 
cannot seem to get it right.


Any help would be greatly appreciate.

Thank you in advance.
  


Re: [PHP] New PHP User with a simple question

2009-01-24 Thread Lars Torben Wilson
2009/1/24 Christopher W :
> At least I hope it is simple...
>
> I am trying to get an HTML menu link to set a variable's value.  For
> example, when a user clicks the "Home" button on my page it would cause
> $page = "home"; or clicking the "About Us" button will set $page="about_us";
> etc.
>
> I think this should be fairly simple but being completely new to php I just
> cannot seem to get it right.
>
> Any help would be greatly appreciate.
>
> Thank you in advance.

Hi there,

A good way to increase your chance of getting a useful response is to
post the smallest example you can which clearly illustrates the
problem you're having. In this case, you say you're not able to get
this to work, but we could waste quite a bit of time trying to guess
what you've tried and what didn't work.

In the simplest case, you could make your menu items look something
like this: Home and then use $page
= $_GET['page'] in your script, but I wouldn't recommend it since now
you have user data floating around in your script and it will later
become a pain in the butt to sanitize for security. For a learning
script it'll be fine though.


Torben

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New PHP User with a simple question

2009-01-24 Thread Christopher W
Sorry, I am also new to the etiquette of these mail lists.

Anyway what I was attempting to do, in the full picture, was be able to just 
switch the text in the text area without actually changing pages.  For 
example, if the user clicks "About Us" (from the home page) the page doesn't 
change, just the text (in the area I designated for text).

Since I have never used php before (but have read some online and in books) 
what I was trying was:

if ($page == "home") {echo $home_text;}
elseif ($page == "about") {echo $about_text;}
...
else {echo $error_text;}

My problem is that I can't figure out how to get the link-click to assign 
the value to the variable.  I didn't try any php for that end because I 
really didn't know where to begin.

Thanks for the replies and the help.  I truly appreciate it.

-- 

"Lars Torben Wilson"  wrote in message 
news:36d4833b0901242313r435860b3q7f3f4f0eea621...@mail.gmail.com...
> 2009/1/24 Christopher W :
>> At least I hope it is simple...
>>
>> I am trying to get an HTML menu link to set a variable's value.  For
>> example, when a user clicks the "Home" button on my page it would cause
>> $page = "home"; or clicking the "About Us" button will set 
>> $page="about_us";
>> etc.
>>
>> I think this should be fairly simple but being completely new to php I 
>> just
>> cannot seem to get it right.
>>
>> Any help would be greatly appreciate.
>>
>> Thank you in advance.
>
> Hi there,
>
> A good way to increase your chance of getting a useful response is to
> post the smallest example you can which clearly illustrates the
> problem you're having. In this case, you say you're not able to get
> this to work, but we could waste quite a bit of time trying to guess
> what you've tried and what didn't work.
>
> In the simplest case, you could make your menu items look something
> like this: Home and then use $page
> = $_GET['page'] in your script, but I wouldn't recommend it since now
> you have user data floating around in your script and it will later
> become a pain in the butt to sanitize for security. For a learning
> script it'll be fine though.
>
>
> Torben 



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] New PHP User with a simple question

2009-01-24 Thread Christopher W
Mr. Kubler,

Thank you for the help.  I have to admit, I am still in over my head, I 
think.  Perhaps I should just stick to static pages...

Anyway what I was attempting to do, in the full picture, was be able to just 
switch the text in the text area without actually changing pages.  For 
example, if the user clicks "About Us" (from the home page)the page doesn't 
change, just the text (in the area I designated for text).

Since I have never used php before (but have read some online and in books)
what I was trying was:

if ($page == "home") {echo $home_text;}
elseif ($page == "about") {echo $about_text;}
...
else {echo $error_text;}

My problem is that I can't figure out how to get the link-click to assign 
the value to the variable.  I didn't try any php for that end because I 
really didn't know where to begin.  Perhaps I am just going about this the 
wrong way but from the extremely little I have learned about php, I thought 
that I could do it this way easily.

Thanks for the replies and the help.  I truly appreciate it.


-- 

"Michael Kubler"  wrote in message 
news:497c0275.80...@gmail.com...
> The easiest way would be to use GET parameters (i.e data in the actual 
> URL).
> There are a number of ways you can structure a HTML link to get what you
> want.
> You can have something basic (but not very elegant looking), like
>
>Home
>
> Then in your index.php code you'd probably have something like :
>
>$page = urldecode(*$_GET['page']); *
>include_once header.inc; //Include a script that contains the
>general header information
>if(is_file(pages/*$page*.inc;)) //make sure they haven't requested a
>non-existant file
>{
>include_once pages/*$page*.inc; //Doesn't have to be .inc you
>could simply output HTML data if that's all your using.
>}
>else
>{
>   include_once pages/Home.inc; //If the user wanted a file that
>doesn't exist, then just take them to the home page (or you could
>take them to an error page if that's what you want).
>}
>include_once footer.inc; //Which would contain the footer if you've
>got one.
>?>
>
>
> This is approximately how I do it although sometimes have a functions
> file I call, or a config file with basic presets, and various other
> things. I use .inc (for inclusion) as the file extension, so I can
> easily differentiate between .php files that customers will use (such as
> index.php, admin.php, login.php, etc..), and the included files.
>
> In the header file I usually have something like that below.
>
> --- header.inc starts below this line ---
>
>
>
>
>
> - Insert Company or Website Name
>
>
>
>
>
>
>media="screen,projection,tv,tty,handheld,embossed,braille,aural"
>type="text/css">
>type="text/css">
>
>
>
>HEADER INFORMATION (or image) HERE
>
>
>
>
>*$main_navigation_list* = array(0 => array( 'name' => 'Home',
>
>'url' => 'index.php?page=Contact',
>
>'title' => 'The home page'),
>
> 1 => array('name' =>
>'Contact' ,
>  'url'
>=> 'index.php?page=Contact',
>
>'title' => 'The contact details')
>);
>?>
>
>foreach(*$main_navigation_list* as *$index* => *$nav_list*)
>{
>echo ''. *$nav_list*['name'] . '';
>}
>?>
>
>
>
>
>
>
> --- END header.inc --
>
>
>
> In the header.inc I've manually created an array, then got PHP to go
> through the array to add the name, URL and other details from the array,
> but that's just to simplify this, usually I pull the navigation data
> from a database (or if there's no MySQL installed I might unserialise it
> from a file).
>
> There are other ways of pulling the data. If you want nice URLs, you can
> have something like /pages/Home/ and then have a mod_rewrite rule in
> Apache to then change that into index.php?page=Home, (although you'll
> also need to change the  to the new links. If you aren't running
> on apache, you can manually find the page information by doing
> print_r($_SERVER), and seeing what bits and pieces you can put together,
> but that's not nearly as good or reliable.
>
> Sorry if there's too much info, but I'm guessing this is roughly what
> you'll be doing.
> If you want to have more than one variable (like say a sub page) then
> you add  *&* between each variable. E.g
>
>Home -
>Archived News
>
> You can usually get away with just using *&* as the separator but it
> probably won't validate properly if your making it in xhtml (as you
> should be). Also, if your not sure what the %20 means (a space) then
> look up urlencode 
> a