[PHP] problems using an elsif statement on apache php 4.06
I have two php scripts being included on my website. one is a switch statement used for page navigation, and the other is an elseif used to display different html code based on the value of a variable (different on each page) My apache server keeps freezing up and my hosting company tells me that the child processes arent dieing off, requiring me to call them everytime I need to restart the server. What could be causing this? Is theree a better way to display dynamic content besides an elsif statemet? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] HELP! I was just wondering
I've been playing around with php alot lately and started to scheme ways to use it-lol so heres what I tried to do: first there is a switch statement: On that some_file.php I have an elseif like so: Then on the page where thee are required I require them at the top of the page. and I have this: echo "$title"; ?> The first part of the if statement returns true always. My question is why? Arent the variables $page and $refer etc passed over? Am I going about this all wrong? It doesnt work if even in the same file as the page and not in includes. I thought that it didnt matter where we define variables in php, so I tried to define the $title in the body of an html page but that didnt work either-lol using php4 on windows and solaris is there a way to get this type of variable from any predefined HTTP variables? so I tried -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Well I made it work...but
hi! I was unable to find any pre-written php code for a survey without a database and using text files. So I was faced with the challenge of writing my first script! -lol What I eventually ended up with was a 3 answer poll, that will be called for as many questions as I need, then I wil display the total results at the end of the survey. The problem is that the only way I was able to get it to work was to create a seperate text file for each available answer, (eg, yes.txt, no.txt notsure.txt) Which fir multiple questions can get kinda filey-lol This is what I WANTED to do, but was unable so far to find the way if there is one. I wanted to have one text file for answer storage, possibly writing the values for each answer on a seperate line, or a comma seperated list on one line. I was never able to extract values from a specific area in the text file. I tried to use fseek() to move the file pointer, but all I could get was 1 or 0. As I write this I thtink I remember reading of a function that allows you to read part of a file, and print the rest or something, but I need to able to first read a specific line, or value in the file, then extract just that value, and then update that value acording to the users answer, and then replace the updated value back in its respective place. All without touching the other values. Can anyone guide me to the proper way of figuring this out? Also, I wanted to create a IP log to prevent anyone from taking the poll / survey. The way I did it was to simply write the users "REMOTE_ADDR" to a text file, and then I used strstr($firstvalue, $second) to search for it and display the appropriate content. Is this appropriate>? thanks for reading this far-lol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Exact string replacement...
use substr_replace string substr_replace(string text, string replacement, integer start, integer length) EG: '); print(substr_replace($text, "are", 10, 2)); ?> 10 is the place where you want it to start replacement, 2 (is) more forward it ends. "Desikan" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Hi there, > > Please help me out in the following... > > $is='is'; > echo eregi_replace(" ".$is." "," ","This is a test string which contains > is in dismissal"); > ?> > > > Actually I want to replace "is" alone from the string and not all the > words that contains is... > > I have tried with "^".$is."$" ---> but yields nothing > > Also tried with "\b"... > > > thanks and regards, > Desikan > > -- > Desikan > [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] I'm new here is there.....
I know this php.general - is there another newsgroup which specifically deals with help issues? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Colecting IP information
Dunno right off hand about NS and DNS but a simple getenv('REMOTE_ADDR'); will return the IP address of a user. "Philip J. Newman" <[EMAIL PROTECTED]> wrote in message 001d01c1b1c1$b33fec80$0401a8c0@philip">news:001d01c1b1c1$b33fec80$0401a8c0@philip... Trying to colect ip, and name server, dns name from a user how do I do this? can you point me to the right place? Philip J. Newman Philip's Domain - Internet Project. http://www.philipsdomain.com/ [EMAIL PROTECTED] Phone: +64 25 6144012 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] REMOTE_ADDR probs
I will try to call with the other meythodds you suggested and see what happens. I may have not been really clear. on windows everythings working fine on solaris it logs the IP address as the users/visitors (on a nother page) but when using the code I included in my first post to check for a matching IP, its returning the servers IP, thus searching the logged IP list for the servers IP, instead of the users. So on one part of the site it works fine, but on another it doesnt-lol "Michael Sims" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > At 09:41 AM 2/11/2002 -0600, cyberskydive wrote: > >$user = getenv('REMOTE_ADDR'); > [...] > >It works great on windows running apache php 4.0.1 > >but on solaris php 4.06 if I add a > > > >print($first); > > > >it returns the servers IP address, but everywhere else it returns the users > >IP address. > > On the Solaris machine, are you running PHP as an Apache module or as a CGI? > > Check the output of phpinfo() on your solaris machine...see if using > $HTTP_SERVER_VARS["REMOTE_ADDR"] or $HTTP_ENV_VARS["REMOTE_ADDR"] give you > the expected results... > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] writing / reading from text files
I need to write to a specific line in a text file, read from a line on demand, and update values at random, I want to do this all in the same text file. what is the best way to go about this? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] writing / reading from text files
lol- so I use fseek() to move the file pointer before where I need to write/replace/update a value? Is there a parameter for fseek to tell it to move to a newline, or stop after a certain bytes? "Rick Emery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > fopen(), fwrite(),fseek(),fread(),fclose() > > -----Original Message- > From: cyberskydive [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 15, 2002 10:29 AM > To: [EMAIL PROTECTED] > Subject: [PHP] writing / reading from text files > > > I need to write to a specific line in a text file, read from a line on > demand, and update values at random, I want to do this all in the same text > file. > > what is the best way to go about this? > > > > -- > 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] writing / reading from text files
thanks guys, there is just one more question I dont see an answer for anywhere I've looked. will fseek read past \n's and if so how do I move the filepointer to a newline, or should I just put all the data on one line? (not unreasonable n this case) "Rick Emery" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > from the manual: > > int fseek (int fp, int offset [, int whence]) > Sets the file position indicator for the file referenced by fp.The new > position, measured in bytes from the beginning of the file, is obtained by > adding offset to the position specified by whence, whose values are defined > as follows: > SEEK_SET - Set position equal to offset bytes. > SEEK_CUR - Set position to current location plus offset. > SEEK_END - Set position to end-of-file plus offset. > > -Original Message- > From: cyberskydive [mailto:[EMAIL PROTECTED]] > Sent: Friday, February 15, 2002 10:43 AM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] writing / reading from text files > > > lol- so I use fseek() to move the file pointer before where I need to > write/replace/update a value? Is there a parameter for fseek to tell it to > move to a newline, or stop after a certain bytes? > "Rick Emery" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > fopen(), fwrite(),fseek(),fread(),fclose() > > > > -Original Message- > > From: cyberskydive [mailto:[EMAIL PROTECTED]] > > Sent: Friday, February 15, 2002 10:29 AM > > To: [EMAIL PROTECTED] > > Subject: [PHP] writing / reading from text files > > > > > > I need to write to a specific line in a text file, read from a line on > > demand, and update values at random, I want to do this all in the same > text > > file. > > > > what is the best way to go about this? > > > > > > > > -- > > 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 General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 4.1.2 transitional blues
yayy i had my virtual server upgraded to php 4.1.2! oh wait.. nothings F#*&ing working now! a simple dropdown menu- leading to a page containing: doesnt work anymore. contact forms using php_self survey using foreach() mailing list declaring multiple functions called by ?action=whattodo switch stements for links like: somepage.php?get=thisstuff SO is this a configuration problem or is there just going to be a new way of doing things from now on? PLZE!??-lol -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and mySQL...
Since you didnt make it clear, do you even have MySql and php on your server? Are you looking to just move your data or looking to get php & mysql installed on the server as well? (SERVER = production site, not localhost) if you just wanna move data, like everyone else said phpmyadmin rocks, but I do have a recommendation for ya before you jump to the ease of a GUI. Learn how to work in the command line, for the type of situation you are trying to resolve, after you learn that THEN work with a GUI like phpmyadmin. this will both give you a better understanding of mysql commands and also help you to fully appreciate the usefullness of phpmyadmin. -lol if you dont already have mysql php installed on your prodution site, see what it will cost you to have it installed etc, if anyhting, and if its already suppossed to be there, make sure they have set it up for your use, some times ISP's wont create you a database till you ask, or even have the latest version of php intalled for that matter. Even though it's suppossed to be included in your server "option". hope it helps. "Miguel Cruz" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > On Thu, 4 Apr 2002, Anthony Ritter wrote: > > Sorry if my original question was confusing. > > > > This is what I would like to accomplish: > > > > I am currently developing a database on my website using mysql which is on > > my harddrive. > > I have installed Apache as well and I am using PHP. > > > > My database is functioning fine on localhost. > > > > I would like to find out the steps one takes in going from the process of > > having this reside on my harddrive - localhost - in development - to my > > ISP's server when it goes live. > > MySQL has a command-line tool called 'mysqldump' which will output a text > file containing all the table creates and inserts necessary to recreate > the database. > > As others have suggested, you can use phpmyadmin to import this file, or > you can just pipe it into the mysql command-line tool on the server once > you've created your database. Look inside the file created by mysqldump > and all will be much clearer. > > miguel > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: using new AUTOGLOBALS
the thing is, using the methods I described in my first post, the superglobals or autoglobals arent working. I cant figure out why, and , like the other guy said, most books dont include this feature in a topic for discussion. Can anyone offer advice? "Cyberskydive" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]... > So I wanna learn how to code properly with register_globals off, I reead on > PHP.net about the new auto globals and inmy new php4.1.2 windows > installation using php.ini-rec edited according to the intall.txt file, and > a few changes from books I have (upload tmp dir etc) I'm off to learn how to > use the new auto globals. I've tried $_REGISTER and $_POST . Here is what I > tried as a simple test. > > > > > > > --somefile.php-- > > > print("$_REGISTER["is_name"]"); > or > print("$_POST["is_name"]"); > > ?> > > I also tried $HTTP_POST_VARS["name"] > > I didnt think about it till now but would it work if i assigned say : > $is_name = getenv($_POST or $_REGISTER); > > this came about while I was learning sessions, which were not working right > with 4.0 installed with APACHE on windows. So I decided to update my php, as > an ISAPI module, instead of running as a cgi version, and I left > register_globals off. > > when I tried to edit an example session script I had from a book to use > $_POST, $_REGISTER, or even $_SESSION i got a blank page on the reload. I > think sid is returning empty. > > Can anyone offer me advice on this, proper coding and or proper > configuration in PHP.INI > > I'm trying to learn all this at once-lol, and learn it properly the first > time around, especially since register globas will be deprecitated-poof. > > I WANT TO BE A GOOD PHP DUDE_LOL_HAHA > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP books
I have 2 PHP books the first is called PHP fast & easy web development -from primatech the second is called CORE PHP PROGRAMMING by Leon Atkinson I like them both, and I was glad I read fast & easy first, i like core php alot, havent read the whole thing yet, been kinda referencing around it, but still reading the whole thing. has anyone else used these books? what are your opinions and what are some other grest books out there? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] superglobals -sessions-clookies
I think I've got down how to use the new "superglobals" with data sent from forms using whichever method needed. Now I need to learn how to do it with sessions! this is what I'm trying to accomplish. my website/ client list is growing and I want to add the ability for them to login, edit account info, check proress, order new services etc. How do I use sessions, with the new superglobals, to gather the information I will need to write to the database? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php