[PHP] Call another program from withing a program
I need to know if I am doing this the right way or if there is a better way to do this. Scenario, two programs. program_1.php and program_2.php. Based on case statement, program_1 could possibly call program 2. Example: switch ($page) { case '1': break; case '2': do_some_stuff(); break; } The only way I could get that to work was to do a require/include or redirect. Example: Exmaple 1: switch ($page) { case '1': require "program_1.php"; exit; break; } Example 2: switch ($page) { case '1': print ""; exit; break; } Is there a better way to do this? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] mysql_query maximum size
Hi there, Just wondering if there is a maximum size to the sql that can be passed as a mysql_query, either from mysql itself or from the php side of things? I ask only cause I have a limiting clause on my select and I have no idea how big it will grow and I would prefer to write it in such a way that I don't have to worry about it. Thanks for any help Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Spawning a background process
Allo, Basically, my question is.. how do I do this? I am actually (for various .. and probably stupid... reasons) trying to spawn a php process to run in the background. This process I know will take a couple of hours to run (mailing list stuff). I have been playing around with system to try to get it to run in the background but I can't seem to work out how to do it. Any pointers would be a great help Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Cookies and Sessions
Allo, I seem to have run into a couple of problems with a project I am currently working on. First one is that the project has a login feature that tracks the user using cookies. The client alas has a desire to have multiple sites and have the login to other sites in his group seamless (in as much as he would like no additional logging in). Since the login feature uses cookies this requirement isn't quite fulfilled... ok, let me be honest, it ain't filled one little bit! The one thing I do have in my favour is that all the sites (at the moment anyway) have the same SERVER_ADDR. Is there anyway I can set a cookie using and IP Address rather than a URL. I have tried this with little success (setting the path to ""). As a side note, I would like to be able to use sessions more but I am running into some (very) peculiarities. I have a library which starts the session and then I regester variables till my heart is content. Trouble comes when I want to view them in another page... nada! If I do a 'session_is_registered' on the variable it returns true so it seems to have the sessions set up just not updating the values.. not sure. Now I can set up small two file proof of practice examples but when I integrate into my existing project code I suffer from all manner of wierdness .. the most notable being the complete lack of persistence. I know it is a bit of a shot in the dark in as much as I have provided little in the way of diagnostic information, but would any of you bright bunnies be able to give me some pointers as to what I might want to look into to get more of a clue as to what is going on? Cheers for any assistance Kevin @TheConfused -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ImageFill Segmentation Fault
Allo, I am trying to do a dynamic image as a welcome type thing for a site using the GD libraries. I was working on a development machine with 4.0.6 and GIF support and things worked fine. When I (finally) was able to check out the live machine it was 4.0.6 but no GIF support. Ok , I think no problem.. I got PNG. So I converted the image to PNG and rejig the code but it doesn't work now. I am getting a segmentation fault from imagefill when I try to use an image resource created using ImageCreateFromPNG. Does anyone have any experience of this or any clues as to what I can do.. I think in the mean time I am going to try using JPGs! :) Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] large file error
is there some way to enable large file support for the fstat functions? when i try to do an fstat on a large file (4 gig) i get the following error: stat failed for /test/test.gz (errno=127 - Value too large to be stored in data type) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL Queries - Which to Use?
I have been coding php for a while now but can't seem to get a grasp on which type of query I should use for a given situation. mysql_fetch_array mysql_fetch_object mysql_fetch_row Perhaps there is no right answer or perhaps the answer comes with experience. In any case, I would love to get some pointers. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Sterilize user input function
I am looking for general a function to that would render user input harmless. I would write my own but don't know what to strip from the input that could make it potentially damaging on linux boxes. I need to accept email and phone numbers. Thanks in advance, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Sterilize user input function
I think my question could be restated to: What characters are potentially lethal in user input. I can do the regex. But don't know what to parse out of the strings. would removing \ / . do the trick? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] Content management
The following might help you in your quest. You may already be aware of them and perhaps they don't fit your bill but anyway, here it goes. I think phpwebsite is worth a look. http://phpwebsite.appstate.edu/ http://www.postnuke.org/ and have a look through here: http://www.hotscripts.com/PHP/Scripts_and_Programs/Content_Management/ Good Luck -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] find out names of keys in an array
Below is a function I found in the manual or somewhere on php.net. I tried to find it to provide a link so the author would get some credit. Sorry but no luck. Anyway, this is a handy little function when you are trying to figure out the contents of an array. -kevin function array_tree($array , $prep='') { if(!is_array($array)) { print 'array_tree: This is not an array'; return false; } $prep .= '|'; while(list($key, $val) = each($array)) { $type = gettype($val); if(is_array($val)) { $line = "-+ $key ($type)\n"; $line .= array_tree($val, "$prep "); } else { $line = "-> $key = \"$val\" ($type)\n"; } $ret .= $prep.$line; } return $ret; } function parray_tree($array) { print ''; print array_tree($array); print ''; return true; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Apache win question
I know, this isn't an Apache list Upgraded to Apache win 1.3.20 recently. Running Apache 1.3.20, MySQL 2.23.38, Windowz 98 When running a variety of database driven applications, Apache craps out on me. MySQL and Windowz are not affected. Anyone else run into this? All was fine until I upgraded Apache. I am getting tired of restarting Apache 20 times a day. TIA, Sorry for the of topic question Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
RE: [PHP] HTML Table display based upon field contents
Hi Robb, I am a newbie so I wanted to ask a stupid question. In your code below if the first if statement is true it ends the php processing and then you reopen with a new before the first tag and the mailto:[EMAIL PROTECTED] Sent: Saturday, July 24, 2004 4:47 PM To: [EMAIL PROTECTED] Subject: [PHP] HTML Table display based upon field contents I have a complicated table that needs to be altered depending upon the contents of a field in one of my recordsets. I've tried several approaches and need to know what you recommend. I've created three totally different tables and put the HTML code for each into a database. Then I used PHP to insert the relevant code into the page depending upon the contents of a field in a different database. Result - the appropriate code is inserted properly into the HTML. Problem - the HTML table I'm trying to insert contains PHP code which is not executed after being inserted. Because sometimes the HTML table needs 4 rows and other times only 2, I tried enclosing the appropriate s in a PHP IF statement (see below). Problem - PHP IF wasn't executed, both s embedded appeared on page anyway. And, sometimes, the relevant s will include PHP code so this embedding technique won't work. Should I simply describe the entire relevant s on one line, appropriately escape them, assign the to a variable and then use an ECHO to put them on the page? Or does someone have a simpler more elegant solution? Thanx -- Robb Kerr Digital IGUANA Helping Digital Artists Achieve their Dreams http://www.digitaliguana.com http://www.cancerreallysucks.org -- 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] ImageColorAllocate Problem
Hi there, I am having a problem in ImageColorAllocate function. I am using this function in a loop. After some number of looping the function starts returning -1 value. I am attaching my code below. Can any one help me with this? Thanks for reading this far. Kevin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] safe_mode restriction
Greetings, I need to create some directories on the server using script. My server is having safe _mode 'On'. The script is giving me some warning like this. Warning: mkdir(): SAFE MODE Restriction in effect. The script whose uid is 10029 is not allowed to access /home/httpd/vhosts/***../httpdocs/w4/full1/1 owned by uid 48 in /home/httpd/***../httpdocs/w4/dir.php on line 23 creating thumb/$uid"; $oldmask = umask(0); mkdir("thumb/$uid",0777); umask($oldmask); } if (!is_dir("full1/$uid/$c_id")) { echo "creating full1/$uid/$c_id"; $oldmask = umask(0); mkdir("full1/$uid/$c_id",0777); umask($oldmask); } if (!is_dir("thumb/$uid/$c_id")) { echo "creating thumb/$uid/$c_id"; $oldmask = umask(0); mkdir("thumb/$uid/$c_id",0777); umask($oldmask); } echo "Done"; ?> I am able to make first two directories i.e 'full1/1' and 'thumb/1'. Script do not allow me to make 'full1/1/1' and 'thumb/1/1' too. I also have tried removing umask function. Waiting for an answer. Thanks a ton for reading this far. -- Kevin Javia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] safe_mode restriction
Permissions are set to 0777. "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Saturday 07 August 2004 20:17, Kevin wrote: > > > I am able to make first two directories i.e 'full1/1' and 'thumb/1'. Script > > do not allow me to make 'full1/1/1' and 'thumb/1/1' too. I also have tried > > removing umask function. > > What are the permissions on the directories that you are able to make? > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > /* > Paul's Law: > You can't fall off the floor. > */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] safe_mode restriction
> So after the directories are created, those are the actual permissions that > are on them? Did you actually check this or are you assuming it? If you can, > please show us the output of 'ls -al' of the directories in question. Yes, I have seen the permission and its rwx-rwx-rwx i.e 777. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] ImageColorTransparent Problem
Hi, I am having PHP Version 4.3.4 with GD 2.0.15 compatible and PNG support enabled. My problem with the following code is that the image produced be this code is not transparent. It has a black background. I have viewed it in IE 6 and its not transparent. Can someone help me how to make this image transparent? 255) $r = 1; if($g > 255) $g = 100; if($b > 255) $b = 20; $textcolor = imagecolorallocate($im, $r, $g, $b); $r = $r * 3; $g = $g + 10; $b = $b + 20; imagettftext($im, 10, 0, 0, $j, $textcolor, "fonts/2.ttf", "Row number : $i | Color = " . $textcolor); $j=$j+12; } imagepng($im,"kk.png"); ?> Thanks a lot for reading this far. -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ImageColorTransparent Problem
"Jason Davidson" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Does IE even support PNG transparncy properly anyways??? maybe thats the > issue here? Yes, I have tried making the image with imagecreate() function and it was transparent. Using imagecreate() function I was only able to make 256 colors but the image was transparent. I want real colors so I used imagecreatetruecolor() and now the same is not transparent. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: GD/PHP question
This might be helpful to you. http://in2.php.net/manual/en/function.imagecopymerge.php Kevin. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variable just not Behaving Itself.
Hey, I was looking at your code and should that not be an If - ElseIf - Else structure? The way I read this is it first checks to see if the var is set to 'Permanent' and sets $UserStatus. Then regardless of the previous test it does another test on the $Emp_Status_Rqmt to see if it is 'Contactor' and if not it then sets the $UserStatus to 'Flexible'. So if someone is Permanent this would still end up setting the $UserStatus to 'Flexible'. This might be the root of your problem. Excuse me if I have misread the code. :-( HTH Kevin -Original Message- [SNIP] ... $Emp_Status_Rqmt=$row["Emp_Status_Rqmt"]; } if( $Emp_Status_Rqmt == 'Permanent' ) { $UserStatus = 'Permanent'; } if( $Emp_Status_Rqmt == 'Contractor' ) { $UserStatus = 'Contractor'; } else { $UserStatus == 'Flexible'; } [SNIP] which echoes OK until I change the value to something other than Permanent or Contractor. It simple echoes resource ID #n what's wrong with me...? the code I mean...? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Encoding
Greetings, I have heard about PHP Encoding technique. What exactly it does and how is it useful? Any more help will really be appreciated. Thanks a lot for giving your time. -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Encoding
How can I encode my string using my own key? Is there any method to do this? i.e. using base64_encode() and convert_uuencode() functions? -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySql DATABASE creation date
Is there any way to find out MySql DATABASE creation date using PHP and MySql functions? -- Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] General copyright question
Hi there, I have seen some scripts that are copyrighted and one can not modify or use it for purpose. There are many variations in the conditions. My questions are... 1) Are these scripts legally copyrighted. I mean do we need to register the script at some office or what? 2) If yes how can I make my script fall under copyright act. 3) Is it country dependent? Thank a ton for your time. -- Kevin Javia -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] static inheritance in a class object
Anyone know why class static vars are inherited? (See code below) class A { public static $CONFIG = null; } A::$CONFIG = "A"; class B extends A { public static $CONFIG = null; } B::$CONFIG = "B"; print ("A: " . A::$CONFIG . ""); print ("B: " . B::$CONFIG . ""); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Password Protecting
Hello Everyone! I am new to PHP but I am hoping you guys can help me. I would like to have my users go to a page that looks like http://f4.zittle.com/admin, or even just a drop down window or something whre they can enter a username and password. Depending on the username, and of course assuming the password is correct, they will be forwarded to a certain page or directory. I think I need to use a DB but I am not sure anything more. Sorry it is such a simple question but hopefully all of you can help! Thanks in advanced!!! Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Question about creating php files from a form
Hello All, I am trying to figure out how to create files when a user submits a form ... I have seen something about '*fopen*' , is that the direction I should be going? Here is what I am trying to accomplish: I am creating a program to keep track of recipes for my wife. I have have page set up where she can put the name of the recipe, the ingredients, and the amounts of each ingredient. Then she clicks "Submit" I would like a html file with the name of the recipe to be created ie *cookies.html *with a link to the cookies.html created on another page. * *I hope this makes sense, and thank you all for your time... - - Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about creating php files from a form
Ashley Sheridan wrote: On Thu, 2010-05-13 at 23:07 -0400, Kevin wrote: Hello All, I am trying to figure out how to create files when a user submits a form ... I have seen something about '*fopen*' , is that the direction I should be going? Here is what I am trying to accomplish: I am creating a program to keep track of recipes for my wife. I have have page set up where she can put the name of the recipe, the ingredients, and the amounts of each ingredient. Then she clicks "Submit" I would like a html file with the name of the recipe to be created ie *cookies.html *with a link to the cookies.html created on another page. * *I hope this makes sense, and thank you all for your time... - - Kevin It might sound overkill, but I'd use a database for this. All the recipes can be stored in a MySQL database, and then you can use a simple couple of queries to produce the recipe list and the recipe pages dynamically. This also has the advantage that it's very easy to search the recipe list when it becomes larger, and if you ever want to change the layout/presentation of the whole system you won't have to recreate all the recipe pages. The DB could have several columns labelled: id, name, ingredients, method So, the form page (lets assume it's called add.php) could submit to itself which then adds the recipe to the DB with a query like: INSERT INTO recipes(name, ingredients, method) VALUES($name, $ingredients, $method) This is only a very simple example which could be extended to use another table for ingredients for a recipe. Don't forget to sanitise any input coming from the form with mysql_real_escape_string() for inserting it into the DB. The list.php page could just use a simple query like: SELECT id, name FROM recipes And then create a link to each recipe in the form: recipe.php?recipe=id (where id is the numerical value used in the DB) and that would then use a query like: SELECT * FROM recipe WHERE id=$recipe MySQL is available on most hosting that you'll find has support for PHP, and every Linux distribution I've seen has it too. Thanks, Ash http://www.ashleysheridan.co.uk Thank you Ash for the quick reply. I was actually looking at using a database too... and I am testing out a few different ones (SQLite and MySQL) I appreciate the extra information, it will be helpful in the future :-) /On a side note: I am having some issues with connecting to a SQLite database right now ... I'm getting the following error "Fatal Error: 'sqlite_open' is an unknown function" But I'm putting that on the side right now. /I wanted to try a different approach by just creating the recipes in individual html files for the time being. Do happen to know how to create html files from a php form? Thank you. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about creating php files from a form
Paul M Foster wrote: On Thu, May 13, 2010 at 11:53:54PM -0400, Kevin wrote: /On a side note: I am having some issues with connecting to a SQLite database right now ... I'm getting the following error "Fatal Error: 'sqlite_open' is an unknown function" But I'm putting that on the side right now. I think the docs are still screwed up. Try sqlite3_open() instead and see if that works. Also, check phpinfo() to see if the SQLite/SQLite3 modules are loaded. Paul Thanks Paul, I tried with sqlite3_open() and it gave the same error. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Help with dates
Hi there, I seem to be in a bit of a pickle. Right now I'm working on a script that would calculate dates from one calendar to another. The normal calendar we use and a newly invented one. In order to do that I need to find the exact days since the year 0 BC/AD. However, the functions php provides only allow up to the unix epoch. Could you guys give me some pointers on how to accomplish this, accurately? Thanks a million! Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Help with dates
Hey mr. Barnett, Unfortunately, I do need an accurate calculation, because the calculation will run 2 ways. From and to our calendar. I have no problem creating my own datefunctions if I have some idea on how PHP handles the current ones as a template. Then I can figure out the rest for myself. Would you know where I might find more info regarding this in stead? Yours, Kevin Well "Jason Barnett" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with dates
Thank you.. duh... quite useful... not... Where do you think I check first? Yours, Kevin "Jason Wong" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Sunday 06 March 2005 22:11, Kevin wrote: > > > Right now I'm working on a script that would calculate dates from one > > calendar to another. The normal calendar we use and a newly invented > > one. > > > > In order to do that I need to find the exact days since the year 0 > > BC/AD. However, the functions php provides only allow up to the unix > > epoch. > > manual > Calendar Functions > > -- > Jason Wong -> Gremlins Associates -> www.gremlins.biz > Open Source Software Systems Integrators > * Web Design & Hosting * Internet & Intranet Applications Development * > -- > Search the list archives before you post > http://marc.theaimsgroup.com/?l=php-general > -- > New Year Resolution: Ignore top posted posts -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] Re: [suspicious - maybe spam] Re: [PHP] Re: Help with dates
Greetings Mr Mattias, I wish it was so simple. Because the dates that may need calculating can be before 1970. THis function I have.. and it's semi-working, but I've noticed irregularities during the conversion. Thanks for your suggestion!! Yours, Kevin "Mattias Thorslund" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > M. Sokolewicz wrote: > > > well, you can simply use the unix timestamp, since the amount of days > > / seconds since 0 AD/BC will be a constant (it won't change, trust > > me), you can simply add it to that, and add a wrapper function to > > php's time(). You'll be working with VERY big numbers in that case, so > > you can also do it the other way around; store the amount of DAYS > > since 0 AD/BC till Jan 1st 1970, add time()/86400, and you'll have the > > amount of days since 0 AD/BC in an integer (or float, depending on how > > many days that really are). > > > > You'll just need to find that constant somewhere :) > > > > Can't be too hard to calculate it: > > 1970 * 365 + 1 day for each leap year. Note the rules for leap year, of > course. > > /Mattias > > -- > More views at http://www.thorslund.us -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with dates
Mr Lynch, Thanks a lot for your help so far! I will answer or respond in message. Yours, Kevin "Richard Lynch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kevin wrote: > > Right now I'm working on a script that would calculate dates from one > > calendar to another. The normal calendar we use and a newly invented one. > > [shudder] > There are already WAY too many calendar systems. > > Inventing a new one is probably not such a good plan... > > Why re-invent the wheel? It's part of a game. In the RPG there are dates which the players would like to be able to convert from our calendar to that one, and back again.. > > > In order to do that I need to find the exact days since the year 0 BC/AD. > > However, the functions php provides only allow up to the unix epoch. > > > > Could you guys give me some pointers on how to accomplish this, > > accurately? > > Take a look at the MySQL date ranges -- They may have a data type that > allows for more than just 1/1/1970 to 3/??/2038 > > If not, consider using PostgreSQL which has VERY extensive and flexible > date support, for ranges MUCH larger than 0 BC/AD. > http://postgresql.org > > I believe PostgreSQL even supports time scales on the order of geological > events and for astronomical purposes, though not with "day" accuracy. > > I am assuming that by "accurately" you mean "to the nearest day" since you > spoke of "exact days", right? Aye.. it's nearest day, and according to calculations should have repeatable results. So what is date X today should also be it tomorrow (after the calculations of course). That's what i've noticed so far. when I add a date and convert it and then convert it back it is a different date. > > But you didn't define how far into the future you need to go. > Current time? > A few years out? > Stardates from Star Trek? > You have to specify a start date, end date, and accuracy to choose a > correct calendar system. It's mostly the past. The RPG is set in Egypt and the beginning of the society in egypt has been taken as year 0. The start date I think is obvious, but I do not understand an end date of a calendar.. Perhaps I'm just blond.. but could you perhaps explain that one? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with dates
Dear mr. Maas, First of all my appologies for taking so long to respond. I had a family death to attend to. I will respond to the message in message. Yours, Kevin "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > ... > >> > >>Why re-invent the wheel? > > > > > > It's part of a game. In the RPG there are dates which the players would like > > to be able to convert from our calendar to that one, and back again.. > > > > > >>>In order to do that I need to find the exact days since the year 0 > > > > BC/AD. > > why is OBC relevant, I read later on that you take the start of egyptian > civilization as zero. is that not much earlier. Well it's relevant to make a baseline so that I can calculate the difference from then until now. That's the only reason thusfar. > > whats the structure of the egyptian|rpg calendar? A year consists of 769 days, 13 months of 63 days a month, except for month 13 which has 14 days. Every month has 7 weeks of 9 days, of course month 13 is the exception. A day is 24 hours. > > > > >>>However, the functions php provides only allow up to the unix epoch. > >>> > >>>Could you guys give me some pointers on how to accomplish this, > >>>accurately? > >> > >>Take a look at the MySQL date ranges -- They may have a data type that > >>allows for more than just 1/1/1970 to 3/??/2038 > >> > >>If not, consider using PostgreSQL which has VERY extensive and flexible > >>date support, for ranges MUCH larger than 0 BC/AD. > >>http://postgresql.org > >> > >>I believe PostgreSQL even supports time scales on the order of geological > >>events and for astronomical purposes, though not with "day" accuracy. > >> > > +1 on using a DB to calculate and format dates on this one :-) > I'm guessing Kevins probably written an SQL statement before and he's > already proved he can RTFPM (P for PHP) > > >>I am assuming that by "accurately" you mean "to the nearest day" since you > >>spoke of "exact days", right? > > > > > > Aye.. it's nearest day, and according to calculations should have repeatable > > results. So what is date X today should also be it tomorrow (after the > > calculations of course). That's what i've noticed so far. when I add a date > > and convert it and then convert it back it is a different date. > > > > show us some code :-) At the end of the message code will be provided. > > >>But you didn't define how far into the future you need to go. > >>Current time? > >>A few years out? > >>Stardates from Star Trek? > >>You have to specify a start date, end date, and accuracy to choose a > >>correct calendar system. > > > > > > It's mostly the past. The RPG is set in Egypt and the beginning of the > > society in egypt has been taken as year 0. The start date I think is > > obvious, but I do not understand an end date of a calendar.. Perhaps I'm > > just blond.. but could you perhaps explain that one? > > > > I must be blond, I don't even grok that question :-/ WEll I don't understand why an end date is important or what is meant with accuracy. The term being blond is, at least in the Netherlands "a dumb blond", so I made it so that when I am dumb or anything, I'm blond (which in fact I am - dark blond) :-P. > > rgds, > jochem Code: function get_date_ec($EarthDay, $EarthMonth, $EarthYear) { $DayOfYear = 0; # Setting internal date variables. $intDay = intval($EarthDay); $intMonth = intval($EarthMonth); $intYear = intval($EarthYear); $array_MonthDays["1"] = intval(31);// January $array_MonthDays["3"] = intval(31);// March $array_MonthDays["4"] = intval(30);// April $array_MonthDays["5"] = intval(31);// May $array_MonthDays["6"] = intval(30);// June $array_MonthDays["7"] = intval(31);// July $array_MonthDays["8"] = intval(31);// August $array_MonthDays["9"] = intval(30);// September $array_MonthDays["10"] = intval(31); // October $array_MonthDays["11"] = intval(30); // November $array_MonthDays["12"] = intval(31); // December # Making a few Leap Year Checks $RETURN_CHECK_LEAP_YEAR = check_leap_year($intYear); if ($RETURN_CHECK_LEAP_YEAR == TRUE) { $array_MonthDays["2"] = intval(29); // february } else { $array_MonthDays["2"] =
Re: [PHP] password Boxes
"Richard Lynch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Does anyone know how to change the style of password boxes so when the > > characters are entered an asterisk appears rather that a smal circle? > > > > Or is this just determed by the OS and uncangable with CSS or Javascript > > of > > PHP? > > They are certainly NOT changeable with PHP. > > I doubt that JavaScript holds the answer either. I don't know much about JavaScript or VBScript, but I believe there is an action called "OnKeyPress" or something to that effect. If that's there, writing a function that accepts the key pressed and replace it with another character, while the original pressed character is stored in a shadow array? Like I said.. have no clue, if this is possible, but that is what I would try > > You might, however, find an HTML ATTRIBUTE supported by some browsers that > allows you to change the character used. I doubt it, but it's possible. > > If it is possible, presumably CSS allows you to change the attribute as > well, though you never know for sure with CSS... > > For sure, whatever you do find, it ain't something that's standard across > all browsers. But you may only care about the one browser that uses the > small circles anyway. > > Why in the world do you WANT to change it? [puzzled] > > -- > Like Music? > http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with dates
Dear Jochem and all the others who have offered help, Thank you all for your assistance! Thanks to all of you I have been able to reach the next step in the design process! Thanks ever so much! Most sincerely, Kevin "Jochem Maas" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Kevin wrote: > > Dear mr. Maas, > > no need for 'mr' :-) > > > > > First of all my appologies for taking so long to respond. I had a family > > death to attend to. > > my condolences. > there is no need to apologise in any case. > > ... > > >> > >>why is OBC relevant, I read later on that you take the start of egyptian > >>civilization as zero. is that not much earlier. > > > > > > Well it's relevant to make a baseline so that I can calculate the difference > > from then until now. That's the only reason thusfar. > > > > > >>whats the structure of the egyptian|rpg calendar? > > > > > > A year consists of 769 days, 13 months of 63 days a month, except for month > > 13 which has 14 days. Every month has 7 weeks of 9 days, of course month 13 > > is the exception. A day is 24 hours. > > > > a few thoughts: > > 1. you have a date in both calendars which represent the same day? > and/or rather what is day zero in the egyptian calendar in the gregorian > calendar? > > 2. maybe you should store the date internally as number of days since zero, > where zero is the first day on the egyptian calendar .. > > er, checking this thread again, Richard Lynch puts it better than I can so > I'll just let you read his answer (again?) and hope it helps! > > > oh one last thing: I notice that in the function you posted you did this: > > > # Calculating the year in Egypt. > $yr_Egypt = floor($EgyptianDays / 769); > # Calculating the Month in Egypt. > $mnt_Egypt = round( ($EgyptianDays-($yr_Egypt*769)) / 63 ); > # Calculating the Day in Egypt. > $dy_Egypt = round( $EgyptianDays - (($yr_Egypt * 769) + ($mnt_Egypt * 63)) ); > # Filling the date array variable with the day, month and year of the > Egyptian calendar. > $ec_date["Day"] = $dy_Egypt; > $ec_date["Month"] = $mnt_Egypt; > $ec_date["Year"] = $yr_Egypt; > # Returning the Calculated date. > return $ec_date; > > which could be written more succinctly as: > > > /* Calculating the year,month,day in Egypt and returning. */ > return array ( > "Year" => ($y = floor( $EgyptianDays / 769 )), > "Month" => ($m = round( ($EgyptianDays - ($y * 769)) / 63 )), > "Day" => round( $EgyptianDays - (($y * 769) + ($m * 63)) ), > ); > > that might inspire you to use less variables in your code, which is a good thing - but in this > case completely beside the point. whats less beside the point is that you use floor() for the year > and round() for the day and month, I wonder if it helps if you use floor() for all 3? > > beware of floating point rounding errors, compare: > > > $EgyptianDays = 10345; > > var_dump( > > array( > "Year" => ($y = floor( $EgyptianDays / 769 )), > "Month" => ($m = floor( ($EgyptianDays - ($y * 769)) / 63 )), > "Day" => floor( $EgyptianDays - (($y * 769) + ($m * 63)) ), > ), > > array( > "Year" => ($y = floor( $EgyptianDays / 769 )), > "Month" => ($m = round( ($EgyptianDays - ($y * 769)) / 63 )), > "Day" => round( $EgyptianDays - (($y * 769) + ($m * 63)) ), > ) > > ); > > ?> > > kind regards, > Jochem -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] OT - Help creating Tables
Hi, I am working on a program for a clothing manufacture and need some help designing the tables for the database. I have to track the inventory levels of each style by color and size and can not figure the tables out. Here is the information I need to track. Style number Color Size (can have from 1 to 10 different sizes) Also need to track the transactions. Receipt Number for incoming inventory and Invoice number for outgoing. Can anyone help me figure out how to setup the tables? Once that is done, I think I can get the rest working. Thanks!!! Kevin
[PHP] OT - Table help needed~ PLEASE
Hi, I am working on a program for a clothing manufacture and need some help designing the tables for the database. I have to track the inventory levels of each style by color and size and can not figure the tables out. Here is the information I need to track. Style number Color Size (can have from 1 to 10 different sizes) Also need to track the transactions. Receipt Number for incoming inventory and Invoice number for outgoing. Can anyone help me figure out how to setup the tables? Once that is done, I think I can get the rest working. Thanks!!! Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object-oriented $_REQUEST?
""Buesching, Logan J"" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] I feel that a 'request' class wouldn't be appropriate for the $_REQUEST array. The reason being, is that there isn't to that class other than the $_REQUEST array, and a bunch of 'get' methods. If this were to be expanded upon by adding filtering user input, then it *could* be more useful. IMO an entire class just to handle retrieving data an array (or 4 if you include GPC and request) would become unnecessary overhead. But then again, maybe I am missing the point of this 'request' class. -Logan > -Original Message- > From: js [mailto:[EMAIL PROTECTED] > Sent: Saturday, April 28, 2007 2:56 PM > To: php-general@lists.php.net > Subject: [PHP] Object-oriented $_REQUEST? > > Hi. > > I'm looking for implementation of request object > that represent a request that works like this. > > $r = new request(); > if ($r->method == 'GET') > $name = $r->GET->get('name'); > $age = $r->GET->get('age'); > else if (request.method == 'POST') > $name = $r->POST->get('name'); > $age = $r->POST->get('age'); > ... > > Handling $_GET, $_POST directly is cumbersome for me > so I tried to make one but I thought it's quite possible that > some better programmer already make one like this. > > Thanks in advance. > > -- > 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] Re: Object-oriented $_REQUEST?
array = &$array; } public function get($key) { if (isset($this->array[$key])) return $this->array[$key]; return null; } } class request { private $types = array('COOKIE', 'REQUEST', 'GET', 'POST', 'SESSION'); function __construct() { foreach ($this->types as $type) { //do not link the result of eval into a variable because it is passed to __construct as reference $this->$type = new get(eval('return $_' . $type . ';')); } } } $request = new request(); var_dump($request->REQUEST->get('name')); ?> ""js "" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Hi. > > I'm looking for implementation of request object > that represent a request that works like this. > > $r = new request(); > if ($r->method == 'GET') >$name = $r->GET->get('name'); >$age = $r->GET->get('age'); > else if (request.method == 'POST') >$name = $r->POST->get('name'); >$age = $r->POST->get('age'); > ... > > Handling $_GET, $_POST directly is cumbersome for me > so I tried to make one but I thought it's quite possible that > some better programmer already make one like this. > > Thanks in advance. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Template Problems
Hi, I have 3 domains: www.example1.com, www.example2.com www.template.com I have a PHP website on www.template.com with a database. in this database I have many tables one of which is sites, which has a list of the sites using the template with a site_id. Example of this data is: Site_id, URL, Name 1 www.example1.comExample 1 2 www.example2.comExample 2 All of the other tables have the site_id in to relate to what site should be shown what information. However I can't have the user seeing the url as "www.template.com" instead it needs to say what they typed in for example "www.example1.com" I need to somehow redirect the user from "www.example1.com" (but mask the url) to "www.template.com" with the correct site_id passed through for every single page they visit (which says what data the template should load) which I would manually set in example1.com, this would then allow the user to browse the site and goto the next one when they want. Can anyone help Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Template
Hi, I have 3 domains: www.example1.com, www.example2.com www.template.com I have a PHP website on www.template.com with a database. in this database I have many tables one of which is sites, which has a list of the sites using the template with a site_id. Example of this data is: Site_id, URL, Name 1 www.example1.comExample 1 2 www.example2.comExample 2 All of the other tables have the site_id in to relate to what site should be shown what information. However I can't have the user seeing the url as "www.template.com" instead it needs to say what they typed in for example "www.example1.com" I need to somehow redirect the user from "www.example1.com" (but mask the url) to "www.template.com" with the correct site_id passed through for every single page they visit (which says what data the template should load) which I would manually set in example1.com, this would then allow the user to browse the site and goto the next one when they want. Can anyone help Thanks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Template Trouble
Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev
Re: [PHP] PHP Template Trouble
Hi, Yes there was an error, I never meant to post 3 times it backlogged in the system and my bulk detector picked up the email from php.net asking me to register my email so sorry about that. I am actually using Windows IIS, there is a IISRewrite which does the same as mod_rewrite, however the problem I had using that is you can only change the bit after www.example.com so for example if i had www.example.com?cat_id=5 i could rewrite that to www.example.com/games/ however I didn't find a way of rewriting the entire URL to make it look like a different site, if that is possible however I'll look further into it but at the time being I have found no way. Thanks Frank Arensmeier wrote: Kevin, there is no need to post the same question three times to this list. Your chances on getting helpful responses won't increase. The issue you describe is more related to Apache (assuming that you are on an Apache server) and URL rewriting than to PHP. Ask Google for "Apache mod_rewrite" and I am sure you will find some stuff that will help you. /frank 25 okt 2006 kl. 11.49 skrev Kevin: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Template Trouble
Hi Brad, That sounds like a good idea however: Where would config.php go? If it goes on the www.solution.com side of things, then $_SERVER[HTTP_HOST] will always be www.solution.com and if it goes on another then it would be www.example1.com. What you have put would be the kind of solution I am looking for but its the $_SERVER[HTTP_HOST] variable that would need to be posted through correctly, even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com Thanks Kevin Brad Fuller wrote: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev Here's just an idea to give you maybe a starting point to go from... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Template Trouble
Sorry, made a mistake in that last post: "even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com " It would actually equal www.solution.com once its in the frame as well not www.example1.com which is what i've put above. Thanks Brad Fuller wrote: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev Here's just an idea to give you maybe a starting point to go from... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Template Trouble
Yes all the sites are located on a Windows 2003 Dedicated Server. Kevin wrote: Sorry, made a mistake in that last post: "even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com " It would actually equal www.solution.com once its in the frame as well not www.example1.com which is what i've put above. Thanks Brad Fuller wrote: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev Here's just an idea to give you maybe a starting point to go from... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Template Trouble
Yes all the sites are located on a Windows 2003 Dedicated Server. Kevin Brad Fuller wrote: Kevin, Are all these sites hosted on the same box? -Brad -Original Message- From: Kevin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 9:37 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Template Trouble Hi Brad, That sounds like a good idea however: Where would config.php go? If it goes on the www.solution.com side of things, then $_SERVER[HTTP_HOST] will always be www.solution.com and if it goes on another then it would be www.example1.com. What you have put would be the kind of solution I am looking for but its the $_SERVER[HTTP_HOST] variable that would need to be posted through correctly, even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com Thanks Kevin Brad Fuller wrote: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev Here's just an idea to give you maybe a starting point to go from... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Template Trouble
But the dedicated server has security. In order to use it you must create accounts (these are your ftp accounts) so basically I have example mapped to www.example.com and example2 mapped to www.example2.com example's root dir would be along the lines of: c:\inetpub\www\example\htdocs example2's root dir would be c:\inetput\www\example2\htdocs Example2 cannot access the root dir of example because of the security, it gives a permission denied error and the same the other way around. Kevin Brad Fuller wrote: Cool, then what you want to do is make all the domains point to the same directory, have your files index.php and config.php in that directory and it should work like magic. Then you end up with one copy of the files and how ever many sites you need. No frames, no duplicated code. It's been a long time (5+ years) since I worked with Windows/IIS, sorry I don't have more specific instructions on how to do the above. Hope that's enough to get you started in the right direction. -Brad -Original Message- From: Kevin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 10:15 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Template Trouble Yes all the sites are located on a Windows 2003 Dedicated Server. Kevin Brad Fuller wrote: Kevin, Are all these sites hosted on the same box? -Brad -Original Message- From: Kevin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 9:37 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Template Trouble Hi Brad, That sounds like a good idea however: Where would config.php go? If it goes on the www.solution.com side of things, then $_SERVER[HTTP_HOST] will always be www.solution.com and if it goes on another then it would be www.example1.com. What you have put would be the kind of solution I am looking for but its the $_SERVER[HTTP_HOST] variable that would need to be posted through correctly, even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com Thanks Kevin Brad Fuller wrote: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev Here's just an idea to give you maybe a starting point to go from... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Template Trouble
Brad, I cant thank you enough!!! This has been getting to me for weeks. I simply moved the mapping of the URL's so that all the URL's point to the same website, i could then use that http _host to pick them up and then i've basically used this to query the database and give me what I want. It was so simple in the end but I never even thought about doing it this way, i knew there would be an easy solution though. It works perfectly, finally i can get some sleep.. now just got to get around to fixing all the installation! Well, I'm sure there is a better way to do it, but this should work. config.php does not need to be dynamic in this scenario. 1. Copy index.php and config.php into each site's directory. 2. Change the $db_name variable in config.php to use the correct database. ".$_SERVER['HTTP_HOST'].""; print "This site is using the database name \"{$db_name}\""; print ""; ?> If you can't get it to work using this method, I give up :P Cheers ;) - Brad -Original Message- From: Kevin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 10:39 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Template Trouble But the dedicated server has security. In order to use it you must create accounts (these are your ftp accounts) so basically I have example mapped to www.example.com and example2 mapped to www.example2.com example's root dir would be along the lines of: c:\inetpub\www\example\htdocs example2's root dir would be c:\inetput\www\example2\htdocs Example2 cannot access the root dir of example because of the security, it gives a permission denied error and the same the other way around. Kevin Brad Fuller wrote: Cool, then what you want to do is make all the domains point to the same directory, have your files index.php and config.php in that directory and it should work like magic. Then you end up with one copy of the files and how ever many sites you need. No frames, no duplicated code. It's been a long time (5+ years) since I worked with Windows/IIS, sorry I don't have more specific instructions on how to do the above. Hope that's enough to get you started in the right direction. -Brad -Original Message- From: Kevin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 10:15 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Template Trouble Yes all the sites are located on a Windows 2003 Dedicated Server. Kevin Brad Fuller wrote: Kevin, Are all these sites hosted on the same box? -Brad -Original Message- From: Kevin [mailto:[EMAIL PROTECTED] Sent: Thursday, October 26, 2006 9:37 AM To: php-general@lists.php.net Subject: Re: [PHP] PHP Template Trouble Hi Brad, That sounds like a good idea however: Where would config.php go? If it goes on the www.solution.com side of things, then $_SERVER[HTTP_HOST] will always be www.solution.com and if it goes on another then it would be www.example1.com. What you have put would be the kind of solution I am looking for but its the $_SERVER[HTTP_HOST] variable that would need to be posted through correctly, even if using frames on www.example1.com (using them to load www.solution.com) $_SERVER[HTTP_HOST] would still equal www.example1.com Thanks Kevin Brad Fuller wrote: Hi, I am trying to have 1 template site and have an unlimited number of websites using this template site to call there own information. The sites are exactly the same except for the database, each of the sites also needs there own URL, for example one of these urls may be www.example1.com and the other www.example2.com. These sites are identical apart from the database they call to, one will call to a database called example1 and the other example2. I want another site (for example www.solution.com) to read what url has been entered and to pull in the database for that site (either example1 or example2) and show that information. I have tried using the CURL library without success (not sure how to use it fully) and have tried using frames but had loads of problems regarding losing session data. can anyone help? Thanks Kev Here's just an idea to give you maybe a starting point to go from... -- 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 Search Engine - Synonyms
Hi, Is it possible to automatically search for synonyms related to a word in a search engine for example if I create a search engine and search for the word 'Horse', it would automatically search for other words such as 'Pony' etc? Has anyone had any experience on how this would be implemented? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IIS Rewrite or Mod_Rewrite
Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5&ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5&ln_id=4&ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IIS Rewrite or Mod_Rewrite
Jochem Maas wrote: Kevin wrote: Hi, I have created a website which is using the iis rewrite module to write the following: index.php?tn_id=5&ln_id=4 to something like /contact/directions.html and this works fine however I have a link at the bottom which needs to pass another variable through the query string before it would simply be: index.php?tn_id=5&ln_id=4&ts=75 however if i run /contact/directions.html?ts=75 it doesn't work and comes up with a 404 page not found error. Is there anyway around this? yes Apache, are you allowed/able to use apache? Thanks Kevin no only allowed to use windows server -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 'View as HTML' Conversions
Hi, We are trying to create a script which (the same as google search and gmail) allows for PDF's, Doc's, Excel etc to be converted to HTML documents dynamically, this is just in case users want to view documents but don't have the necessary software. The HTML needs to keep as much of the styling as possible. Does anyone know how google have done this? or does anyone know any PHP equivalents, we are using the Windows IIS server. Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: 'View as HTML' Conversions
Rosty Kerei wrote: "Kevin" <[EMAIL PROTECTED]> ???/ ? ?: news:[EMAIL PROTECTED] Hi, We are trying to create a script which (the same as google search and gmail) allows for PDF's, Doc's, Excel etc to be converted to HTML documents dynamically, this is just in case users want to view documents but don't have the necessary software. The HTML needs to keep as much of the styling as possible. Does anyone know how google have done this? or does anyone know any PHP equivalents, we are using the Windows IIS server. You may try to use COM to convert MS Office files to HTML, something like $doc = new COM('somewordfile.doc'); $doc->saveAs('somewordfile.html', 10); $doc->close(); Hi Thanks for that, the com library seems the way to do it, just a bit unsure what I would need to do, I take it I would need to install the office suite on the server, would I also need to install all converters on the server too? for example would i need to install the adobe acrobat printer, so that I can call the print function and print it to that printer, then move the output file to where i want??! Could you provide just one example of how to open a word doc, print it to a printer (say an adobe printer) and move it to a folder on the system?! What security holes would this leave open and is there any other information regarding security I could up on? Thanks for your help Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Spam using email on website
Pieter du Toit wrote: Hi guys I have a website that is being crawled or whatever and i have a submission form for an event. I keep on getting random mail from this form. I have even disabled the submit button on the form, but keep on getting it. What can i do? Did you write the mail sender script yourself? A spammer can simply submit your form using there own server or any other server with your fields, so you need to stop the processing on your server side if you simply want to disable it. If you want it work however then that you could use the GD library to create an image on the fly showing 5 numbers, which the user needs to fill in in order to send, this would stop the bots from being automate your form. Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Read Through PHP Files
Hi, I am using the function fopen to open a word document, loading the contents into a variable and then using a substr_count to count the number of times a certain string is found, this is allowing me to search through the file and say how many times the word appears, I can even use str_replace to highlight certain words. However Microsoft word seems to put a lot of rubbish in the header and footer, I am wondering is it possible to filter this rubbish out to get the exact document. I also tried using fopen to open a PDF file, but as PDF is handled differently it came up completely different with no words at all, just full of rubbish. Is there anyway I can get this information using a simple fopen? I am basically trying to create a search engine which can read within files similar to google. The only problem I would have after I have done all this is actually weighting the search results, however I would probably have to create the results first and then finally go through the results to try to weight them. Does anyone else have any experience in this or could help me out with any of the problems I am having? Thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Extension help
Hello all, I have the source code for a C library who's functions i wish to expose to php. Ideally i'd like to be able to use dl() or put the library file location into php.ini to allow use of the functions. Is there a tutorial on how to do this? I've read over the Zend API stuff, and i dont mind doing some configuation, but a list of the steps would be very handy today... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] loking for a item in string?
On Sun, Nov 07, 2004 at 08:32:53AM -0600, Greg Donald wrote: > On Sat, 6 Nov 2004 21:58:49 -0600, Dustin Wish with INDCO Networks > preg_match() can do that. > > php.net/preg_match > Easiest possible way to do this ( for you the programmer ) is to slurp the whole file in as a string and search for your pattern across newlines -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Converting a query for use in a form
Hi everyone, I hope you can all help me. I want to take the information I get from a query and use it is a form as a dropdown select box. For example I want to pull the colors from a table and list them in a drop down box and then when a user selects a color it will pass the colorID for use in writing to another table. I hope that comes across the way I mean. :-( Anyway, I think I used to use something called wddx with java to do this when I was coding in ColdFusion. Thanks!! Kevin Rose Valley Soaps
Re: [PHP] decimal places
Try.. printf("%.2f", $amount); -Kevin - Original Message - From: "Bryan Koschmann - GKT" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Tuesday, November 26, 2002 12:29 PM Subject: [PHP] decimal places > Hello, > > Does anyone here have a good way to make sure dollar amounts are formatted > properly? I have something that returns data, but the problem is it's > stored where any trailing zero isn't kept, like this: > > $16.95 or $172.82 are fine > > $17.90 or $190.20 come back as $17.9 and $190.2 > > I would like to make sure they are all properly formatted. Any ideas? > > Thanks in advance, > > Bryan > > > -- > 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] IE Problems: disappearing text with 'Back' button
> ''){print "value='{$_SESSION['rfname']}'';}> > > but I just get a ? in the value field, not the name. Yeah there's a good reason for that. You're not ending yoiur PHP tag! :-P Joking aside you're on the right track. This IS the way to do it. You should never rely on the browsers cache to re-input form values in a multi-page form. Allow me to clean that up for you a bit.. Hope that helps. Good luck. -Kevin - Original Message - From: "Andre Dubuc" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, November 26, 2002 12:29 PM Subject: [PHP] IE Problems: disappearing text with 'Back' button > A few people using IE have complained that when they click the 'Back' button > to edit their registration form, all info is lost and they're presented with > a blank form. > > I've read archives on this, and I really don't know what to do. The referring > page starts with > > and I know the session variables are > passed. The referring page is headered to the check page where users would > click 'Back' > > The session variables are there too. Is there some way that I could: > > (a) Prevent the 'blank-form-syndrome' > > or > > (b) Encode the so that the name is > filled in - I've tried: > > ''){print "value='{$_SESSION['rfname']}'';}> > > but I just get a ? in the value field, not the name. > > or > > (c) As much as hate to use it, javascript. I've coded everything without it, > so only if I can't accomplish a reasonable approximation of 'Back' in a php > hack. > > or > > (d)I read in one of the last archived messages about a workaround. After the > user clicks 'Back' and is confronted with a now-virgin form, all they have > to do is click 'Refresh' in IE. Question is, does IE have a 'Refresh' button, > and does this, in fact, work? I have no way of testing this since I only have > Linux running. So, if some kind soul could verify whether this is true, it > would save me a whole pile of coding! > > I would be very grateful for any suggestions on to retrieve hyper-lost data > input using php. > > Tia, Andre > > > > > -- > 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] Re: How to give parameters to a console php-script?
Hi, I want to do the same under unix:- > php myscript.php4 myparameter but the PHP CGI supplied by my ISP has register_argc_argv switched off. Is there any other way to access command line parameters when register_argc_argv is off? Thanks, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: How do I include specific files?
Hi Roddie, The require or include functions will do this for you, see http://www.php.net/manual/en/function.include.php Paths are absolute to the file system, not where the web server path starts, eg suppose your file is at /usr/home/www/riddie/phpscripts/somedir/script.php you would include a file (into script.php) from the phpscripts directory using either require('/usr/home/www/riddie/phpscripts/myincfile.php') or require('../myincfile.php') but require('/phpscripts/myincfile.php') would not work as php does not work from paths set by the webserver. HTH, Kevin Roddie Grant <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > I'm new to PHP, but from Lasso I'm used to the following sort of arrangement > (in pseudo-code) > > Search for matching records > If number found=1 > include "/folder/subfolder/file1" > If number found>1 > include "/folder/subfolder/file2" > If number found=0 > include "/anotherfolder/subfolder/file99" > > where the included file contains the appropriate code for displaying a list, > a detailed record etc. In fact the whole page is made up almost entirely > from a succession of included files. > > The paths all "hang" from the root as with HTML (for example src="/images-folder-at-root-level/image.gif">). > > In PHP the include_path stops this process in its tracks. I'm with an ISP so > I don't suppose I can control include_path (.:/usr/local/lib/php). Are there > any other options? > > TIA > > Roddie Grant > [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] formating numbers & date
To change the number of decimal places look into the number_format() function. To change the date/time structure the date() function will do what you need. Search for both on www.php.net -Kevin - Original Message - From: "Jeff Bluemel" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 1:11 PM Subject: [PHP] formating numbers & date > I'm curious how I change the number of decimal places displayed, and also > changing the date / time structures before displaying them with an echo > command. > > Jeff > > > > -- > 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] "x" as a multiplier
Is it possible you're mistaken somehow? x isn't an operator in PHP. Executing $a x $b will give you a parse error. Anything in quotes is automatically casted as a string. -Kevin - Original Message - From: "John Meyer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 3:20 PM Subject: [PHP] "x" as a multiplier > Code: > > $newwidth . "x" . $newheight > > > What I want to get out is a string, like 89x115. All I am getting though, > is one number, even though if I do this > > $newwidth . " x " . $newheight > > It prints out just fine. What is going on here? > > > -- > 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] "x" as a multiplier
Adam, I know this. In reaction to the subject of John's post I cleared up the fact that x can not be acting as a multiplier becuase it is not an operator. My suggestion was that there may something else in his code that is causing the confusion.. making it look like it's doing something that it's not actually doing. Does that make more sense? :-\ John, please copy and paste the output of the following experiment.. $a = 1; $b = 2; echo "$ax$b"; echo $a."x".$b; echo $a.'x'.$b; -Kevin - Original Message - From: "John Meyer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 03, 2002 3:59 PM Subject: RE: [PHP] "x" as a multiplier > Exactly. But it's only giving me one of the numbers without the space > between the numbers and the x. > > -Original Message- > From: Adam Williams [mailto:[EMAIL PROTECTED]] > Sent: Tuesday, December 03, 2002 3:48 PM > To: Kevin Stone > Cc: John Meyer; [EMAIL PROTECTED] > Subject: Re: [PHP] "x" as a multiplier > > > I don't think he's trying to multiply, I think he wants to print #x#, like > 800x600 or 1024x768, etc... > > Adam > > On Tue, 3 Dec 2002, Kevin Stone wrote: > > > Is it possible you're mistaken somehow? x isn't an operator in PHP. > > Executing $a x $b will give you a parse error. Anything in quotes is > > automatically casted as a string. > > -Kevin > > > > - Original Message - > > From: "John Meyer" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Tuesday, December 03, 2002 3:20 PM > > Subject: [PHP] "x" as a multiplier > > > > > > > Code: > > > > > > $newwidth . "x" . $newheight > > > > > > > > > What I want to get out is a string, like 89x115. All I am getting > though, > > > is one number, even though if I do this > > > > > > $newwidth . " x " . $newheight > > > > > > It prints out just fine. What is going on here? > > > > > > > > > -- > > > 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
Re: [PHP] Looping Addition
You simply need the absolute value of the difference. So taking Stephen's example below.. $total = 0; foreach( $_POST['nums'] as $number ) { $total -= $number;// if users inputs 5 as first value result equals -5 $total = abs($total); // result now equals 5 } - Original Message - From: "Stephen" <[EMAIL PROTECTED]> To: "Chris Wesley" <[EMAIL PROTECTED]> Cc: "PHP List" <[EMAIL PROTECTED]> Sent: Thursday, December 05, 2002 12:33 PM Subject: Re: [PHP] Looping Addition > Continuing this even more...how would I use this same method only to > subtract? > > What I'm doing right now would result in the following sitution. > > The user types in 5 as their first number. The second number is 4. Instead > of returnin 1, it returns -9. It's subtracting the first number from 0, then > taking 4 and subtracting that from -5. How can I fix this keeping in mind > the user may type in more then two numbers? > > > - Original Message - > From: "Chris Wesley" <[EMAIL PROTECTED]> > To: "PHP List" <[EMAIL PROTECTED]> > Cc: "Stephen" <[EMAIL PROTECTED]> > Sent: Wednesday, December 04, 2002 8:42 PM > Subject: Re: [PHP] Looping Addition > > > > On Wed, 4 Dec 2002, Stephen wrote: > > > This is only a snippet, there is more to it but for simplicities sake... > > > Then I calculate it. My question is, how would I loop the adding? I hope > you > > > understand this now... > > > > Ah!, I think I understand better now. You want to add num1, num2, num3, > > ... numN, which are inputs from the second form in your sequence. Gotcha. > > > > If you name /all/ the form elements as "nums[]" instead of individually as > > "num${current}", the numbers put into the form will all be accessible in > > one array to the PHP script that does the adding. Then you can just loop > > over the array of numbers. > > > > In your second form, change this: > > " > size="25">" > > > > To this: > > " > > > > Then in the script that adds the numbers: > > $total = 0; > > foreach( $_POST['nums'] as $number ){ > > $total += $number; > > } > > > > Hopefully I understood your problem this time! Let me know if I missed > > again. > > g.luck, > > ~Chris > > > > > > > -- > 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 adding slash to MySql results
Hi, I have just noticed a problem reading MySql data with PHP running as an apache module. Basically, any data retrieved from MySql that contains a single quote (and no doubt other characters too) is displayed with a slash in it when printed by PHP. For example: $surname = "O'Brien"; print "$surname"; displays - O'Brien - while $surname=mysql_result($result,0,"surname"); print "$surname"; displays - O\'Brien - even thought doing a select from the shell shows that is stored in mysql without the slash My ISP reciently upgraded from 4.12 to 4.2.2 and i wonder if this has anything to do with this, as these scripts did not ass slashes in print outputs before and have not been changed. I'm sure this is some PHP configuration thing, but magic quotes are off, and in any case I assumed this applied to incoming data only? What do I need to change and can I do this within a .htaccess file so it can easily be applied to all my scripts without changing them? Many thanks, Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP adding slash to MySql results
Forgot to say this is running in FreeBSD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP adding slash to MySql results
Hi Marek, That is switched off. However, I was just having another look at the problem, and, it actually appears to be fixed! I didnt shange anything, so the ISP must have done something? Thanks, Kevin Marek Kilimajer <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > You ISP turned magic_quotes_runtime on, use set_magic_quotes_runtime() > to override it. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forms
This HTML is invalid. Is it the same way in your script? Mary Do instead. Mary -Kevin - Original Message - From: "Beauford.2002" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 2:36 PM Subject: [PHP] Forms > Hi, > > I'm sending this to both lists as I'm not sure where the problem is, but I > believe it is an issue with my HTML form. Here's the problem: > > I have a drop-down menu form on my webpage with employee names in it. When I > choose a name and click submit it gets passed to a php page which accesses a > mysql database and displays information about that employee. > > The problem is that the form is not sending the employee name to the php > page. If I insert the name in the php page manually, it works fine, so the > problem appears to be with the form. > > Can someone help me out here - a sample of my code is below. I'm not sure > how to explain this, but whatever gets sent to the PHP page has to be one > variable - i.e. if I choose John, then the variable that gets sent to the > PHP should have the value John, if I choose Mary, the value of the variable > should be Mary. Hope this makes sense. > > TIA > > > > > John > Mary > > > > > > -- > 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 and MySQL
Numerous syntax errors produce your invalid query... 1) If you use double quotes to enclose the string, "INSERT..., then you do not have to delimit your single quotes. 2) You accidently delimit a variable at VALUES ('\$select 3) The SQL command its self does not need to end with a semi-colon. Fixed string.. $sql = "INSERT INTO `guest` (`title`, `first_name`, `last_name`, `login`, `password`, `passport_number`, `e_mail`, `question`, `answer`, `industry`, `job_title`, `state`, `city`, `company`, `last_visit`) VALUES ('$select', '$f_name', '$l_name', '$login', '$password', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NOW())"; -Kevin - Original Message - From: "Pushpinder Singh Garcha" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 1:30 PM Subject: [PHP] PHP and MySQL Hello, I am using PHP to create forms and then am entering the user input into a MySQL DB In the first query I am trying to select the values that the user entered on the form THIS DOES NOT WERK gives error unable to execute query $sql = "INSERT INTO `guest` (`title`, `first_name`, `last_name`, `login`, `password`, `passport_number`, `e_mail`, `question`, `answer`, `industry`, `job_title`, `state`, `city`, `company`, `last_visit`) VALUES ('\$select\', \'$f_name\', \'$l_name\', \'$login\', \'$password\', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NOW());"; WHEN I TRY TO HARD CODE THE VALUES INTO THE MYSQL QUERY, IT WERKS FINE // $sql = 'INSERT INTO `guest` (`title`, `first_name`, `last_name`, `login`, `password`, `passport_number`, `e_mail`, `question`, `answer`, `industry`, `job_title`, `state`, `city`, `company`, `last_visit`) VALUES (\'gh\', \'ghdfghhgj\', \'hgddj\', \'ggfgfg\', \'hfgdj\', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NOW());'; Can somebody please tell me where I am going wrong..?? Many thanks Pushpinder Singh Garcha _ Web Architect T. Falcon Napier and Associates, Inc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] problems with jsp & php
I may be wrong about this becuase I don't program JSP but if the values in $_GET are strings then you may need to encase them in quotes. var action = ""; -Kevin - Original Message - From: "Jeff Bluemel" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, December 11, 2002 3:22 PM Subject: [PHP] problems with jsp & php > I cannot figure out where my problem is with the following script. I know > I've used this syntax successfuly in the past. when I take out the > variables, and just set link to something without using php then this works. > know when I click on the form that activated the button it does nothing. > > function batch_close() > { > if (parent_window && !parent_window.closed) > { > var action = ; > var batch = ; > var begin = ; > var end = ; > var amount = ; > var link = "maintain.html?action=" + action + "&batch=" + batch + > "&begin=" + begin + "&end=" + end + "&amount=" + amount; > parent_window.document.location.href=link; > parent_window.focus(); > } > window.close(); > } > > > > -- > 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] JSRS/PHP Calendar Script
I'm looking for additional tutorials/examples for building an events calendar service using JSRS (Javascript Remote Scripting) and PHP/MySQL. But ideally I'd rather use a pre-made script if one exists. I have several other projects that I need to complete and I'd rather not get side-tracked. So if someone has already developed such a script I'd be very interested. Much thanks, Kevin Stone [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] php4 / sessions
Hi, I'm trying to get a session variable to work. Here's the code at the start of my script: session_name('CLIENTFILTER'); session_start(); session_register( 'client_filter' ); As I understand it, the variable $client_filter should now be available to me? But I can't see it with either just $client_filter or even $HTTP_SESSION_VARS['client_filter']. It's definitely setting a cookie in the browser, but it doesn't seem to be picking up the variable on subsequent pages. I'm on PHP 4.0.6 with register_globals turned on. (Apache on Solaris) Any help greatly appreciated TIA, - Kev ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. This footnote also confirms that this email message has been swept by MIMEsweeper for the presence of computer viruses. www.mimesweeper.com ** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php4 / sessions
The variable must exist before you can register it in the session.. $client_filter = 'filter'; session_register('client_filter'); ..or simply.. $_SESSION['client_filter'] = 'filter'; -Kevin - Original Message - From: "Kevin Porter" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 11:15 AM Subject: [PHP] php4 / sessions > Hi, > > I'm trying to get a session variable to work. Here's the code at the start > of my script: > > session_name('CLIENTFILTER'); > session_start(); > session_register( 'client_filter' ); > > As I understand it, the variable $client_filter should now be available to > me? But I can't see it with either just $client_filter or even > $HTTP_SESSION_VARS['client_filter']. > It's definitely setting a cookie in the browser, but it doesn't seem to be > picking up the variable on subsequent pages. > > I'm on PHP 4.0.6 with register_globals turned on. (Apache on Solaris) > > > Any help greatly appreciated > > TIA, > > - Kev > > > ** > This email and any files transmitted with it are confidential and > intended solely for the use of the individual or entity to whom they > are addressed. If you have received this email in error please notify > the system manager. > This footnote also confirms that this email message has been swept by > MIMEsweeper for the presence of computer viruses. > www.mimesweeper.com > ** > > > -- > 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] FTP Listings for HTML page
Yes it is doable. see. open_dir(); @ www.php.net You can also find a number of premade scripts on HotScripts.com or one of the class stores. Do a search on Google. -Kevin - Original Message - From: "Randum Ian" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 11:38 AM Subject: [PHP] FTP Listings for HTML page > Hi guys, I am maintaining a list of files on an FTP server and it would > be great if I could get a very simple list of all the files and their > directory names so I can generate a HTML page with the information. > > Is this doable? > > Randum Ian > [EMAIL PROTECTED] > DJ / Reviewer / Webmaster, DancePortal (UK) Limited > DancePortal.co.uk - Global dance music media > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Question about "if" statement evaluating (0=="string") as TRUE
When you define $no, you define it without quotes, so PHP assumes it is a numeral. What you're asking in your conditional statement is: Does the numeral 0 equal the integer evaluation of "string". The answer is True. But when you put $no into quotes you cast it as a string. Now what you're asking is Does the string "0" equal the string "string". The answer is False. -Kevin - Original Message - From: "Scott Hurring" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 12:27 PM Subject: [PHP] Question about "if" statement evaluating (0=="string") as TRUE > Erm... this seems a bit odd to me. I'm using PHPv4.2.2 on Win32 > > Is that becuase PHP is not properly comparing the numerical value with > the string value? > > $no = 0; > if ($no == "string") { > print "this eval's to TRUE... since when is '0' == 'no' ?"; > } > if ("$no" == "string") { > print "whereas this eval's to FALSE, as you'd expect"; > } > ?> > > > > -- > Scott Hurring > Systems Programmer > EAC Corporation > scott (*) eac.com > -- > > > > -- > 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
Fw: [PHP] Difference between 2 Dates
Oh dear. In what format are you storing the date in your database? If you can convert what you have into UNIX EPOCH then you can simply subtract your date against mktime(); then echo the result through getdate() and be done with it in three lines of code. -Kevin - Original Message - From: "vernon" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 12:43 PM Subject: [PHP] Difference between 2 Dates > I found this code on the php.net web site but am new to php and can't figure > out how to dispaly the difference once calucuated. Belowis the code I'm > using: > > # --- Date Difference --- > #Date 1 from MySQL database recordset row > $date1 = $row_rsMESSAGES['privmsgs_date']; > #Date 2 - now > $date2 = date("ymd H:is"); > > #function > function date_diff($date1, $date2) { > $s = strtotime($date2)-strtotime($date1); > $d = intval($s/86400); > $s -= $d*86400; > $h = intval($s/3600); > $s -= $h*3600; > $m = intval($s/60); > $s -= $m*60; > return array("d"=>$d,"h"=>$h,"m"=>$m,"s"=>$s); > } > > #what I thought would dispaly the diffence but returns and error. > echo date_diff("$m, $d, $h, $m"); > > > Thanks > > > > -- > 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] Difference between 2 Dates
Again the solution is to convert the dates into timestamps for easy comparison. In your case you can use the strtotime() function. I believe that -mm-dd is a standard date format that the function will recognize, is it not? $ts1 = strtotime($date1); $ts2 = strtotime($date2); if ($ts1 > $ts2) { // .. blah blah blah. } -Kevin - Original Message - From: "Colin Bossen" <[EMAIL PROTECTED]> To: "vernon" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, December 13, 2002 2:50 PM Subject: Re: [PHP] Difference between 2 Dates > I have a similar problem. I am trying to figure out which of two dates > is greater. Both are in the -mm-dd format. Is there any easy > function that allows this sort of comparison or am I missing something? > > > On Friday, December 13, 2002, at 01:43 PM, vernon wrote: > > > I found this code on the php.net web site but am new to php and can't > > figure > > out how to dispaly the difference once calucuated. Belowis the code I'm > > using: > > > > # --- Date Difference --- > > #Date 1 from MySQL database recordset row > > $date1 = $row_rsMESSAGES['privmsgs_date']; > > #Date 2 - now > > $date2 = date("ymd H:is"); > > > > #function > > function date_diff($date1, $date2) { > > $s = strtotime($date2)-strtotime($date1); > > $d = intval($s/86400); > > $s -= $d*86400; > > $h = intval($s/3600); > > $s -= $h*3600; > > $m = intval($s/60); > > $s -= $m*60; > > return array("d"=>$d,"h"=>$h,"m"=>$m,"s"=>$s); > > } > > > > #what I thought would dispaly the diffence but returns and error. > > echo date_diff("$m, $d, $h, $m"); > > > > > > Thanks > > > > > > > > -- > > 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] PHP Auto-Responder
I need a solution to activate a PHP script when somebody sends an email to a specified account. I've looked into procmail and sork and find that I am in way over my head. I know my way around PHP well enough but I'm more than a little dense when it comes to Unix commands. I wouldn't even know how to install procmail, let alone use it. So is there a more "Plug n' Play" solution that I can unzip, upload to my FTP account, modify a few variables, and just have it work? Perhaps through sendmail which is already installed on the server? Surely the problem is universial enough that somebody has come up with a solution. I appreciate any help tracking it down. -Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables - Help
Difficult to tell exactly what your problem is but to disassociate a varaible name to its place in memory you use, unset($varname); -Kevin - Original Message - From: "Beauford.2002" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Tuesday, December 17, 2002 1:29 PM Subject: [PHP] Variables - Help > Hi, > > I have a webpage where users input information. This gets sent to a PHP page > to use this input. The first time the user inputs information it works > correctly, but the second, third, forth, etc. times does not. It appears the > information from the first time is still stored in the variables I am using > in PHP. I have tried setting them all back to zero, but this does not work. > > So how do I reset all the variables so that the new information is contained > in them when the user adds more information. > > TIA > > > > -- > 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 Auto-Responder
- Original Message - From: "Jason Wong" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, December 16, 2002 3:16 PM Subject: Re: [PHP] PHP Auto-Responder > On Tuesday 17 December 2002 04:16, Kevin Stone wrote: > > I need a solution to activate a PHP script when somebody sends an email to > > a specified account. I've looked into procmail and sork and find that I am > > in way over my head. I know my way around PHP well enough but I'm more > > than a little dense when it comes to Unix commands. I wouldn't even know > > how to install procmail, let alone use it. So is there a more "Plug n' > > Play" solution that I can unzip, upload to my FTP account, modify a few > > variables, and just have it work? Perhaps through sendmail which is > > already installed on the server? Surely the problem is universial enough > > that somebody has come up with a solution. I appreciate any help tracking > > it down. > > I'm not sure about the problem being universal (enough) but the solution > certainly isn't universal :-) > > Different MTAs would require different configurations and may require more > privileges than a standard webhosting account usually have. > > One solution you can consider is to have a php script polling a mail account > at regular intervals and acting on whatever mail it gets. This way, you don't > have to worry about what MTA your host is using, and does away with the need > to install extra software. Yes that was the obvious solution unfortunately my web host does not have crontab installed for users forcing me to seek other solutions. I have asked my web host if they can install crontab and hopefully they respond favorably to my request. If not then I may have a find a host just to do this one job which seems like kind of a waste considering we're talking about an infantesimal amount of bandwidth (four or five requests per hour). Anyay I appreciate your help. At least I'm a little bit more focused now. Thanks, -Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: PHP Auto-Responder
Good suggestions. Thank you very much. -Kevin - Original Message - From: "Joel Boonstra" <[EMAIL PROTECTED]> To: "Kevin Stone" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Tuesday, December 17, 2002 6:41 AM Subject: Re: PHP Auto-Responder > On Mon, 16 Dec 2002, Kevin Stone wrote: > > Yes that was the obvious solution unfortunately my web host does not have > > crontab installed for users forcing me to seek other solutions. I have > > asked my web host if they can install crontab and hopefully they respond > > favorably to my request. If not then I may have a find a host just to do > > this one job which seems like kind of a waste considering we're talking > > about an infantesimal amount of bandwidth (four or five requests per hour). > > If lack of cron is the only thing holding you back, there's probably > ways around that. > > You can make your PHP script available via the web, and then set up a > home machine to request it every hour (assuming an 'always on' > connection to the net). If you have a dialup, script your machine to > dialup and request the page whenever you need to. Windows has the Task > Scheduler, Mac (non-osx) has applescript (I think), and OSX and Linux > have, well, everything. > > Otherwise, you could try an online cron service. Like: > > http://www.cronservice.com/ > > I have no idea how reliable they are, etc..., but it's likely cheaper > than hosting with a new place. > > Joel > > -- > [ joel boonstra | [EMAIL PROTECTED] ] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] nested if in a for statement
Prepare the rubber glove... Chang this // $i <= count($userVars) To this // $i < count($userVars); Arrays start at index 0, not 1. -Kevin - Original Message - From: "James Brennan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 17, 2002 2:03 PM Subject: [PHP] nested if in a for statement > I am checking the values of a submited forms for empty fields with the code > below. My problem is that the echo statement is being executed once > regardless of whether or not the if statement is true. What am I missing? > > thanks, > loopjunkie > > snip > /* variables in array set earlier in script */ > $userVars = array($nameFirst, $nameLast, $pass, $pass2, $auth, $dob_year, > $dob_month, $dob_day); > > for ($i=0; $i <= count($userVars); $i++) { > if (empty($userVars[$i])) { > echo "please enter all required info"; > break; > } > } > --- snip > > > _ > Add photos to your messages with MSN 8. Get 2 months FREE*. > http://join.msn.com/?page=features/featuredemail > > > -- > 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] nested if in a for statement
Oops sorry didn't mean to add to the spam. LOL -Kevin - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Tuesday, December 17, 2002 2:24 PM Subject: Re: [PHP] nested if in a for statement > Prepare the rubber glove... > > Chang this // $i <= count($userVars) > To this // $i < count($userVars); > > Arrays start at index 0, not 1. > > -Kevin > > > - Original Message - > From: "James Brennan" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Tuesday, December 17, 2002 2:03 PM > Subject: [PHP] nested if in a for statement > > > > I am checking the values of a submited forms for empty fields with the > code > > below. My problem is that the echo statement is being executed once > > regardless of whether or not the if statement is true. What am I missing? > > > > thanks, > > loopjunkie > > > > snip > > /* variables in array set earlier in script */ > > $userVars = array($nameFirst, $nameLast, $pass, $pass2, $auth, $dob_year, > > $dob_month, $dob_day); > > > > for ($i=0; $i <= count($userVars); $i++) { > > if (empty($userVars[$i])) { > > echo "please enter all required info"; > > break; > > } > > } > > --- snip > > > > > > _ > > Add photos to your messages with MSN 8. Get 2 months FREE*. > > http://join.msn.com/?page=features/featuredemail > > > > > > -- > > 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
Re: [PHP] old getenv?
The only way to get at HTTP_REFERER is either through getenv(), $HTTP_SERVER_VARS, or $_SERVER. There is no other way around it. But since the methods are universial there shouldn't be any harm in just using the Find/Replace command in your editor. I found one (rather odd) reference that suggested getenv() may not return certain values if Register Globals is turned on, but I do not believe it is true. -Kevin - Original Message - From: "Bryan Koschmann - GKT" <[EMAIL PROTECTED]> To: "PHP General" <[EMAIL PROTECTED]> Sent: Wednesday, December 18, 2002 1:07 PM Subject: [PHP] old getenv? > Hello, > > I'm trying to use a formmail script (Jack's Formmail) but I'm having a > problem, because it seems to not spit out any info for > getenv("HTTP_REFERER"). Is there any way around this, other than fixing > every reference to that (there are others to get the form information as > well)? I had the same problem with another formmail. > > Any help would be great, thanks! > > Bryan > > > -- > 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] Displaying first 20 characters of a comment
Hi. I am trying to find out what the best way is to display only the first 20 or so characters of a comment. The comments which are entered separately by users are stored in a MySql database. I am displaying a list of the last 5 entries on the home page and then linking them to the relevant comments and details. However the comments are to long so I want to display only the first portion, kind of like a intro for users to get an idea and then read further. I am not sure if it is best to do it with the select statement or format it with the PHP. Either way I am not sure how. many thanks Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] directory list function?
There is no builtin function to do this in one step but it's not in anyway difficult.. http://www.php.net/manual/en/function.opendir.php -Kevin - Original Message - From: "Dade Register" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, December 27, 2002 1:34 PM Subject: [PHP] directory list function? > A question for you all. Is there a php function that > could count the number of files in a dir? Using > FreeBSD and php4.2.2 and Apache. Thanx. > -Dade > > __ > Do you Yahoo!? > Yahoo! Mail Plus - Powerful. Affordable. Sign up now. > http://mailplus.yahoo.com > > -- > 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 complied code
Actually all PHP4 code is compiled before it is executed. What the author of that book suggests is pre-compiling a script. The difference between a standard script and a pre-compiled script is the time it takes to parse the code. You might pre-compile scripts that are going to see heavy use on your server. Or you might pre-compile a very large script to avoid the inherent latency in the interpretor as an optimization step. The only encoder I know of is Zend Encoder ($2400) at www.zend.com. Here's the deal though. If you don't know that you need to pre-compile then chances are you don't have to. The benefits to the casual programmer are negligable. -Kevin - Original Message - From: "Manuel Ochoa" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, January 02, 2003 1:46 PM Subject: [PHP] PHP complied code > > I recently read a book on PHP and the author breifly said that if you compile the PHP code it would improve the performance. > > Is there a way to compile the code? > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Question
In most cases, Yes. Calling session_start() for the first time sets a cookie on the client's computer containing the session id. At the same time the function creates a matching session file on the server. You register whatever variables you want to this file so that when you call session_start() on another page it looks for the cookie, retrieves the session id, and makes the associated variables in the file available to your script. I suggest you read the manual. It's all there... http://www.php.net/manual/en/ref.session.php -Kevin - Original Message - From: <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 11:10 AM Subject: [PHP] Session Question > > Does php use cookies for sessions even if you don't explicitly use cookie > functions to save session data server side? > > TIA, > > Ed > > > > -- > 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] Variables that persist through reload?
That's just the browser's cache, nothing to do with PHP. Not all browsers will cache succesfully. If you want to guarentee that variables will be stored for later retrieval (or for repopulating a form) then you need to use sessions or store the content of the variables in a database. -Kevin - Original Message - From: "David Chamberlin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 12:58 PM Subject: [PHP] Variables that persist through reload? > Hey, > > I'm somewhat new to PHP and I'm doing a lot of forms stuff. Looking at > some of the examples at: > > http://www.linuxguruz.org/z.php?id=33 > > The variables seem to persist through a reload. For example, the first > demo has: > > > if (!isset($pick)) { > echo "Fill out and submit the form below."; } > else { > $j = count($pick); > for($i=0; $i<$j; $i++) { > echo "Pick $pick[$i] is Checked"; } > } > ?> > > > > Painting > Plumbing > Electric > > > > > > > > So the $pick variable is maitained through the submit. When I demo the > script on that site, it works as advertised. When I use the same code > on my web server, it doesn't work ($pick is never set after submitting). >Is there some configuration option that dictates whether variables > persist in this manner? > > Thanks, > Dave > > > -- > 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] Variables that persist through reload?
Woops.. sorry I missed the crux of your post. I didn't read all the way down. :) -Kevin - Original Message - From: "Kevin Stone" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]>; "David Chamberlin" <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 1:18 PM Subject: Re: [PHP] Variables that persist through reload? > That's just the browser's cache, nothing to do with PHP. Not all browsers > will cache succesfully. If you want to guarentee that variables will be > stored for later retrieval (or for repopulating a form) then you need to > use sessions or store the content of the variables in a database. > > -Kevin > > - Original Message - > From: "David Chamberlin" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Friday, January 03, 2003 12:58 PM > Subject: [PHP] Variables that persist through reload? > > > > Hey, > > > > I'm somewhat new to PHP and I'm doing a lot of forms stuff. Looking at > > some of the examples at: > > > > http://www.linuxguruz.org/z.php?id=33 > > > > The variables seem to persist through a reload. For example, the first > > demo has: > > > > > > > if (!isset($pick)) { > > echo "Fill out and submit the form below."; } > > else { > > $j = count($pick); > > for($i=0; $i<$j; $i++) { > > echo "Pick $pick[$i] is Checked"; } > > } > > ?> > > > > > > > > Painting > > Plumbing > > Electric > > > > > > > > > > > > > > > > So the $pick variable is maitained through the submit. When I demo the > > script on that site, it works as advertised. When I use the same code > > on my web server, it doesn't work ($pick is never set after submitting). > >Is there some configuration option that dictates whether variables > > persist in this manner? > > > > Thanks, > > Dave > > > > > > -- > > 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
Re: [PHP] One more form question
- Original Message - From: "David Chamberlin" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, January 03, 2003 1:27 PM Subject: [PHP] One more form question > OK, last one was answered quickly and successfully (thank you!), so > here's another one. > > Is there an easy way to set something in a select list to be selected? > Right now I'm doing a real brute-force method. e.g., > > echo ""; > $choices = array( 'pub' => 'On Public Page', >'members' => 'Only on Members Page', >'nodisp' => 'Do not Display' ); > foreach ( $choices as $key => $choice ) { > $selected = ''; > if ( strcmp( $key, $member_info->display_address ) == 0 ) { > $selected = 'selected'; > } > echo "$choice"; > } > echo ''; > > I've got to imagine there's a better way > > Thanks, > Dave Okay let me take another hack at one of your questions and maybe I won't screw up this time. ;-) PHP has no functional control over the HTML content. You could make it easier on yourself by writing a function that outputs 'selected' or null instead of coding a separate conditional for each form element, but other than that this is the only way to do it. -Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Fw: [PHP] Get your *own* IP...?!
In Apache it's $_SERVER['SERVER_ADDR'] But I don't know if this applies to IIS as well. -Kevin - Original Message - From: "Charles likes PHP" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Monday, January 06, 2003 1:45 PM Subject: [PHP] Get your *own* IP...?! > Does anyone know a way to fetch your own IP-adress? I need it because I run > a web server on my computer with a dynamic-IP so I need it to change all the > URLs it creates dynamically... > > Thanks! > > -Charles > > > > -- > 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] Warning: Unlink failed (Permission denied) in
Please could someone let me know the cause of this error message "Warning: Unlink failed (Permission denied) in ...". Regards Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How can I redirect to another php page
http://groups.google.com/groups?num=30&hl=en&lr=&ie=UTF-8&oe=UTF-8&safe=off&; q=url+redirect+php -Kevin - Original Message - From: "Teo Petralia" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Wednesday, January 08, 2003 1:46 PM Subject: [PHP] How can I redirect to another php page > Hi All! > I would like to redirect the user to another php page accordingly to > his/her chosen options, example: > if ($Color == "Yellow") { > go to page > else if ($Color == "Green") > go to page > } > > Does anyone knows how to achieve the goal?? > > Thanks > > Teo > > -- > 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