[PHP] Need unrounded precision
Hi, I need to extract the first digit after the decimal point from a number such as 28.56018, which should be '5'. I've tried a few methods to accomplish this. If I use 'ini_set' I would need to know the number of digits before the decimal (which, unfortunately, I would not have access to). Then I've tried: ?php $elapsed = 28.56018; $digit = round($elapsed, 1); // rounds result is '6' $digit = number_format($elapsed, 1); // still rounds result to '6' ? What I need is only the first digit after the decimal -- all the rest could be 'chopped' or discarded but without rounding the first digit after the decimal point. Is there any way of doing this? I'm stumped. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need unrounded precision [RESOLVED]
Thanks Eddie, Actually while waiting for some re[lies, I resolved the problem. I realized that '$elapsed' will always have only two digits before the decimal point. Thus I was able to use 'number_format($elapsed, 2);' and to give me the desired result. Thanks for the quick reply! Andre On October 11, 2009 08:50:11 pm Eddie Drapkin wrote: On Fri, Jan 1, 2010 at 9:20 PM, Andre Dubuc aajdu...@webhart.net wrote: Hi, I need to extract the first digit after the decimal point from a number such as 28.56018, which should be '5'. I've tried a few methods to accomplish this. If I use 'ini_set' I would need to know the number of digits before the decimal (which, unfortunately, I would not have access to). Then I've tried: ?php $elapsed = 28.56018; $digit = round($elapsed, 1); // rounds result is '6' $digit = number_format($elapsed, 1); // still rounds result to '6' ? What I need is only the first digit after the decimal -- all the rest could be 'chopped' or discarded but without rounding the first digit after the decimal point. Is there any way of doing this? I'm stumped. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Try sprintf with a format of %0.1f. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Need unrounded precision
Yup! I had noticed that I had forgot to reset to today's date after working on the code, just after I sent the messages. Thanks. Andre On October 11, 2009 09:14:56 pm Jim Lucas wrote: Andre Dubuc wrote: Hi, I need to extract the first digit after the decimal point from a number such as 28.56018, which should be '5'. I've tried a few methods to accomplish this. If I use 'ini_set' I would need to know the number of digits before the decimal (which, unfortunately, I would not have access to). Then I've tried: ?php $elapsed = 28.56018; $digit = round($elapsed, 1); // rounds result is '6' $digit = number_format($elapsed, 1); // still rounds result to '6' ? What I need is only the first digit after the decimal -- all the rest could be 'chopped' or discarded but without rounding the first digit after the decimal point. Is there any way of doing this? I'm stumped. Tia, Andre FYI: did you know that your computer thinks it is in the future? You need to check your date settings... -- Jim Lucas Some men are born to greatness, some achieve greatness, and some have greatness thrust upon them. Twelfth Night, Act II, Scene V by William Shakespeare -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fatal error on functions valid for PHP 4, 5
Hi Jonathon, I'm using Mandriva 2008.0 x86_64 version (which probably didn't have that enabled).. Thanks -- will check. Be fun trying to enable it though, given Mandriva's propensity to stick stuff in weird places. Sigh . . . Andre On October 9, 2009 09:20:29 am Jonathan Tapicer wrote: What platform? If you compiled PHP yourself you need to compile with --enable-calendar. Jonathan On Fri, Oct 9, 2009 at 10:01 AM, kro...@aolohr.com wrote: Hi, Would someone be kind enough to test whether these following functions work? I'm getting: PHP Fatal error: Call to undefined function easter_date() . . . easter_days on both local and production sites. ?php echo easter_days(2009); print brbr; echo date(M-d-Y, easter_date(2009)); print brbr; echo date(D d M Y, easter_date(2009)); ? I'm using 5.2.10 production; PHP 5.2.4 local. 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] Rogue 'if - elseif' code
Hi, I'm having problems with a chunk of 'rogue' code that does not perform as expected (it does not pass the expected date, but an empty value). Most of the time, it works - so I'm wondering whether it might be a browser issue. (The latest failure occurred with Firfeox 3.0 browser on an NT 5.1 OS.) The code is stored on an Unix server, running PHP 5.x. I've isolated it down to multiple if - elseif statements that check long dates for completeness, day month and year. The code then applies it results printing one of following: the full date - 22 May 2009, month-year - May 2009, or just the year, 2009. My question is whether the ORDER of checking is important, i.e, whether checking for the null sets BEFORE full sets or AFTER. I've added debugging code to be able to get the raw POST values so I can manually enter it into the db, but I would really appreciate some help here. The code is old -- I wrote it seven years ago, and had worked well until I modified it, but I no longer have the original working code. [The first conditional line of the code checks whether the user has entered the birth date, then it checks for the death date. The $_SESSION stuff is debugging code.] ?php $yd = $_POST['death']; $yb = $_POST['birth']; if ($_POST['bday'] == Day $_POST['bmonth'] == Month $_POST['birth'] == Year) { if ($_POST['dday'] != Day $_POST['dmonth'] != Month $_POST['death'] != Year) { $_POST['rdod'] = ({$_POST['dday']} {$_POST['dmonth']} {$_POST['death']}); $_SESSION['ALL1rdod'] = $_POST['rdod']; } elseif ($_POST['dday'] == Day $_POST['dmonth'] == Month $_POST['death'] != Year) { $_POST['rdod'] = $_POST['death']; $_SESSION['YEAR1rdod'] = $_POST['rdod']; } elseif ($_POST['dday'] == Day $_POST['dmonth'] != Month $_POST['death'] != Year) { $_POST['rdod'] = ({$_POST['dmonth']} {$_POST['death']}); $_SESSION['MONTHYEAR1rdod'] = $_POST['rdod']; } $_SESSION['Sdebugdod1'] = {$_POST['dday']} {$_POST['dmonth']} {$_POST['death']}; } else { if ($yd $yb) { if ($_POST['bday'] != Day $_POST['bmonth'] != Month $_POST['birth'] != Year) { $_POST['rdob'] = ({$_POST['bday']} {$_POST['bmonth']} {$_POST['birth']}); } elseif ($_POST['bday'] == Day $_POST['bmonth'] == Month $_POST['birth'] != Year) { $_POST['rdob'] = $_POST['birth']; } elseif ($_POST['bday'] == Day $_POST['bmonth'] != Month $_POST['birth'] != Year) { $_POST['rdob'] = ({$_POST['bmonth']} {$_POST['birth']}); } if ($_POST['dday'] != Day $_POST['dmonth'] != Month $_POST['death'] != Year) { $_POST['rdod'] = ({$_POST['dday']} {$_POST['dmonth']} {$_POST['death']}); $_SESSION['ALL2rdod'] = $_POST['rdod']; } elseif ($_POST['dday'] == Day $_POST['dmonth'] == Month $_POST['death'] != Year) { $_POST['rdod'] = $_POST['death']; $_SESSION['YEAR2rdod'] = $_POST['rdod']; } elseif ($_POST['dday'] == Day $_POST['dmonth'] != Month $_POST['death'] != Year) { $_POST['rdod'] = ({$_POST['dmonth']} {$_POST['death']}); $_SESSION['MONTHYEAR2rdod'] = $_POST['rdod']; } $_SESSION['Sdebugdod2'] = {$_POST['dday']} {$_POST['dmonth']} {$_POST['death']};
Re: [PHP] Re: Need tool to graphically show all includes/requires
On Saturday 20 January 2007 07:35 am, Colin Guthrie wrote: Daevid Vincent wrote: We have a fairly complex product that is all PHP based GUI. We're in need of some kind of graphical tool (web, stand alone, windows, linux, osx whatever) that will take a directory tree, recursively traverse all the files, look for 'includes' and 'requires' (and the _once versions too) and then map them out so we can see what files are calling what and where. Anyone suggest something? My colleague wrote a script that used dot to generate such a pattern but this is more or less useless for us now that we use the autoloading features of PHP5... If I can fid the script I'll post it, but not sure where it went. Also if you use variables in the include/require, then it will fail most horribly. Col. Just a thought following on Colin's idea. YIf you can't find anything to do the job, you should be able to modify 'staviz' that uses dot to graphically show log files - clickthroughs to various pages. The code should at least give you the structure you could fool around with. Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP Warning: session_destroy
Hi, To stop bots from accessing secured pages, I've added the following code to a banner page that is called by every page. Furthermore, each page starts with ?php session_start(); ? and includes the banner page: 'top1.php' [banner page] ?php if((eregi(((Yahoo! Slurp|Yahoo! Slurp China|.NET CLR|Googlebot/2.1| Gigabot/2.0|Accoona-AI-Agent)),$_SERVER['HTTP_USER_AGENT']))) { if ($_SERVER['HTTPS'] == on) { session_destroy(); header(Location: http://localhost/logout.php;); } } ? I'm testing on localhost with the browser set to 'Googlebot/2.1' - and the code works great. Any page that is set for https is not served, and if https has been set by a previous visit, it goes to http://somepage. However, checking the live version, I get an secure-error_log entry: PHP Warning: session_destroy() [a href='function.session-destroy'function.session-destroy/a]: Trying to destroy uninitialized session Question is: didn't the session_start(); on the calling page take effect, or is this some other problem? Is there something like 'isset' to check whether 'session_destroy(); is needed? [I've tried isset, it barfs the code.] Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Warning: session_destroy
On Saturday 20 January 2007 05:33 pm, Paul Novitski wrote: At 1/20/2007 02:14 PM, Andre Dubuc wrote: However, checking the live version, I get an secure-error_log entry: PHP Warning: session_destroy() [a href='function.session-destroy'function.session-destroy/a]: Trying to destroy uninitialized session Question is: didn't the session_start(); on the calling page take effect, or is this some other problem? I've gotten the distinct impression from the documentation and from my own experiences that session_start() is required at the beginning of every page/script that references the session. See http://ca3.php.net/session_start including Examples 1 and 2. Paul That would tend to make sense despite that the calling page has arleady initiated one. Worth a try . . Thanks, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] problems with sessions variables and virtual domains in apache
On Thursday 18 January 2007 06:26 pm, esteban wrote: I have a windows 2000 server with apache 2.0 and php 5.1.2. I use session variables to validate users, each page have something like this: if($_SESSION[validated]==0){ header(Location: index.php); exit; } This worked fine when i had only one domain, but when i began to use virtual domains, sometimes, not always, the session variable lost the value or the session variable is distroyed, i don't know what really happens. I add this lines to httpd.conf for each domain and the main domain is first: VirtualHost *:80 ServerAdmin [EMAIL PROTECTED] DocumentRoot C:/Program Files/Apache Group/Apache2/htdocs/domain ServerName www.domain.com ErrorLog logs/domain.com-error_log CustomLog logs/domain.com-access_log common php_admin_value upload_tmp_dir C:/Program Files/Apache Group/Apache2/htdocs/domain/tmp php_admin_value session.save_path C:/Program Files/Apache Group/Apache2/htdocs/domain/session /VirtualHost At the beginning i didn't use the two last lines with php_admin_value, i add the lines for trying to solve the problem but it doesn't work. I have an application made with phpmaker and SquierreMail v.1.4.7 too, and i have the same problem in both. In both case sometimes, when i want to go to other page, the server ask me for the username and the password, it is not always. Please help me Thanks. Following Chris' idea - going from http to https - try this simple technique - works for me: ?php session_start(); ob_start(); ? ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://your_domain/the_page_you_want_at_https;); exit;} ? Saves you having to explicitly set the page for https Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Getting domain out of a URL
Hi, I receive posts from an open moderated forum that need to be filtered for urls. I've successfully managed to trap any entires that use 'http://' 'www.' with the standard '.com' '.org', '.net' endings. What I need to do is to strip the prefix part ('http:// or http://www. or 'www') and suffix as well (the .com, etc.) I need only the domain name. I can't seem to trim away the suffix part. The code I've tried: $_POST['request'] = . . The third has it all www.borko.worko.com and meanders on. Then it stops.; $check = $_POST['request']; if (preg_match(@^(?:www.)?([^/]+)@i, $check, $match)) { $host = $match[1]; (print brdiv class='center' h4brbrbrURLs are not permitted brbr Click 'Back' on your browser and delete all URL references. /h4brbrbr/div); /* EXTRA 1: Added to see what's happening */ print h4 style='color:green;'$match[1]/h4brbr; /* END EXTRA 1 */ $boom = explode(www., $host); foreach($boom as $key = $host){ $boom[$key] = $host; } $booms = implode(www., $boom); $out = (preg_match('[.com]', $boom[1], $match)); /* EXTRA 2: Added to see what's happening */ echo b style='color:blue;'The BOOM1 SPLIT Domain Name is:/b {$boom[1]}brbrbr; echo b style='color:green;'The OUT SPLIT Domain Name is:/b {$out}brbrbr; /* EXTRA 2 */ What ouputs: Extra 1: . . The third has it all www.borko.worko.com and meanders on. Then it stops. Extra 2 BOOM1 SPLIT: borko.worko.com and meanders on. Then it stops. Extra 2 OUT SPLIT: nothing There's gotta be a better, simpler way of doing this. I want to check for the string in the POST. If it's there, tag it, and be able to save it, and re-enter just the domain back into future checks based on the IP address as well. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting domain out of a URL
On Wednesday 17 January 2007 03:35 pm, Jay Blanchard wrote: [snip] I receive posts from an open moderated forum that need to be filtered for urls. I've successfully managed to trap any entires that use 'http://' 'www.' with the standard '.com' '.org', '.net' endings. What I need to do is to strip the prefix part ('http:// or http://www. or 'www') and suffix as well (the .com, etc.) I need only the domain name. I can't seem to trim away the suffix part. [/snip] Have you looked at http://us3.php.net/manual/en/function.parse-url.php Thanks Jay for the function reference, but it doesn't seem like it's what I'm after since the url is packed into the text. What i really need is something that will take the first part of an array cutting the remainder after a delimiter word '.com'. Something along the lines of: ?php $boom[1] = ranchy.stuff.com and other junk; $input = $boom[1]; $out = array_slice($input, 0, 1); ? Part of my problem, I'm beginning to realize, is that the array '$boom[1]' contains only one element. Is there a similar string function I could use that would accomplish what I need? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Getting domain out of a URL {SOLVED]
On Wednesday 17 January 2007 06:16 pm, Jay Blanchard wrote: [snip] Why not use explode with the period (.) as the delimiter? $url = ranchy.stuff.com and other junk; $boom = explode(., $url); print_r($boom); $boom is now an array containing 'ranchy', 'stuff', 'com and other junk' Sigh. I have used that code just above the area I have been working on . . . it's been a long day. Thanks - it does the job very well! Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'Require' and 'Select' lists
On Saturday 14 May 2005 02:14 am, you wrote: On Fri, May 13, 2005 5:59 am, Andre Dubuc said: However, the behavior continues intermittently. I've duplicated it one time. If I click on the 'State' dropdown list, allow the mouse to scan through it, but do not choose a value, and then immediately go to the previous or next field and click on it, the box where 'USA or Canada' appears will be blank (despite 'option selected value=In USA or CanadaIn USA or Canada/option'). For the life of me, I cannot figure why it's doing that. This is a browser/OS bug. It's possible that it's even time-dependent -- That if you click in the popup list before it's fully formed, then you can make this happen, but after it gets completely built, you can't duplicate this. At any rate, there is nothing you can do about it. Well, okay, you can complain to the browser-makers, and be ignored by them... I guess one thing that *MIGHT* help would be to ob_start() before you send out all the option tags, and then ob_flush()/flush() after the /select closing tag. The purpose being that you want the browser to build the whole menu with as few interruptions as possible, so it will not get used while it is half-built. I would not RELY on this actually fixing the problem for sure 100% every time you betcha, but it could reduce the incidence. As a hack, I've included a new routine checking for blank or null value for $selstate that snags problems before they hit the database. However, I'd rather know why this is happening. Browsers and the data coming from them are flaky, if not downright hostile. That's just how life is. It's not a problem to solve. It's a state of being to accept and plan for. :-) Maybe it's time to just re-write the script the right way, the way you would do it today... :-) You probably have already spent more time trying to figure this out than it would have taken to just re-code it with your better experience. Thanks Richard, Ain't life beautiful? I live for these debugging moments with *challenged* browsers! So, I'll stick with the hack. I've thrown the whole mess back at the browser and will let the user correct the *problem*. Re-write the code? Yup, sometime in the near future - around July 2020 - I believe I have a few days available : Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'Require' and 'Select' lists
On Friday 13 May 2005 02:20 am, Richard Lynch wrote: On Thu, May 12, 2005 8:41 pm, Andre Dubuc said: I've had some rather odd intermittent behavior with a select list drawn by a 'require' on my production site. Sometimes, rather than displaying 'In USA/Canada' from the 'option selectedIn USA/Canada/option' code in the required file, it will display a blank. Yet, if I try to duplicate this behavior on the development box, it will display as coded. Since I use this text string as a validator for user input, it really messes up the database/code functions that rely on it. In that case, your validation routines aren't very good. You have to assume the data coming from the browser is completely messed up in malicious ways. If not providing that item in the menu will break your script or hash your data, then that's really a bigger problem than the one you think you have. ?php require(provcountry.sty); ? [snippet of 'require' text (provcountry.sty)] tr tdbState nbsp;/b/td tdSELECT NAME=selstate option selectedIn USA/Canada/option I'd try using an html entity on the '/' in USA/Canada option value=AlabamaAlabama/option . . . /SELECT/td /tr [snippet of some validating code verifying $selstate that relies on $selstate] ?php if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != )) die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other State'. brDo not use bothbrbrClick 'Back' on your browser to re-enter information/h5); ? Any ideas why this is happening? It's quite possible that some sort of php.ini setting with Magic Quotes or something is altering the '/' character as well. What *IS* in $_POST['selstate'] when it breaks? Log it and see what the data is.` Thanks for the info, Richard. The errant behavior is intermittent and hard to replicate, but it has forced me to recode this part completly. [This code was my first attempt at PHP two years ago, and it's a bad mix of html/php - I certainly wouldn't do it that way again.] I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating the possibility of the slash causing problems. However, the behavior continues intermittently. I've duplicated it one time. If I click on the 'State' dropdown list, allow the mouse to scan through it, but do not choose a value, and then immediately go to the previous or next field and click on it, the box where 'USA or Canada' appears will be blank (despite 'option selected value=In USA or CanadaIn USA or Canada/option'). For the life of me, I cannot figure why it's doing that. As a hack, I've included a new routine checking for blank or null value for $selstate that snags problems before they hit the database. However, I'd rather know why this is happening. Logging it - $_POST['selstate'] is blank (after it messes up as above) -- no surprise, since that is what the browser displays. Any other ideas? Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 'Require' and 'Select' lists
That might be it ( a browser issue) since the behavior seems to occur most in Opera. I shudder to think what IE must be doing with it. And blush . . . I didn't have that declaration on the required page (since the page only contains that code snippet and I thought it unnecessary - guess I was wrong). I'll give it whirl, and take it out for a test-drive. Thanks, Andre On Friday 13 May 2005 10:51 am, you wrote: Sounds like it might be a browser behavior issue. I've seen some really weird behavior in browsers when a DOCTYPE is not declared at the start of the web page. The doctype declaration and the version declared in it are actually very important to the rendering and behavior of a web page. Over the years, browser behavior has changed and will render code and perform actions differently. The doctype declaration allows specify which version behavior you are targeting. So, is the first line of your web page something like: !DOCTYPE HTML PUBLIC -//W3C//DTD HTML 4.01 Transitional//EN http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd; On May 13, 2005, at 8:59 AM, Andre Dubuc wrote: Thanks for the info, Richard. The errant behavior is intermittent and hard to replicate, but it has forced me to recode this part completly. [This code was my first attempt at PHP two years ago, and it's a bad mix of html/php - I certainly wouldn't do it that way again.] I've replaced the 'In USA/Canada' with 'In USA or Canada' eliminating the possibility of the slash causing problems. However, the behavior continues intermittently. I've duplicated it one time. If I click on the 'State' dropdown list, allow the mouse to scan through it, but do not choose a value, and then immediately go to the previous or next field and click on it, the box where 'USA or Canada' appears will be blank (despite 'option selected value=In USA or CanadaIn USA or Canada/option'). For the life of me, I cannot figure why it's doing that. As a hack, I've included a new routine checking for blank or null value for $selstate that snags problems before they hit the database. However, I'd rather know why this is happening. Logging it - $_POST['selstate'] is blank (after it messes up as above) -- no surprise, since that is what the browser displays. Any other ideas? Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 'Require' and 'Select' lists
Hi, I've had some rather odd intermittent behavior with a select list drawn by a 'require' on my production site. Sometimes, rather than displaying 'In USA/Canada' from the 'option selectedIn USA/Canada/option' code in the required file, it will display a blank. Yet, if I try to duplicate this behavior on the development box, it will display as coded. Since I use this text string as a validator for user input, it really messes up the database/code functions that rely on it. ?php require(provcountry.sty); ? [snippet of 'require' text (provcountry.sty)] tr tdbState nbsp;/b/td tdSELECT NAME=selstate option selectedIn USA/Canada/option option value=AlabamaAlabama/option . . . /SELECT/td /tr [snippet of some validating code verifying $selstate that relies on $selstate] ?php if (($_POST['selstate'] != In USA/Canada)($_POST['typstate'] != )) die (h5brbrPlease choose from 'In USA/Canada' or type in 'Other State'. brDo not use bothbrbrClick 'Back' on your browser to re-enter information/h5); ? Any ideas why this is happening? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie Help
On Sunday 01 May 2005 10:39 pm, Thomas Bonham wrote: Hello All, First of I'm new to this a hop I'm doing this right. If some one can help me with my web site page. I'm trying to make it call a page and I get a error line 42. Error: http://bonhamlinux.org/idex.php?page=links/index.php The code that I'm trying to do this is the following: ?php if(isset($_GET ['page'])) {include($_GET ['page']..php);} else {echo(Page Not Set.);} ? My site is: http://bonhamlinux.org My email is: [EMAIL PROTECTED] Thanks for all the help. Thomas I spot perhaps a typo in http://bonhamlinux.org/idex.php?page=links/index.php Might that be 'index' instead? Hth, Andre ^^ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On Thursday 28 April 2005 02:05 pm, John Nichel wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] Just out of curiosity, are there any templating engines out there that would automatically generate and then fill in values for a TODO list? IATOL, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Templating engines
On Thursday 28 April 2005 03:21 pm, Ryan A wrote: On 4/28/2005 8:18:28 PM, Andre Dubuc ([EMAIL PROTECTED]) wrote: On Thursday 28 April 2005 02:05 pm, John Nichel wrote: Jason Barnett wrote: snip Humor is on my TODO list. Making a TODO list is on my TODO list. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] Just out of curiosity, are there any templating engines out there that would automatically generate and then fill in values for a TODO list? Nope, but I am planning to make oneits on my TODO list. IATOL, Whats IATOL? Cheers, Ryan Aha! A bite! 'IATOL' = 'Ignorance At The Outer Limits' (derivative of my usual tagline: Ignorance is a way of life) Hth, : Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Access Denied-phpMyAdmin
On Saturday 16 April 2005 07:18 am, Mark Sargent wrote: Marek Kilimajer wrote: Mark Sargent wrote: Hi All, I can access the database from the terminal on Fedora 3, [EMAIL PROTECTED] bin]# ./mysql -h localhost -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 to server version: 4.1.10a-standard Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql But, get the following error when accessing via phpMyAdmin with user as root and the correct password, phpMyAdmin tried to connect to the MySQL server, and the server rejected the connection. You should check the host, username and password in config.inc.php and make sure that they correspond to the information given by the administrator of the MySQL server. |#1045 - Access denied for user 'root'@'localhost' (using password: YES) I don't understand this. What have I missed..? $cfg['PmaAbsoluteUri'] = 'http://localhost/phpMyAdmin-2.6.1-pl3/'; $cfg['Servers'][$i]['user'] = 'root'; // MySQL user $cfg['Servers'][$i]['password'] = 'password is correct'; // MySQL password (only needed Change $cfg['Servers'][$i]['connect_type'], I guess it should be 'socket' in your setup Hi All, thanx, but, no difference. What I don't un, is, the setup is the same as another FC3 box, and it works. Cheers. Mark Sargent. Mark, I had the same problem. Try: $cfg['PmaAbsoluteUri'] = ''; /** * Disable the default warning about $cfg['PmaAbsoluteUri'] not being set * You should use this if and ONLY if the PmaAbsoluteUri auto-detection * works perfectly. */ $cfg['PmaAbsoluteUri_DisableWarning'] = FALSE; .. $cfg['Servers'][$i]['host'] = 'localhost'; // MySQL hostname or IP address Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plug-in forum
On Tuesday 05 April 2005 06:50 pm, Chris W. Parker wrote: Ryan A mailto:[EMAIL PROTECTED] on Tuesday, April 05, 2005 3:07 PM said: a client wants me to add a forum to his existing site...which is not a problem, the problem is he wants it to work off his existing site eg: once someone logs in to the main site they dont have to relogin or create new accounts in the forum section a one login gets you total site access kind of deal. I don't personally know of something that meets all these requirements, and you might be hard pressed to find one (applications aren't generally built with accomodating an unknown authentication system in mind). One thing you could do is, when a new account is created on the main site execute a script to add the same username/password to the forum's db. Then within the forum software change it so that the authentication page looks to session data for it's authentication info (i.e. username/password) instead of from a form. In this way the user will be seamlessly authenticated to the forum. This means of course that you'll have to store the password of the user in the session data which may or may not be a good idea. The second thing is, as clients go, these ar'nt too bright :-) a rea simple forum/forum admin is needed, I was looking at phpbb but after running a test install on my system i think it would be a little too complicated for them plus it has to sit into the existing design... recommendations please. I don't know about this one. Maybe you could cull the admin section to include only the necessary option and hide everything else from the admin as to not overwhelm their puny brain. HTH, Chris. Might want to look at: http://fudforum.org hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] plug-in forum
On Tuesday 05 April 2005 07:16 pm, Chris W. Parker wrote: Andre Dubuc mailto:[EMAIL PROTECTED] on Tuesday, April 05, 2005 4:04 PM said: Might want to look at: http://fudforum.org hth, Andre Andre, Who are you responding to? Myself or to the op? Chris. sigh - I guess both since I screwed it up again. Enjoy : -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Simple CMS program
On Wednesday 30 March 2005 08:19 pm, Josip Dzolonga wrote: Todd Cary wrote: When I went to a site that lists and compares CMS programs, I was overwhelmed by at least 100 listings. Again, I would like to rely on personal experience. What I am seeking is a CMS that will provide users at my client (a Yacht Club) to update news items, and if possible, update a calendar using a Web based editor. Not a full fledged portal CMS. Also, it would be nice if it was written in PHP and use MySQL for the server DB. Has anyone had experience with such a CMS? Todd Try: http://www.mamboserver.com easy to install, update, etc. Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] parse error, unexpected T_ENCAPSED_AND_WHITESPACE
On Monday 14 March 2005 06:22 pm, Chris W. Parker wrote: Chris W. Parker on Monday, March 14, 2005 3:15 PM said: Line 82 is: print 'tdinput type=\'checkbox\' name=\'status[' . ^^ should be a slash?? $row[profileID] . ']' . ' value='true'//td\n; Very likely the problem is not on line 82, but rather before it. Line 82 is just where the PHP parser finally gets screwed up. Ohh .. and if i read it more fully the first time I would have seen that you've got some funky in/out quoting problems and that you're not escaping the quotes wrapping 'true'. :) Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] 'Insulate' db connection
Hi, I am trying to 'insulate' my database connection from prying eyes by moving the db connection code to a directory above docroot and then calling it by an include. However, my IP has an open_basedir restriction in effect that defeats what I'm trying to do. Perhaps I'm unclear what what the open_basedir does, and perhaps IP is protecting me from an even worse security risk. However, I can call, using fopen, many counter code pages that reside in the directory above docroot - so I'm confused here. Perhaps it's the use of include - is there another way to do this? *** The code so far: On any page that needs a db connection (in docroot path): ?php include(db-conn.php); ... ? Db code page (located in directory above docroot): ?php $db = pg_connect(dbname=site user=confused password=toughone); ? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: [suspicious - maybe spam] [PHP] [suspicious - maybe spam] Re: [PHP] 'Insulate' db connection
On Sunday 06 March 2005 11:47 am, Mattias Thorslund wrote: Since you can use fopen, I don't think open_basedir is the problem. Read about open_basedir here: http://us3.php.net/features.safe-mode Maybe the path that you use in the include is wrong? /Mattias Andre Dubuc wrote: Hi, I am trying to 'insulate' my database connection from prying eyes by moving the db connection code to a directory above docroot and then calling it by an include. However, my IP has an open_basedir restriction in effect that defeats what I'm trying to do. Perhaps I'm unclear what what the open_basedir does, and perhaps IP is protecting me from an even worse security risk. However, I can call, using fopen, many counter code pages that reside in the directory above docroot - so I'm confused here. Perhaps it's the use of include - is there another way to do this? ** * The code so far: On any page that needs a db connection (in docroot path): ?php include(db-conn.php); ... ? Db code page (located in directory above docroot): ?php $db = pg_connect(dbname=site user=confused password=toughone); ? Tia, Andre -- More views at http://www.thorslund.us Thanks Mattias, I should have read my code a bit better -- forgot to set the absolute path for the directory above docroot. Works great now! Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] function to resize images
On Monday 28 February 2005 10:34 am, Bosky, Dave wrote: Does anyone have a nice function that will resize an uploaded image to specific width/height dimensions? I wanted to find something that would work for only GIF and JPG image types. I've converted my shopping cart application from Cold Fusion to PHP and need to create thumbnails and reduce the size of large uploaded images. I've already done a google search and found an example but can't get it to work for some reason and it includes a bunch of other stuff that's not needed and too much trouble to remove. Thanks, Dave This one works for me: currently I have a max of 600kb on upload which is reduced to 10% (60kb). Assumes you have a 'pix' directory where you load jpegs etc: if ($_FILES[pix][type] == image/jpeg) { $pix_file = $_FILES[pix][name]; $pix_temp_file = $_FILES[pix][tmp_name]; /* Rename file with id and 'U' for upload */ $new_pix_file = U{$_SESSION['rid']}-{$_SESSION['sid']}.jpg; if(is_uploaded_file($pix_temp_file)){ move_uploaded_file($pix_temp_file, /your_site/web/pix/{$_SESSION['rid']}-{$_SESSION['sid']}.jpg); } $original = /your_site/pix/{$_SESSION['rid']}-{$_SESSION['sid']}.jpg; /* Resize the uploaded picture */ $dest_h = 190; $dest_w = 117; // create the blank limited-palette image $base_image = imageCreate($dest_w, $dest_h); move_uploaded_file($base_image, /your_site/pix/convert.jpg); // convert and save it to temp.jpg imagejpeg($base_image, '/your_site/pix/convert.jpg'); // get the image pointer to the temp jpeg $image = imageCreateFromJpeg('/your_site/pix/convert.jpg'); // get the image pointer to the original image $imageToResize = imageCreateFromJpeg(/your_site/pix/{$_SESSION['rid']}-{$_SESSION['sid']}.jpg); $src_w = imagesx($imageToResize); // Current Image Width $src_h = imagesy($imageToResize); // Current Image Height // resize the original image over temp.jpg // since you have GD2, you could also use imageCopyResampled imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h); // values for output jpeg quality $jpegQuality = 75; // create the resized image imageJpeg($image, /your_site/pix/{$_SESSION['rid']}-{$_SESSION['sid']}.jpg, $jpegQuality); // cleanup temp files } } Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Word file to PDF
On Friday 25 February 2005 03:08 pm, Rory Browne wrote: Run PHP on a windows platform that has MSWord and the PDF printing libraries installed. Use PHP's COM support to load an MSWord object and see if you can get it to load the word document and print it out as a PDF file. Once it is printed to the file, you can use PHP to read the file and do whatever is needed from here. That's pretty much one of my suggestions, although I considered it only a suitable/practical solution if s/he was running a windows box anyway. I wouldn't take on the pain, and cost of switching to a windows box, solely for the sake of converting word docs. I've never tried it with PHP, but with experimentation and research you should be able to make it work. I know that where I work we convert MS Word, Excel, and other kinds of documents to PDFs automatically using this method, though I think the appliaction than controls everything is written in C. I'd like to see the code that you use for that. The COM Methods would be independent of the language used. Would you be allowed to share it with us? Parsing and MSWord file manually with images et al, then reliably converting it to a PDF document... Yikes, if anyone can do this, you're my god. Check out my initial response to this post. wvWare can reliably convert a word doc with images. It falls down a bit, when it comes to embedded charts, or something like that or so I've heard. It seems like the staroffice/openoffice, and wvware devs, (and anyone else who has created a word doc importer) have become your god(s). Best of luck, let us know what solution you come up with. -KBear Original Message: Hi there, How can I convert a Word file (*.doc) to PDF file? Are there any libraries available? Can you give me some hint how can I do that? Thanks. Kevin. Hi, Coming late into this thread but you could try http://doc2pdf.sourceforge.net/ and see if it might fit your needs. Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: SV: [PHP] Difficulty with SQL LIKE clause
On Friday 25 February 2005 04:28 pm, Wiberg wrote: Hi there! A little off-topic but what the heck (it's a more MySQL - related question) Is 197* a numbertype field? Try maybe $query= SELECT * FROM my_table WHERE Year LIKE '197*'; /G @varupiraten.se -Ursprungligt meddelande- Från: David Freedman [mailto:[EMAIL PROTECTED] Skickat: den 25 februari 2005 21:28 Till: php-general@lists.php.net Ämne: [PHP] Difficulty with SQL LIKE clause When I use this query in PHP it works, and I get all things with the YEAR of 1977, as I expected. $query= SELECT * FROM my_table WHERE Year LIKE 1977 ; But, when I use this query it does not work. $query= SELECT * FROM my_table WHERE Year LIKE 197* ; I thought I should get the result of ALL things with the years in the 1970's (1970-1979). But the asterisk in the LIKE clause does not seem to work. I have tried various syntax's to try to get the 197* recognized but without any luck. Can the '*' be used? What am I doing wrong. David F. Try: $query= SELECT * FROM my_table WHERE year ~* '^(197).*'; Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cookies
On Thursday 24 February 2005 06:34 am, Burhan Khalid wrote: William Stokes wrote: Hello, If I send a session cookie to browser where it is stored in WinXP? Or is it stored as a separate file at all. I know that the script sends the cookie but I can't find it in the client computer harddrive. I am testing with Opera, IE6 and Firefox. In Firefox : Tools -- Options Click on Privacy on the left Click on the + sign next to Cookies to expand that section Click on View Cookies In IE : Tools -- Internet Options (or double click on Internet Option in the Control Panel) Click on Settings... (in the Temporary Internet Files group) It will tell you on the next popup dialog where your files are stored. Generally its SystemDrive:\Documents and Settings\User Name\Local Settings\Temporary Internet Files\ I don't use Opera, so can't help you there. In Opera (7.54 final): Tools Preferences Network : Privacy Manage Cookies -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [NEWBIE] Confused about usage of $_SERVER['DOCUMENT_ROOT']
On Sunday 20 February 2005 12:15 pm, Dave wrote: PHP General, The Situation: I would like to be able to specify locations of scripts and files relative to the root directory from which my web site is served. I thought this was what $_SERVER['DOCUMENT_ROOT'] was for. The Problem: When I use $_SERVER['DOCUMENT_ROOT'], it creates a path starting from somewhere deep down in the server's file structure, below where I even have authorized access. So if I specify a file like so: $imageFile = $_SERVER['DOCUMENT_ROOT'] . /images/image.jpg; ... PHP gets lost and doesn't locate it. What I am looking for is a variable which will specify the base directory that my web site is rooted in. In other words, starting from the same directory that my index.html file is in. The Question: How do I specify the directory that my web site is situated in, the same directory where my main index.html file is? Is there a different variable I should be using, or perhaps some configuration of $_SERVER['DOCUMENT_ROOT'] that needs to be applied? What I've Tried So Far: First I went to the on line PHP manual, which is where I found out about $_SERVER['DOCUMENT_ROOT'] in the first place. Of all the server variables available, 'DOCUMENT_ROOT' seems to describe what I'm looking for, but doesn't behave how I would expect. A Google search was equally ineffective in educating me in what basic concept I am missing. Any advice would be much appreciated. -- Dave Gutteridge [EMAIL PROTECTED] Hi Dave, Perhaps what you should do to set $imageFile = /images/image.jpg since I would assume, whatever your Document_Root is, 'images' is a sub-directory to it. I.e.: if your servable document directory is something like /vhome/tokyocomedy/all_your_files_are_here then /vhome/tokyocomedy/all_your_files_are_here/images/image.jpg is where your image.jpg file is. Also, check using ?php phpinfo(); ? where the $_SERVER['DOCUMENT_ROOT'] is (under 'PHP Variables' section) and note where tempfiles are uploaded to as well, if you're uploading. HTh, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [NEWBIE] Cant get $_POST to work
On Sunday 20 February 2005 05:07 pm, b1nary Developement Team wrote: Well this form *is* sending the data because there are no errors in your code... Their has to be some minor little mistake somewhere that we can't see in the code you gave us... look for typos, make sure the php code *is* on test.php. Also, when getting the variables from the post, try using $_REQUEST instead of $_POST, it may work. Try switching the method on the form page to get and see of they show up in the URL. You just gotta do some testing and rule out errors until you can pinpoint it. eatc7402 wrote: Thanks for the input. However it does no good if the variables are empty, which is my problem. The darn $_POST thing does not work at all for me, and I am trying to find out why. -Original Message- From: b1nary Developement Team [mailto:[EMAIL PROTECTED] Sent: Sunday, February 20, 2005 3:40 PM To: David Freedman; php Subject: Re: [PHP] [NEWBIE] Cant get $_POST to work What's up David... This script *should* work... I don't see any errors, but try this anyways. In your change your print command to this: print(Hello, . $name . ! You are . $age . years old!); What those periods do is simply append them to each other, so in this case, you have the string, then you're appending the variable, then appending another string, then another variable, then the last string. Instead of having it all bunched up. David Freedman wrote: I have this simple form file: html head /head body form action=test.php method=post Name: input type=text name=name value=your name /br/ Age: input type=text name=age value=your age /br/ input type=submit name=submit value=submit / /form /body /html Which passes (I wish!) data to this script: ?php $name = $_POST['name'] ; $age = $_POST['age'] ; print(Hello, $name! You are $age years old!); ? It does not work unless I turn register_globals ON in the php.ini file. The php documentation leads me to believe this script SHOULD work with register_globals OFF. This a NEW instasllation of the Windows IIS Server also. Is there perhaps some configuration on the WINDOWS SERVER that must be set for general global data to be passed from a 'form' type page? David F. Hi David, I had the same problem before -- do you have a /form tag in there? Just an idea, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote Procedure Call Failed
On Monday 07 February 2005 12:06 pm, Alex Gemmell wrote: On Sun, 6 Feb 2005 19:36:23 -0500, Andre Dubuc [EMAIL PROTECTED] wrote: On Sunday 06 February 2005 07:18 pm, Alex Gemmell wrote: Hello, I am building a login system for my website but I keep experiencing an error on a specific PHP page that I have never encountered before and it seems worryingly low-level! It says: The remote procedure call failed. And that's it! Nothing else is on the page. Sometimes I get a slightly different (but equally scary) error: PHP has encountered a Stack overflow I've googled these errors and some people have posted them but I found no solution. I've searched the PHP bug database but found nothing. Has anyone else encountered this and is there a solution? FYI: Other (more simple) PHP scripts work fine (so my PHP installation seems to be ok) and this error only started happening last week. I haven't changed this PHP/MySQL installation in months. I'm testing my script on a (Windows) server in my office on which this error occurs. When I upload it to a second remote (Linux) test server it works fine! Office Server: Windows 2000 Server + IIS 5.1, PHP Version 4.3.9 (Zend Engine v1.3.0), MySQL 3.23.49. *CGI Version - I am considering changing to ISAPI. Would this help do you think? Remote Server: Linux + Apache, PHP Version 4.1.2 (Zend Engine v1.1.1), MySQL 3.23.39. Any ideas gratefully received! Thanks, Alex First off: register_globals=on on Windows server, register_globals=off in Linux, by any chance? I ran into a similar problem (w/o the 'low-level' messages). Are you calling https for login procedures? Had a problem with that too. Hth, Andre Thank you Andre! That was spot on - my Windows PHP installation has register_globalsoff. When I turned it on the error messages disappeared. Success! FYI: I found this in the PHP manual: If your script uses session_register(), it will not work in environments where the PHP directive register_globals is disabled. I was using session_register() in one place so perhaps this was the problem? PHP manual also says this: Caution If you are using $_SESSION (or $HTTP_SESSION_VARS), do not use session_register(), session_is_registered(), and session_unregister(). Well, I have a few lines like these two: session_register('email_address'); $_SESSION['email_address'] = $email_address; If I simply delete the first line (session_register('email_address');) everything will still work... right? -- Alex Gemmell |:| [EMAIL PROTECTED] |:| Hi Alex, I'm glad it worked. Took me long enough to figure it out (and I wasn't connected to an IE server on the web, but with Linux as well.) What I suggest: dump any reference to session_register('email_address'); and use $_SESSION['email_address']; instead. My method is to convert all $_POST values from the sending script to $_SESSION AFTER validating user input: sending page: ?php session_start(); ? ?php print form action='receive.php' method='post'; print input type='text' name='email_address' value='Email Address Please'; /* etc, etc . . . */ ? receiving page: ?php session_start(); ? ?php print form action='receive.php' method='post'; /* Validate user input using standard methods */ $_SESSION['email_address'] = $_POST['email_address']; /* Then, for ease of wrting it out: */ $email = $_SESSION['email_address']; /* Lotsa stuff left out here */ ? Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I collect the keywords a user entered when searching for my site
On Monday 07 February 2005 10:02 pm, Tim Burgan wrote: Hello, How do I collect the keywords a user entered when searching for my site? I want to write some code that will retrieve the keywords entered in a search engine that were used to find my site. Is it possible to also detect what my site's search engine ranking was for the entered keywords also? Tim Hi Tim, http://awstats.sourceforge.net/ An excellent web-stats analyzer - also prints out keywords/keyphrases by analyzing web logs. Suppose you could do the same, using some code ideas from the prog. http://www.mikes-marketing-tools.com You can get search engine ranking using keywords/phrases from your site. Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Attempting to use 'passthru' or 'exec' function
Hi, I'm trying to output a text file from a pdf file using an external function, pdftotext, using either PHP's 'passthru' or 'exec' functions. The following code sort of works (at least I see localhost busy doing something for about three seconds, but the expected output of 'content.txt' is empty. I used an idea found on the mailing list: I actually got some activity with 'sudo desired_function arg1 arg2'. File permissions are set wide open (apache:apache 777), safe_mode=off. What am I doing wrong? (Btw, the pdftotext function works fine on commandline). ?php $currentPdf = 2005-01-v2.pdf; //print $currentPdf; if (file_exists($currentPdf)) { passthru(sudo /usr/bin/pdftotext /var/www/html/2005-o1-v2.pdf.txt /var/www/html//current.txt); } /* Also tried the following using 'passthru' then 'exec': $pdf = file_get_contents($currentPdf); //print brbr$Pdf; passthru(sudo pdftotext /var/www/html/2005-o1-v2.pdf.txt /var/www/html/current.txt); */ $current = current.txt; print brbrCurrent Text: $current; $string_text = file_get_contents(current.txt); $new_text = nl2br($string_text); ? Any help, pointers, admonitions gratefully accepted, Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shifting banner on re-display [SOLVED]
Hi List, This is an 'oldie' thread, but since I found out what caused the odd behavior, I thought it would be nice to pass on the solution. Toying around with it last week, I suddenly remembered that often when I manipulated an image in The Gimp, sometimes the image would move slightly off-center or down a shade. If that image was then saved, those changes, minute as they were, would magnify if the image was displayed at increased width. Result = image might shift an inch shift up or down. A rather embarrassing but obvious error, if one knew where to look. . . Re-centering and saving the images solved the problem. Thanks again to all who offered suggestions. A Blessed Christmas to all. Andre Hi Mark, Tried your idea - no go. Somehow I think the problem may be related to the banner's gif width (set at 101%). I recall when I first made the banner, which has a horizontal rule (a png) above it set at 100%, that the HR caused some problems. Perhaps I should toy more with the combo. Thanks for the suggestion. Regards, Andre On Saturday 13 November 2004 07:42 pm, Marek Kilimajer wrote: What if you try: ?php include(banner.php); ? form action=bad.php method=post Andre Dubuc wrote: Hi, I have a very annoying problem with pages that re-display using the form action tag. On re-display the banner, which is set absolute position at 0px, shifts down by about an inch. I've isolated the cause to the form action tag. Simplified code for bad.php page: ?php session_start(); ob_start(); ? /* html head style body tags */ form action=bad.php method=post ?php include(banner.php); ? input type=submit name=submit value=Add Names /* closing form body html tags */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Apache Upload file Permission denied
Dear Michael, I spent the better part of today trying to get a file upload script to work too. Same sort of problem: local linux works ok, but web - nope. Looking at your error message, it might be the renaming of the temp file that is barfing. if (($_FILES[pix][size] 0)($_FILES[pix][size] 75000)){ if ($_FILES[pix][type] == image/jpeg) { $pix_file = $_FILES[pix][name]; $pix_temp_file = $_FILES[pix][tmp_name]; $new_pix_file = -5.jpg; if(is_uploaded_file($pix_temp_file)){ move_uploaded_file($pix_temp_file, pix/$new_pix_file); } } } else { print brbrbrbrbigbPicture Upload Errorb/bigbrbrh5Filesize is greater than maximum 75k!brbr Please resize your picture to below 75k, and try again!/h5br; } This works for me -- might want to modify it and see if it clicks on yours. My pix directory is 777, uploaded files go in as apache:apache 755. (also, if you try to upload greater than limit set in apache, nothing will show up in '/var/www/htm/test/icons.zip'. ^ Btw, is that a typo: 'htm' or did you want 'html'?? Hth, Andre On Sunday 12 December 2004 07:46 pm, Michael Leung wrote: Hi all, I have faced the upload file permission denied for weeks. I can't write a new file/create a directory. I did a test in PHP standalone (Linux shell). The operation is very normal. But in web environment, I got this error message: Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/phpjsLZfC' to '/var/www/htm/test/icons.zip' in /var/www/html/simple_upload.php on line 76. I think this is a problem bewteen Apache and PHP. The safe mode of PHP is off and test directory is changed to 777. yours, Michael -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Weird sessions problem
On Sunday 28 November 2004 05:46 pm, steve wrote: Jason Wong wrote: On Sunday 28 November 2004 22:46, steve wrote: I tried printing out the values before and after each of those lines. After line 53, $ref_page is an array containing precisely the values I expect, so the function is working. After line 54, the session var has been reset, as expected, to match the current page - but $ref_page has also changed and is now equal to $_SESSION['ref_page'], which is what I found very weird - ie, resetting $_SESSION['ref_page'] simultaneously reset $ref_page. Is $ref_page getting set to what the _previous_ value of $_SESSION['ref_page'] was? If so, it sounds like you have register_globals enabled. No to both. When I arrive at the new page, the sessions vars (as expected) contain the values set by the previous page. $ref_page is not set. The values are transferred to $ref_page by the function. That works as planned. I then reset the value of the session vars, at which point, $ref_page also gets set. From printing out the values after each line, I find this: Let's say we've come from the page /community.php and have arrived at /market.php. Here are the values at each stage: $_SESSION['ref_page] = '/community.php' $_SESSION['ref_pagequery'] = 'pagemode=index' // as an example 53. $ref_page = get_ref_page(); $ref_page['name'] = '/community.php' $ref_page['query'] = 'pagemode=index' $_SESSION['ref_page] = '/community.php' $_SESSION['ref_pagequery'] = 'pagemode=index' 54. $_SESSION['ref_page'] = THIS_PAGE; $ref_page = '/community.php' // now a scalar $_SESSION['ref_page] = '/market.php' register_globals is off (in php.ini and there are no .htaccess files). -- @+ Steve Hi Steve, As a late-comer to this thread, I'd like to toss about a few ideas. I gather that all of the script occurs on one page, and that the page is 'refreshed' by some action of the user (i.e. that the user has clicked/entered login info on some other page, and that this page then needs to detect that change.) What may be happening is that the refresh action triggers the script twice: once for the initial loading and again for the reset values. Hence, $ref_page gets reset by line 53 ($ref_page = get_ref_page(); I experienced the same difficulty once, and essentially solved the problem by adding an extra page that is called, by a simple switch statement, if there is a change: i.e, from 'community' to 'market'. Another question, by any chance, are you switching into https by any chance? Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Odd Behaviour: DIE function
I've noticed some strange behaviour with respect to validation of user input. Normally, using Linux, the die function in user input validation works as expected. However, the same code in IE, the DIE function does not work as expected. I've noticed that fields, that should die and barf an error message, seem to allow no input. Often, I notice that the user has entered a different spelling as well. I'm puzzled by this (Furthermore, I wasn't aware the user could change the contents of a dropdown select list [I cannot duplicate it in Linux). Since one of the affected fields receives its input from an included file (provcountry.dpn), perhaps this ius an IE issue?? provcountry.dpn tdbCountry nbsp;/b/td tdSELECT NAME=rcountry option selectedChoose from List OPTIONUSA /* list of countries follows */ snippet code in validation page: ?php ... if ($_POST['rcountry'] == Choose from List) die (h5brbrPlease choose your Country from the drop-down listbrbrbrClick 'Back' on your browser to enter this information/h5); ... ? Any pointers of what I'm missing here would be appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Shifting banner on re-display
Hi, I have a very annoying problem with pages that re-display using the form action tag. On re-display the banner, which is set absolute position at 0px, shifts down by about an inch. I've isolated the cause to the form action tag. Simplified code for bad.php page: ?php session_start(); ob_start(); ? /* html head style body tags */ form action=bad.php method=post ?php include(banner.php); ? input type=submit name=submit value=Add Names /* closing form body html tags */ ?php if($_POST['submit'] == Add Names){ switch ($_SESSION['status']) : case Member : header(location: add-names.php); break; default : header(location: join.php); break; endswitch; } ? Is there a workaround for this problem, or is this a normal occurence? Any suggestions or pointers would be gratefully appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shifting banner on re-display
On Saturday 13 November 2004 05:02 pm, you wrote: Hi, Sunday, November 14, 2004, 2:00:08 AM, you wrote: AD Hi, AD I have a very annoying problem with pages that re-display using the form action tag. On re-display the banner, which is set absolute position at 0px, AD shifts down by about an inch. I've isolated the cause to the form action tag. AD Simplified code for bad.php page: AD ?php session_start(); ob_start(); ? AD /* html head style body tags */ AD form action=bad.php method=post AD ?php include(banner.php); ? AD input type=submit name=submit value=Add Names AD /* closing form body html tags */ AD ?php AD if($_POST['submit'] == Add Names){ AD switch ($_SESSION['status']) : AD case Member : AD header(location: add-names.php); AD break; AD default : AD header(location: join.php); AD break; AD endswitch; AD } ? AD Is there a workaround for this problem, or is this a normal occurence? AD Any suggestions or pointers would be gratefully appreciated. AD Tia, AD Andre You could try this: form action=bad.php method=post style=display: inline; Thanks Tom, Tried it. No difference - still shifts. Seems like it is a browser problem. Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Shifting banner on re-display
Hi Mark, Tried your idea - no go. Somehow I think the problem may be related to the banner's gif width (set at 101%). I recall when I first made the banner, which has a horizontal rule (a png) above it set at 100%, that the HR caused some problems. Perhaps I should toy more with the combo. Thanks for the suggestion. Regards, Andre On Saturday 13 November 2004 07:42 pm, Marek Kilimajer wrote: What if you try: ?php include(banner.php); ? form action=bad.php method=post Andre Dubuc wrote: Hi, I have a very annoying problem with pages that re-display using the form action tag. On re-display the banner, which is set absolute position at 0px, shifts down by about an inch. I've isolated the cause to the form action tag. Simplified code for bad.php page: ?php session_start(); ob_start(); ? /* html head style body tags */ form action=bad.php method=post ?php include(banner.php); ? input type=submit name=submit value=Add Names /* closing form body html tags */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals
On Monday 25 October 2004 02:50 pm, Matthew Sims wrote: [snip] I see that register_globals is turned on. Now I always use the $_GET and $_POST vars but will this still affect me? [snip] Matthew, Although it shouldn't affect you, I had a terrible time trying to get anything to pass via sessions with register_globals=on with a site I had rebuilt. All sorts of strange behavior -- if you look back in the archives you see what I mean. Once register_globals was switched to 'off' everything worked as expected. Sorry to throw a wrench into the works! Hth, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form madness maybe OT
Stuart, I'm no expert, but did you flush your browser? Hth, Andre On Saturday 23 October 2004 06:46 am, Stuart Felenstein wrote: I've tried about everything and have analyzed every bit of code but I can't seem to resolve this issue. It might be off topic since I can't say for sure if this is a php problem. The issue - I have a multi page form. One page seems to throw a wrench in the whole process every time I make a simple modification. Initially I had this setup: tdinput name=skill[] type=text id=skill[]/td select name=sky[] id=sky[] select name=slu[] id=slu[] tdinput name=cert[] type=text id=cert[]/td select name=cky[] id=cky[] select name=clu[] id=clu[] There were 5 rounds of these. Now when I setup the array I only set it up to grab the skill[], sky[], and slu[] And all that works great ! And so basically cert[],cky[],clu[] were just dead elements. Now what I've done is dropped the cert,cky,clu elements and added 5 more sets of the skill, sky and slu. No difference in the sequence of elements in the form. Yet for some unknown reason it throws a curve to the process somehow and basically kills the transaction. I've checked, rechecked the session start and the authentication procedures. Like I say if I put the original one back in all is well. The array does not limit the number of elements. Very strange behaviour. I am not sure what to do. After a good amount of effort I thought to post in case someone with more experience might understand the possible issues. Thank you. Stuart -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form madness maybe OT
On Saturday 23 October 2004 07:11 am, you wrote: --- Andre Dubuc [EMAIL PROTECTED] wrote: Stuart, I'm no expert, but did you flush your browser? Hth, Andre Andre, thank you for the response. I'm not sure what you mean by flush the browser ? Here is what I've been doing. First, I have denied cookies from the site. Second, I've logged out and logged back in again. I think the sessionid would change then, as I've tested with the sessionid printing out. Last, I've actually closed out of the browser and re-opened. Stuart Stuart, Go to your browser settings, under 'Cache' (or something similar) then clear the cache. I struggled with a similar problem for days . . . Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Validation problem with array.
Hi Stuart, I haven't followed your thread too closely, but I did see something that might be the cause of your problems: [snip] Let me show you how I set it all up. Remember it's a multi page form: So the form elements are: skills[], skys[], slus[] Then on the next page I have to still pass the session variables, and so: $_SESSION['skills'] = $_POST['skill']; $_SESSION['skys'] = $_POST['sky']; $_SESSION['slus'] = $_POST['slu']; Now the transcation script: $skills = $_SESSION['skills']; $skys = $_SESSION['skys']; $slus = $_SESSION['slus']; foreach($_SESSION['skills'] as $key = $skill) ^^ ^^ [snip] It's my understanding that where I've put ^^ should be enclosed by braces, otherwise you'll get some starnge behaviour. I'm puzzled why you reverted to $_SESSION['skills'] when the line above you've set $skills = $_SESSION['skills']?? HTH, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List Etiquette
On Tuesday 21 September 2004 03:02 pm, John Nichel wrote: While the thread still lives, let me add a pet peeve of mine. People who reply to all. Just reply to the list...if you have to click reply to all to get the list address in there, fine, but take a few seconds to remove all other addresses. Arrgh! I use Kmail. I click 'Reply' and I get your personal address (instead of the correct 'To:' address. Bummer! Gotta spend some energy wiping the current 'To:' addrress, type in letter 'p', click auto-complete for correct address, and click again. Sigh . . . way too much work for me. Maybe it's time to say bye-bye to this thread . . . Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] List Etiquette
Hi, After googling 'Web Etiquette, Top Posting', I still am puzzled why some people on this list insist that top posting is bad form, rather than personal preference. The arguments seem to be balanced on either side. Checking the list's archives, I noticed that those who object to top posting almost invariably top-post their objection (perhaps for added emphasis, who knows). Further, after searching the list's archives on the subject, I noted that the archives are organized by latest response = oldest (the original message); that is, the archives, in effect 'top-post' all threads: latest first (on top of the list) and the oldest (at the bottom of the list). Seems to me much easier to scan the Subject, see how it's developing by reading the reply on the top, rather than have to wade through even snipped old material. I've been on this list, on-and-off, for a few years, and somehow I must have missed the discussion on the unwritten rule of bottom-posting. Perhaps someone could enlighten me with a url? Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] List Etiquette
OK, Jason. I'm throughly confused. You say: Top posting means one cannot reply point by point like I'm doing here. then you state: Wouldn't you agree that it's easier to read something point by point whereby you can easily see the context, instead of reading a sentence at the top of the post then scrolling down to find out what that sentence was about in the context of the original post? I suppose each to their own. I'm glad that this list is not as trigger-happy as some I've been on. I still don't see what all the fuss is about . . . but then again, I'm slow. . . . Regards and thanks for the clarifications, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mysql_connect does not connect
Amazing how long that thread is -- must be a record. Seems to be classic case of 'ignore-the-obvious' or 'my-mind-is-made-up. Don't-confuse-me-with-facts'. Perhaps I should start a new thread: [PHP} Can't get NULL to output anything! hehe Andre On Friday 17 September 2004 03:11 pm, Jason Davidson wrote: hehehe.. im actually looking forward to reading responses on this thread.. funny stuff. Jason Jason Wong [EMAIL PROTECTED] wrote: On Friday 17 September 2004 23:21, Sam Hobbs wrote: Again, it is okay to say this once but it is not useful to keep insisting. I am smart enough to be aware of the possibility and if and when other possibilities have been exahausted I would have tried the possibility of disabling the firewall or whatever. Insisting upon it from others is not productive; it is more likley to polarize me in the opposite direction and get us to where we are now. It is the emotional commentary that is most unproductive. I try to explain (unemotionally and in a reasonable manner) that I don't need the additional assertion that I must try something and the response to that becomes emotional. Being obstinate and contrarian does nothing to help resolve your problem. Time for another: [quote from a Sam Hobbs post in reply to Jason Davidson] It is my understanding that the firewall is not supposed to be relevant. I have not seen anything saying it is supposed to be. If it is true that it is not supposed to be relevant, then simply saying it is just causes confusion. If you had said that the firewall is not supposed to be relevant, but try disabling it anyway, then I would say that I am totally able to think like that too. It is reasonable to try things like that to diagnose a bug. [quote] Would I be correct if I paraphrased the above as: The wrong way to get Sam Hobbs to try something that might help in solving his problem: [JD] The firewall might be blocking your attempts to connect to mysql. Try disabling it. [SH] Yeah and what makes you think that? I KNOW the firewal has nothing to do with it. Get real (and go away). The right way to get Sam Hobbs to try something that might help in solving his problem: [JD] The firewall has nothing to do with your problem. But try disabling it anyway. [SH] Yeah that sounds reasonable. Thanks, I'll try that. How silly is that? -- 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 -- /* If money can't buy happiness, I guess you'll just have to rent it. */ -- 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] mysql_connect does not connect
?php function logic($logic, find_some) { if($TopPosting === evil)($email['JayBlanchard'] == TopPosted) { switch ($logic) : case None : print You've just TopPosted; break; case True : print TopPosting != evil; $TopPosting = good; return(); break; case False : print TopPosting is your friend!; $TopPosting = evil; if ($TopPosting === evil'){ $TopPosting = None; } exit; break; endswitch; } else { print Says who??; } } Thanks for the input, Jay! I prefer top posting since you get the answer first, then the question (iff you're interested enough to scroll down -- sigh -- I'm too lazy :) Andre On Friday 17 September 2004 05:08 pm, you wrote: Did you just top post? Top posting === evil; -Original Message- From: Jason Davidson [mailto:[EMAIL PROTECTED] Sent: Friday, September 17, 2004 3:14 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: [PHP] mysql_connect does not connect HAHAHA, this thread is awsome though, you all must admit the humor involved here. I hope this thread continues for a couple more days. or here is an idea for a thread {PHP} globals.asp wont set my php vars [EMAIL PROTECTED] wrote: Amazing how long that thread is -- must be a record. Seems to be classic case of 'ignore-the-obvious' or 'my-mind-is-made-up. Don't-confuse-me-with-facts'. Perhaps I should start a new thread: [PHP} Can't get NULL to output anything! hehe Andre On Friday 17 September 2004 03:11 pm, Jason Davidson wrote: hehehe.. im actually looking forward to reading responses on this thread.. funny stuff. Jason Jason Wong [EMAIL PROTECTED] wrote: On Friday 17 September 2004 23:21, Sam Hobbs wrote: Again, it is okay to say this once but it is not useful to keep insisting. I am smart enough to be aware of the possibility and if and when other possibilities have been exahausted I would have tried the possibility of disabling the firewall or whatever. Insisting upon it from others is not productive; it is more likley to polarize me in the opposite direction and get us to where we are now. It is the emotional commentary that is most unproductive. I try to explain (unemotionally and in a reasonable manner) that I don't need the additional assertion that I must try something and the response to that becomes emotional. Being obstinate and contrarian does nothing to help resolve your problem. Time for another: [quote from a Sam Hobbs post in reply to Jason Davidson] It is my understanding that the firewall is not supposed to be relevant. I have not seen anything saying it is supposed to be. If it is true that it is not supposed to be relevant, then simply saying it is just causes confusion. If you had said that the firewall is not supposed to be relevant, but try disabling it anyway, then I would say that I am totally able to think like that too. It is reasonable to try things like that to diagnose a bug. [quote] Would I be correct if I paraphrased the above as: The wrong way to get Sam Hobbs to try something that might help in solving his problem: [JD] The firewall might be blocking your attempts to connect to mysql. Try disabling it. [SH] Yeah and what makes you think that? I KNOW the firewal has nothing to do with it. Get real (and go away). The right way to get Sam Hobbs to try something that might help in solving his problem: [JD] The firewall has nothing to do with your problem. But try disabling it anyway. [SH] Yeah that sounds reasonable. Thanks, I'll try that. How silly is that? -- 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 -- /* If money can't buy happiness, I guess you'll just have to rent it. */ -- 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
Re: [PHP] problem with Header(Location: home.php);
On Thursday 12 August 2004 07:48 pm, CBharadwaj wrote: Hello, In conection.php I have written. SESSION_ START(); ^ Get rid of extra space and it should work Hth, Andre on successful login I am registering a session variable. SESSION_REGISTER(userId); on login failure I am redirecting to home page. Header(Location: home.php); the following error occuring in above line. Warning: Cannot modify header information - headers already sent by (output started at E:\PHPMySql scripts\bugtrack\connection.php:3) in E:\PHPMySql scripts\bugtrack\index.php on line 117 the connection file I have included in every page. why this error is occuring? Bharadwaj -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session again !!!
Hi, In your code: if($_SESSION['uname'] = = ) ^ Get rid of that extra space bewteen the == Hth, Andre On Sunday 05 September 2004 11:23 am, Dre wrote: I really did and it behaves the same I tried isset() also but there is no good it still does not work !!! Afan Pasalic [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Try use if(empty($_SESSION['uname']) instead if($_SESSION['uname'] = = ) Afan Dre wrote: Hi .. I'm still working on my members login script. I'm using a simple username/password login form that calls the following login script //= ?php session_start(); $username = trim(addslashes($_POST['user_name'])); $pass = trim(addslashes($_POST['password'])); if((empty($_POST['user_name'])) || (empty($_POST['password']))) { header('Location: index.php'); include(login_form); exit(); } else{ include(db.php); $sql = SELECT * FROM members_data WHERE user_name='.$username.' AND password='.$pass.'; $result = mysql_query($sql); $num_return = mysql_num_rows($result); if($num_return ==1) { $row = mysql_fetch_array($result); //session_register('uname'); $_SESSION['uname'] = $username; header('Location: /members/main.php'); } else { } } ? //= the login scrip works fine .. and it directs me to the correct landing page The problem occures when I tried to secure the members area pages using the following code in the begining of each page //= ?php session_start(); if($_SESSION['uname'] = = ) {header('Location: ../../index.php'); exit(); } else{} ? html ... other html code /html //= After I login using the correct user name and password I get always re-directed to that index page as if I'm not logged in I'm really so new with the sessions usage so I can't figure out what do I miss here any help would be appreciated. Thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: function problem
On Saturday 04 September 2004 03:42 pm, Torsten Roehr wrote: Matthias Bauw [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] I'm having a problem with a php application; I have two files: one is ccadduser wich adds users to a controlcenter that I am currently designing for a website. In that ccaduserfile I call for a function checkpermission(); this function is defined in another file called ccfunctions When a user does not have access to the script it should abort the script, this is done using a header(location: ccnopermission.php); statement But now it seems that while executing the function checkpermission() the code in ccadduser just keeps running and the database query that inserts the new user is executed before the user can be redirected to ccnopermission. Is there a way to make php wait until checkpermission is completely executed? I know it is not a simple question, but I really need a solution to ensure the safety of my system. grtz thanks DragonEye I'm not completely sure if I understand your question but PHP will process one function after the other. Without seeing some code I'm afraid we can't help you much. Regards, Torsten Roehr Two thoughts: You call function checkpermission(); that is defined in another file. How do you call this file: do you use absolute url? Might be the problem, as well as using header(location; ccnopermissions.php);. Might want to use an absolute url there too. Just a thought or two, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: uppercase sentences
On Friday 03 September 2004 11:16 pm, Chris Martin wrote: Justin French wrote: Hi all, I'm working with a bunch of users who hardly ever use correct punctuation in their submitted content. I realise there's very little I can do, but I'm trying to do *something* to make things a little more presentable. At the very least, ensuring that all sentences begin with a capital letter (english) would be a great start. Has any one come across a library of punctuation cleaners or something like that? --- Justin French http://indent.com.au Check out the many wonderful string functions at http://php.net/strings In particular, for all uppercase, you'll probably find 'strtolower()' helpful. And, as Jim mentioned, ucfirst() will capitalize the first letter. There's a bunch more that can help you control what they're sending you. (Isn't it amazing what people will enter in a form??) -- Chris Martin Web Developer Open Source Web Standards Advocate http://www.chriscodes.com/ Hi Justin, To add to what Chris mentioned, I always include this little snippet: if (ereg(([A-Z][A-Z][A-Z][A-Z]), $_POST['request'])) { print h5brbrbrbrPLEASE SET 'CAPS LOCK' TO OFF brbr Then click 'Back' on your browser, and re-enter information./h5/div; } [I make the assumption that any word with three or more capitals deserves this message.] Amazing how many people forget to add a space after a period, capitalize proper names, etc. I have a whole mess of little functions that clean up the glaring errors. However, in the long run, I've decided to let the less-glaring stuff through, but clean up the major ones. Just my pence worth Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Why won't my echo won't work? [newbie question]
Try using braces around $_POST or any superglobal you use: print_r($_POST); print brbr{$_SERVER['REQUEST_METHOD']}; print brbr{$_POST['username']}; Works for me. Hth, Andre On Sunday 29 August 2004 01:13 pm, John Nichel wrote: FrzzMan wrote: John Nichel wrote: [EMAIL PROTECTED] wrote: The first two of these 3 echo statements work. But my last echo doesn't. 'username' is the name of the element I want to echo. To the right of each is what I see echoed. echo $_SERVER['REQUEST_METHOD']; echos - POST echo $_POST; echos - Array echo $_POST['username']; echos - nothing How are you setting $_POST['username']? Let's see the code for the form. Members in $_POST array are set (mostly) by submitting a form with POST method, make sure your form is not submitting by GET. The first echo statement from the OP shows that the request method is *not* GET. -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with sessions
Hi, Looking at your code, I noticed that either you're missing the closing double quote to close off the Location expression, or you're ending it early with a double quote at http://;. Shouldn't it read: header(Location: http://' . $_SERVER['HTTP_HOST'] ^ . dirname($_SERVER['PHP_SELF']) . '/b.php?'.SID'); ^^ Perhaps that's the problem. I'm no expert . . . Hth, Andre On Friday 27 August 2004 07:47 am, gregosh wrote: you sure the cookie is being set? try this header(Location: http://; . $_SERVER['HTTP_HOST'] . dirname($_SERVER['PHP_SELF']) . '/b.php?'.SID); I had tried this before - no result. The cookie is set in the \temp dir where it is intended. And that's where the other cookie with new session is located too. This really is a strange problem. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP Version for API 20001222
PHP 4.0.6-6.2mdk On Friday 27 August 2004 02:45 pm, Cole S. Ashcraft wrote: What PHP version had the API number 20001222 ? Thanks Cole -- This message has been scanned for viruses and dangerous content by MailScanner on mail.ashcraftfamily.net, and is believed to be clean. Please report any deviance from this condition immediately to the AFN Administrator at [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Destroying a Session
On Wednesday 25 August 2004 12:27 pm, Shaun wrote: [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] function clear_orderinfo() { global $_SESSION; unset($_SESSION[orderinfo]); } However this function doesnt seem to work and the session remains active, is there another way to clear a session? I'm not triffically experienced, but I do have notes on the subject. You're wanting to clear the whole session, right? $_SESSION=array(); session_destroy(); For specific variables, try assigning FALSE to it ($_SESSION['name']=FALSE; or 'unset' works for versions =4.2.2. Otherwise use session_unregister. For me under 4.1.2 I had to set to null. HTH J Hi, Thank you for your replies. I am using version 4.3.3 yet unset() doesn't seem to work. To test this I have placed this line of code in my footer.php file that appears at the bottom of every page: echo 'load_orderinfo() = '.load_orderinfo(); Here is the load_orderinfo() function: function load_orderinfo() { global $_SESSION; if (empty($_SESSION[orderinfo])) { return false; } else { return $_SESSION[orderinfo]; } } Before the $_SESSION[orderinfo] is created the output in the footer reads: load_orderinfo() = When it has been created it reads: load_orderinfo() = Object; On the complete_order.php page where I call the clear_orderinfo() function it goes back to: load_orderinfo() = but it on any subsequent page the output returns to: load_orderinfo() = Object; But after calling the clear_orderinfo() function surely the $_SESSION[orderinfo] should have been destroyed. I hope this makes sense! Thanks for your help Shaun, For what its worth, I experienced probs with destroying sessions until I added another page. On the page in question, I called the 'logout' function and redirected to that page: [logout.php] ?php session_start(); ob_start(); session_destroy(); header(location: http://your_site.back_to_page_that_is not_logged in.php); ? Note that I used an absolute url -- it seems to make a difference. [Btw, I note that you use double quotes for $_SESSION['orderinfo'] -- just wondering . . . . HTh, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] After upgrading PHP, Session Values not stored properly
On your new setup, is register_globals=on by any chance? I ran into the same problem -- once set to off, everything started working properly. Just a thought, Hth Andre On Monday 23 August 2004 02:45 am, Sheni R. Meledath wrote: Hi Gerard, Many thanks. We are using cookies to store the session ID. The session on other sites are working perfectly. The same problem on this site is experienced by other users also. Also the same log-in module was working perfectly with the older PHP version. At 10:20 AM 8/23/2004, Gerard Samuel wrote: Sheni R. Meledath wrote: session.use_trans_sid On On Im currently running FBSC 4.10/php 4.3.6, and the only difference with our session setup is session.use_trans_sid. Mine is off. For sessions to get lost means that either a) You have cookies disabled in the browser b) You are not using the SID constant in links/or not using session.use_trans_sid So are you using cookies? If you accept cookies, are cookies stored in the browser? If you are not using cookies, are you manually adding the SID constant to links, or is session.use_trans_sid actually working by adding the session id to your links (check the source of the page)? Regards Sheni R Meledath [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Problem PHP version 4.3.8
Hi James, Well for what it's worth: Your code in Test1 sets the paraemters - if(!$_SESSION['start_time']){ echo(\n Session ResetBR); $_SESSION['start_time'] = time(); yet when Test2 loads, you haven't called $_SESSION[''start_time'} nor, for that matter, have you 'saved' it using session_write_close(); Therefore when the Test2 loads, time is not set, so when it returns to Test1 and hits the above condition, it will write a new time, and hence a new session. I presume two things; 1. that you have ?php session_start(); ? as opener lines on each page and 2. that register_globals=off. The last thing caused all sorts of grief for me last week - messes up sessions if 'on' Hth, Andre On Friday 13 August 2004 10:37 am, James E Hicks III wrote: OK, so it wasn't the nut behind the wheel after all. I am still having problems with sessions after upgrading to PHP 4.3.8. The test code below works as expected on server equipped with PHP 4.3.6 and keeps the session start time the same no matter what link you click on. However with version 4.3.8 when you click on the last link on the page it will start a new session and the session start time will be updated. What can I change to fix this? All the session related php.ini settings are the same on both servers and I will repost that information here. Both servers are running the same version of Apache, Server version: Apache/1.3.27 (Unix) (Gentoo/Linux). ## Session settings in php.ini [Session] session.save_handler = files session.save_path = /tmp session.use_cookies = 1 ; session.use_only_cookies = 1 session.name = PHPSESSID session.auto_start = 1 session.cookie_lifetime = 0 session.cookie_path = / session.cookie_domain = session.serialize_handler = php session.gc_probability = 1 session.gc_divisor = 100 session.gc_maxlifetime = 1440 session.bug_compat_42 = 1 session.bug_compat_warn = 1 session.referer_check = session.entropy_length = 0 session.entropy_file = ;session.entropy_length = 16 ;session.entropy_file = /dev/urandom session.cache_limiter = nocache session.cache_expire = 180 session.use_trans_sid = 0 url_rewriter.tags = a=href,area=href,frame=src,input=src,form=,fieldset= And here is the example code that I am having trouble with. SESSION_TEST1.php ?php echo(\n HTMLHEADTITLESESSION TEST/TITLE); echo(\n SCRIPT LANGUAGE=\JavaScript\); echo(\n !-- Begin ); echo(\n function popUpBI(URL) { ); echo(\n day = new Date(); ); echo(\n id = day.getTime(); ); echo(\n eval(\page\ + id + \ = window.open(URL, '\ + id + \', 'toolbar=0,scrollbars=yes,location=0,statusbar=0,menubar=0,resizable=0,widt h=400,height=400'); \); ); echo(\n } ); echo(\n // End -- ); echo(\n /script); echo(\n /HEADBODY); if(!$_SESSION['start_time']){ echo(\n Session ResetBR); $_SESSION['start_time'] = time(); } echo(\n BRSession Start Time -.date(M/d/Y h:i:s, $_SESSION['start_time'])); echo(\n form action=\.$_SERVER['PHP_SELF'].\ method=\POST\); echo(\n BRinput type=\submit\ name=\submit\ value=\THIS WORKS\); echo(\n /form); echo(\n BRA HREF=\SESSION_TEST1.php\THIS ALSO WORKS/A); echo(\n BRBRA HREF=\javascript:popUpBI('SESSION_TEST2.php')\THIS STARTS NEW SESSION/A); echo(\n /BODY/HTML); ? SESSION_TEST2.php ?php echo(\n HTMLHEADTITLESESSION TEST 2/TITLE/HEADBODY); echo(\n Now there is new session and the other window will update with new timeBR); echo(\n BRa href=\javascript:window.close();\fontClose This Window/font/a); echo(\n /BODY/HTML); ? Help James Hicks -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Session Problem PHP version 4.3.8
On Friday 13 August 2004 11:19 am, you wrote: On Friday 13 August 2004 11:14 am, Andre Dubuc wrote: Hi James, [snip] .for thatt matter, have you 'saved' it using session_write_close(); From the Manual: Session data is usually stored after your script terminated without the need to call session_write_close(), [snip] Well, for my money James, that's where your problem lies. Notice the usually in the Manual quote. In my experience, it never saves unless I write to it. But, with your config, with session.auto_start=1, if I read that correctly, it will do nothing other than start the session automatically, but not save a change to a session variable. Hence, it reloads with a 'not-set' condition in that code. And by the way, it is hitting that if condition - hence your reset session. Just my $2 worth (inflation, you know :) Andre Time is set. Test1 and hits the above condition, it will write a new time, and hence a new session. It should never hit the if condition after the first load of the page. I presume two things; 1. that you have ?php session_start(); ? as opener lines on each page and 2. that register_globals=off. In my php.ini I have session.auto_start = 1, so that I do not need session_start(). And register_globals is set to off. The last thing caused all sorts of grief for me last week - messes up sessions if 'on' Been there done that! Thanks for trying to help! James -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Local version works - production breaks
Thanks for the idea, Josh. I will do this, but still this hack doesn't answer the question: Why does it work locally without hitch, yet totally barfs on a very similar configuration on the net? As I mentioned, this is a re-write. I've learned my lesson: never try to patch another's code -- write it fresh! There is simply way too much weird behavior happening with the present code: sessions not passing, odd error messages about redeclaration, and conditionals where both are passed. Time to dump it and start fresh! Thanks (to everyone) for your help and pointers! Andre On Sunday 08 August 2004 09:19 am, Josh Acecool M wrote: Try adding if (!function_exists(function_name)) { function function_name ($blah) { // Function Code } } for each function. That will fix the redeclare problem which happens if you call your cards.php file in more than 1 file.. Andre Dubuc [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] On Saturday 07 August 2004 10:11 pm, Robby Russell wrote: On Sat, 2004-08-07 at 19:00, Ed Lazor wrote: It could be that you have local error reporting set to none. It could also be that you're using full paths when referencing files which then breaks when moving files to a new server. Basically, there's a lot of possibilities and I'm not going to have much luck helping unless you include error messages. My guess is that resolving a few errors will address a core problem and everything will start working. -Ed Yes, it's very possible that he isn't getting errors locally because his errors aren't on. Andre, You might check your error settings on your local server. You might even consider upgrading php on your local server to the same version and debugging. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / Robby, I just enabled log_errors locally. No errors (as I thought). Since I am hacking a previously written site, the problem seems to arise most when accessing his pre-built functions across pages. For instance, he uses a 'cards.php' to store all display functions -- showleft() -- showcentre() , as well as the connect() function. Since its a persistent connection -- he opens the db once, then performs various queries in it. However, since 'cards.php' has already been called once by a page that might require both showleft() and showcentre() -- it barfs and says that it cannot 'redeclare' the showleft() function that has already been declared?? That is really some weird -- particularly when it works so well (as expected) locally - and also since I'm not 'redeclaring' but calling it for use! I cannot fathom why the production site would give this error. Perhaps I need to do absolute paths for all headers? But it doesn't make sense that a function cannot be called many times -- declaring it once, yes, but calling its use?? If that were the case, then one might as well write it out longhand for each use, and forget the concept of 'functions'. I think I should look at the error logs for the site -- maybe they will clue me in where I should look. Thanks, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Local version works - production breaks [SOLVED]
On Sunday 08 August 2004 01:51 am, Jason Wong wrote: On Sunday 08 August 2004 09:38, Andre Dubuc wrote: That's what I thought. But the differences are glaring. Seems like none of the code wants to work. Navigation is a nightmare: header(location:...); usually brings an error message: function so and so -- include(xxx.php); has already been declared -- cannot redeclare (yet locally - absolutely no problem!) ?? IIRC older versions of PHP allowed multiple declarations of a function. Somewhere along the line this was changed. -- 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 -- /* God isn't dead. He just doesn't want to get involved. */ Hi Jason et al, Thought I'd drop a note -- turning register_globals=off on the server in question magically made everything work. Now I'll rasie the question that IP manager has asked: Having register_globals=of/on should not amke any difference to your site if you are using $_POST, $_SESSION etc. You must have a bug in your code. Since exactly the same code works locally with register_globals=on or off, I suspect the proble is at his end, not in the code. Am I right in assuming this? Regards, and thanks fro the help sugegstions! Andre Hi Jason et al, Thought I'd drop a note -- turning register_globals=off on the server in question magically made everything work. Now I'll rasie the question that IP manager has asked: Having register_globals=of/on should not amke any difference to your site if you are using $_POST, $_SESSION etc. You must have a bug in your code. Since exactly the same code works locally with register_globals=on or off, I suspect the proble is at his end, not in the code. Am I right in assuming this? Regards, and thanks fro the help sugegstions! Andre God isn't dead. We just don't want to get involved. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Local version works - production breaks
Hi, I have re-written a very basic website to use sessions (switching to https) for login to special areas of a site. After testing the site thoroughly locally, I uploaded the whole shebang to a unix server that runs Apache 1.3.x + PHP 4.3.4 + mysql. Almost all code broke - sessions would load, but almost every page was so messed up that -- well, I'm flabbergasted! I'm wondering, after reading a few threads on my local config whether the problem might lie with the Apache2 server I use locally (Mandrake special with Extranet). I also use an older version of PHP 4.3.1. I've examined both configs for differences, but can see nothing that would account for such an extremely messed up site. It loads locally beautifully (and all admin pages work) in Opera, Galeon, Mozilla, + Konqueror. Loads with errors to mysql db in all others but Konqueror which does not even display the opening page (yet I can view source). Maybe this isn't the forum to ask -- but seeing that all db access is through PHP -- I wonder whether anyone can point where i can start looking for the culprit(s). Any ideas, suggestions, or advice will be greatly appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Local version works - production breaks
Josh, Aside from the differences in php versions, the only difference is thta the local version has register_globals=off. I'm really stumped. Andre On Sunday 08 August 2004 06:07 am, Josh Acecool M wrote: Did you check the phpinfo on each server, make sure your server settings are same as local? Andre Dubuc [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I have re-written a very basic website to use sessions (switching to https) for login to special areas of a site. After testing the site thoroughly locally, I uploaded the whole shebang to a unix server that runs Apache 1.3.x + PHP 4.3.4 + mysql. Almost all code broke - sessions would load, but almost every page was so messed up that -- well, I'm flabbergasted! I'm wondering, after reading a few threads on my local config whether the problem might lie with the Apache2 server I use locally (Mandrake special with Extranet). I also use an older version of PHP 4.3.1. I've examined both configs for differences, but can see nothing that would account for such an extremely messed up site. It loads locally beautifully (and all admin pages work) in Opera, Galeon, Mozilla, + Konqueror. Loads with errors to mysql db in all others but Konqueror which does not even display the opening page (yet I can view source). Maybe this isn't the forum to ask -- but seeing that all db access is through PHP -- I wonder whether anyone can point where i can start looking for the culprit(s). Any ideas, suggestions, or advice will be greatly appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Local version works - production breaks
On Saturday 07 August 2004 09:10 pm, you wrote: On Sat, 2004-08-07 at 17:55, Andre Dubuc wrote: Hi, I have re-written a very basic website to use sessions (switching to https) for login to special areas of a site. After testing the site thoroughly locally, I uploaded the whole shebang to a unix server that runs Apache 1.3.x + PHP 4.3.4 + mysql. Almost all code broke - sessions would load, but almost every page was so messed up that -- well, I'm flabbergasted! I'm wondering, after reading a few threads on my local config whether the problem might lie with the Apache2 server I use locally (Mandrake special with Extranet). I also use an older version of PHP 4.3.1. I've examined both configs for differences, but can see nothing that would account for such an extremely messed up site. It loads locally beautifully (and all admin pages work) in Opera, Galeon, Mozilla, + Konqueror. Loads with errors to mysql db in all others but Konqueror which does not even display the opening page (yet I can view source). Maybe this isn't the forum to ask -- but seeing that all db access is through PHP -- I wonder whether anyone can point where i can start looking for the culprit(s). Any ideas, suggestions, or advice will be greatly appreciated. Tia, Andre It's very doubtful that it's from Apache 2. Somethings that you might want to consider. Do you have all the libraries that you are using on your local development machine on the production machine? Are your includes paths pointed to the proper directories? Did you use ? instead of ?php (tsk tsk) ? Good luck. :-) -Robby That's what I thought. But the differences are glaring. Seems like none of the code wants to work. Navigation is a nightmare: header(location:...); usually brings an error message: function so and so -- include(xxx.php); has already been declared -- cannot redeclare (yet locally - absolutely no problem!) ?? Oh, what a nightmare. I can handle parsing errors, and general messups -- but when the whole site works without a glitch locally . . . . Also, mysql complains bitterly about a non-existent user (it's already an open and persistent connection, has given data previously -- go figure) -- it's unbelievable! And I have an existing site, developed using almost the same code + 340++ files working seamlessly. The libraries appear to be the same, however, I did notice a reference to /usr/lib/pear. include paths point correctly, and I faithfully use ?php ?. Sigh -- what a mess! Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Local version works - production breaks
On Saturday 07 August 2004 10:11 pm, Robby Russell wrote: On Sat, 2004-08-07 at 19:00, Ed Lazor wrote: It could be that you have local error reporting set to none. It could also be that you're using full paths when referencing files which then breaks when moving files to a new server. Basically, there's a lot of possibilities and I'm not going to have much luck helping unless you include error messages. My guess is that resolving a few errors will address a core problem and everything will start working. -Ed Yes, it's very possible that he isn't getting errors locally because his errors aren't on. Andre, You might check your error settings on your local server. You might even consider upgrading php on your local server to the same version and debugging. -Robby -- /*** * Robby Russell | Owner.Developer.Geek * PLANET ARGON | www.planetargon.com * Portland, OR | [EMAIL PROTECTED] * 503.351.4730 | blog.planetargon.com * PHP/PostgreSQL Hosting Development / Robby, I just enabled log_errors locally. No errors (as I thought). Since I am hacking a previously written site, the problem seems to arise most when accessing his pre-built functions across pages. For instance, he uses a 'cards.php' to store all display functions -- showleft() -- showcentre() , as well as the connect() function. Since its a persistent connection -- he opens the db once, then performs various queries in it. However, since 'cards.php' has already been called once by a page that might require both showleft() and showcentre() -- it barfs and says that it cannot 'redeclare' the showleft() function that has already been declared?? That is really some weird -- particularly when it works so well (as expected) locally - and also since I'm not 'redeclaring' but calling it for use! I cannot fathom why the production site would give this error. Perhaps I need to do absolute paths for all headers? But it doesn't make sense that a function cannot be called many times -- declaring it once, yes, but calling its use?? If that were the case, then one might as well write it out longhand for each use, and forget the concept of 'functions'. I think I should look at the error logs for the site -- maybe they will clue me in where I should look. Thanks, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] script error
Maybe unquote 'posts' -- I would write: $query = INSERT INTO posts ( `post_id` , `post_title` , `post_date` , .. On Monday 02 August 2004 06:49 am, me2resh wrote: thanks for your help i did that and here is the error message returned You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ''posts' ( `post_id` , `post_title` , `post_date` , `post_author how can i fix it ? ---Original Message--- From: John Holmes Date: 08/02/04 13:45:22 To: me2resh Cc: [EMAIL PROTECTED] Subject: Re: [PHP] script error $query = insert into 'posts' ( `post_id` , `post_title` , `post_date` , `post_author` , `post_content` , `m_cat_id` , `s_cat_id` , `post_pic`) values (\'\', \'$post_title, \'$post_title, \'$post_author, \'$post_content, \'\', \'\', \'subject.gif\' ); mysql_query($query); Change that last line to mysql_query($query) or die(mysql_error()); and run the script again. If you can't figure it out, post back with the error message and what troubleshooting you've done. -- John Holmes php|architect - The magazine for PHP professionals - http://www.phparch.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
[PHP] Variables not passed to next page
Hi, I have attempted to post variables from a simple page: edit-news.php to edit-news-x.php, then load them into a session for re-use -- I use output buffering. They do not pass. The code: [edit-news] ?php session_start(); ob_start(); ? $news = A few paragraphs; print input type='text' name='news'; print input type='submit' name='submit' value='Submit Changes'; ? [edit-news-x] ?php session_start(); ob_start(); ? ... $_SESSION['news'] = $_POST['news'] session_write_close(); ... ? [submit-news] ?php session_start(); ob_start(); ? ... print {$_SESSION['news']}; //outputs blank ... ? Now, I have used similar code on the same development machine for a very functional postgresql db website with no problems. The only diff is the mysql db. PHP version: 4.3.0. This particular development website is exhibiting weird behaviour: sometimes the code works, no probs, reload, and previously functional code falls apart. Any clues what I might be overlooking here -- why these variables do not pass? I'm stumped. (Could it be that both mysql/psql servers are competing against each other?) Help? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Variables not passed to next page
On Saturday 31 July 2004 02:12 pm, Jason Wong wrote: On Sunday 01 August 2004 01:40, Andre Dubuc wrote: I have attempted to post variables from a simple page: edit-news.php to edit-news-x.php, then load them into a session for re-use -- I use output buffering. They do not pass. The code: [edit-news] ?php session_start(); ob_start(); ? $news = A few paragraphs; print input type='text' name='news'; print input type='submit' name='submit' value='Submit Changes'; ? Do you actually have form tags? And with the appropriate method? $_SESSION['news'] = $_POST['news'] What does print_r($_POST) show? -- 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 -- /* I don't deserve this award, but I have arthritis and I don't deserve that either. -- Jack Benny */ Hi Jason, Yes the first page has the appropriate form tags: {edit-news.php] form action=edit-news-x.php method=post . . . /form The second and third pages [edit-news-x.php/ edit-submit.php] are pure php (a pass-through page) -- I wasn't aware they needed these tags as well. Hmm . . . that might explain why they weren't passed -- I must be getting old : . . . Thanks -- I've stared at these pages way too long. Also, it's not my code, but I'm patching new stuff into working code - oh ugh! Thanks, I'll try adding the tags. Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Cannot send session cookie
Hi Michael, session_start(); must be the very first line of code on the page, with no whitespaces trailing, else you'll get the 'header already sent' message: ?php session_start(); ? Hth, Andre On Monday 12 July 2004 10:40 am, Michael Purdy wrote: Folks I am a new to php. I am currently learning about session handling and would appreciate some assistance with the following: I am using php 4.3.7 and I am using the default values in the php.ini for session.use_cookies = 1 session.cache_limiter = nocache When experimenting with a few simple lines of code script language='php' This is line 14 session_start(); /script I get the following errors: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at e:\http\cgi\a.php:14) in e:\http\cgi\a.php on line 15 Can anyone offer me a insight on the reason for the error. Mike -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] user tracking
Hi Chrsitian, If you're looking fro a web or static stats package, IMHO none better than: http://awstats.sourceforge.net/ (I've used other packages, but this is the most flexible.) Hth, Andre On Tuesday 06 July 2004 07:15 am, Christian Calloway wrote: Hey everybody, I am looking for some type of user tracking/stat collecting package. I am sure there's a million; any recommendations? We have some specific needs as well, so mostly likely I will be have to make some code changes. So the simpler package the better. Christian -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Header or includes for one-level up access?
Orginally when I designed my site, I put the db access file, conn.php, in the webarea - where all files reside. After reading a recent thread, I realize that this may not be too secure. Therefore, I would like to shove conn.php one level above the webarea. However, I don't feel like re-writng 300+ files with the new db access info, so I thought a simple re-direct page might do the trick. I've tried three methods: the header approach header(location: ../conn-up.php); an absolute header: header(location: /vhome/conn-up.php); and an include approach: include(../conn-up.php); /* Db file access (conn.php) -- all pages presently refer or call this file */ ?php session_start(); ob_start(); ? ?php /* $db = pg_connect(dbname=big user=me password=pwd); old string */ header(location: /vhome/site/conn-up.php); // tried 3 approaches above ? /* New db access (conn-up.php) - now located one level above webpages */ ?php session_start(); ob_start(); ? ?php $db = pg_connect(dbname=big user=me password=pwd); ? All three approaches will not allow db access. I'm stumped. Is it possible to do this, and will this protect the db password any better than if it stays in the webarea? Any help, guidance, or ideas most welcome. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Header or includes for one-level up access? [SOLVED]
On Friday 02 July 2004 09:16 am, Jordi Canals wrote: Andre Dubuc wrote: I thought a simple re-direct page might do the trick. I've tried three methods: the header approach header(location: ../conn-up.php); an absolute header: header(location: /vhome/conn-up.php); and an include approach: include(../conn-up.php); Te header methods will not work. You need to access directly the filesystem in order to include a file. Cannot do it by URL. The third aproach perhaps could work, not sure. But I would test to things (I assume conn.php is on your site root) : 1. Check the user running the web server hsa permisions to read on the directory the file is located. 2. Try an absolute path to the file. Perhaps it will not permit portability, but for test purposes could help. On conn.php you could try: include(/vhome/conn-up.php); If it does not work, problably is a permissions problem. 3. For portability, and when you have been able to include the file as said in point 2. You could do in conn.php something like: $conn_dir = dirname(dirname(__FILE__)); // Gives parent dir include($conn_dir . 'conn-up.php'); 4. Could set the path to de directory including the file with set_include_path(); and then include just by name: $mypath = get_include_path() . PATH_SEPARATOR . /vhome; set_include_path($mypath); Hope this can help to investigate a bit more on your problem. Regards, Jordi Hi Jordi, Thanks for the advice! I tried include(/vhome/conn-up.php); works like a charm! Funny I never thought of giving the absolute path for the include . . . sigh! Regards, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Sort a text string by last word before separator
Thanks Torben, I've been messing about with code all afternoon, and my mind is blitzed. Didn't think it was possible since there was no way I could access the first name part (after I accessed the surname) since it had no delimiter except spaces. Managed to get the surname in a sorted array, but couldn't manage to merge the first names. I'll try this code -- hope it works, and get back to you! Thanks again! Andre On Thursday 24 June 2004 11:21 pm, Lars Torben Wilson wrote: Andre Dubuc wrote: Given a text string: $OK = Joe Blow, William Howard Anser, Hannie Jansen, etc, etc,; [snip] How would I get this 'before_last' function to iterate through the initial string, so I could build a sorted list with both first and last names, sorted by last name? I can't seem to get a proper 'foreach' statement to work, nor a 'while' statement. There are few different ways. Here's one: --- function splitSortNames($namePartSeparator, $nameSeparator, $nameString) { preg_match_all('/(\w+)((\s(\w+)\s)*(\s?(\w+)))*/', $nameString, $tmp_names, PREG_SET_ORDER); $names = array(); foreach ($tmp_names as $i = $name) { $tmp = array(); if (!empty($name[6])) $tmp[1] = $name[6]; if (!empty($name[1])) $tmp[2] = $name[1]; if (!empty($name[4])) { $tmp[2] .= ' ' . $name[4]; } $names[$name[0]] = join(', ', $tmp); } asort($names); $names = array_keys($names); return $names; } $names = splitSortNames(' ', ', ', $OK); print_r($names); --- To check out a few other ideas along with a short (likely inaccurate) speed test, check out http://www.thebuttlesschaps.com/sortByLast.html (there is a 'View Source' link at the bottom of the page). This code returns the names in the format in which they are given. You can speed it up a bit by having it return the names in 'lastname, firstname' format. For this, change $names[$name[0]] = join(', ', $tmp); to $names[$i] = join(', ', $tmp); and remove the lines: asort($names); $names = array_keys($names); I'm really confused. I've read almost every entry on arrays/strings and searched code snippets. Almost all focus on one element arrays such apple, orange, peach rather than 2 or more elements such as fancy cars, big trucks, fast dangerous motorcycles, Is it even possible to accomplish this type sort on a string? Any advice, pointers, or help will be greatly appreciated, Tia, Andre Hopefully the code above will give you some aid--and you can probably improve on that regexp in preg_match_all(). The other 2 ways on the site have totally different methods, and different strengths and weaknesses. Maybe you can turn one of them into something useful to you. Hope this helps, Torben -- Torben Wilson [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sorting a large text string alphabetically
I'm trying to sort alphabetically a large text string filled with first and last names separated by ,That would seem to be a simple task, but sort($txt) does not seem to work even when $txt is an array. The code : ?php $OK= Joe Blow, Sam Hill, Henry Forget, etc, etc; $_SESSION['txt'] = $OK; session_write_close(); $txt = $_SESSION['txt']; $names = explode(, , $txt); foreach($names as $key = $names){ sort($names); //line 235 reset($names); // line 236 while (list($key, $val) = each($names)) { //line 237 } } $sorted = implode(, , $names); return($sorted); ? I assumed this would work, but I get error messages (for every value in the txt array) stating that '$txt' is not an array -- even though it shows up as Array(Joe Blow, Sam Hill, Henry Forget, etc, etc). I'm totally confused here. As you may gather, arrays are not one of my 'strong' points : Warning: sort() expects parameter 1 to be array, string given in /var/www/html/list.php on line 235 Warning: reset() [function.reset]: Passed variable is not an array or object in /var/www/html/list.php on line 236 Warning: Variable passed to each() is not an array or object in /var/www/html/list.php on line 237 What am I doing wrong? Any help greatly appreciated, Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https
Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] http to https
Well, I'm no php-guru, that's for sure, but if you are trying to call: https://www.tgwedding.com/payment6.php from http://www.tgwedding.com/payment6.php might be where the problem lies. You might need to do a 'refresh' since What is strange is when I go back on my browser and resubmit, it correctly sends it to the https location and all is well. What I have done a s a clutz-hack is to create an additional page for the re-direct, which then sends it back to the page in question. (I used that for 'cookie' detection/browser ident as well on my opening pages.) I suppose you might get away with a Meta Refresh but I'm not too clear whetehr you can accomplish that for the same page . . Aside from that idea . . . . Hth, Andre On Thursday 17 June 2004 08:31 pm, you wrote: Yeah, I'm assuming it's set. I have an installed ssl cert from a CA and have successfully run other https scripts (by typing in the URL) on the server. I check phpinfo(), http://www.tgwedding.com/tgwedding/phpinfo.php php, http, ftp, https, ftps, compress.bzip2, compress.zlib I searched php.ini for ssl and https and didn't find anything though -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:26 PM To: Ryan Schefke Subject: Re: [PHP] http to https Just a thought - is https on the server set? (Check your php.ini) On Thursday 17 June 2004 08:20 pm, Ryan Schefke wrote: Hi Andre, Thanks for responding. I'm not using sessions, just cookies. I used your recommendation in the code below (which gets executed if the submit button is pushed. It still sends it to http://www.tgwedding.com/payment6.php; instead of https://www.tgwedding.com/payment6.php; Any advice please? if (isset($submit)) { if ($radiobutton == 1) { $value=$validcoupon; } else { $value=0; } $query_insertcoupon = UPDATE sitepayment SET couponcode='$value' WHERE customerID='$CID'; $result_insertcoupon = mysql_query ($query_insertcoupon); // run the query if ($_SERVER['HTTPS'] != on){ header(Location: https://www.tgwedding.com/payment6.php;); exit;} // $redirect = https://www.tgwedding.com/payment6.php;; //header (Location: $redirect); } = -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED] Sent: Thursday, June 17, 2004 8:01 PM To: Ryan Schefke; [EMAIL PROTECTED] Subject: Re: [PHP] http to https Hi Ryan, I encountered all sorts of problems attempting to do the same (especially with AOL, Yahoo, etc click-throughs). I finally resolved the problem by calling https on the page itself (which is listed then as http) like so at the top (after my session_start(); of course: ?php if ($_SERVER['HTTPS'] != on){ header(Location: https://www.your_site.com.php;); exit;} ? Hth, Andre On Thursday 17 June 2004 07:27 pm, Ryan Schefke wrote: I'm getting some strange behavior when trying to go from http to an https script. After clicking a form submit button the script will execute the two lines below. It does this and sends it to the correct page without the https, only http. What is strange is when I go back on my browswer and resubmit, it correctly sends it to the https location and all is well. $redirect = https://www.tgwedding.com/payment6.php;; header (Location: $redirect); What am I doing wrong? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Eliminating all lowercase words
Hi folks! I need a function that will examine input for lowercase words. In the processing of that input, I would like to eliminate them (so as to keep all uppercase words). I prototyped a reasonable function using the 'Find: using regex feature' in KWrite, so it works there. $search (([^\bA-Z][a-z]\b*?)*?)); $replace = ; $add = preg_replace($search, $replace, $add); hWhen I tried it, it eliminated all lowercase words, and in the case of the single upper case word, 'Bellingham', it retained only the capital 'B' -- arrgh! Is there access to the internals of ucase function so I can find out how to do this, or is there any easier way? Any ideas, suggestions, and even admonitions would be very welcome! Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Limiting repetitive file access
On Sunday 16 November 2003 06:40 am, Manuel Lemos wrote: Hello, On 11/16/2003 02:52 AM, Andre Dubuc wrote: Recently, a 'user' attempted to access a restricted area of my site repetitively (spanning five hours) entering the same url repetitively [probably by script]. A massive log file was generated. I would like to ban such behavior by limiting the number of successive 'get's a user can do (say 4 attempts) before an appropriate action is taken.. As a temporary measure (until I can figure a better way) the url in question was disabled. What I'd like to do, on a per-file basis using $_SESSION, is a combination of ipaddress perhaps with a counter that records the number of times that file was accessed, and limit the number of successive 'get's that can be done before the file is no longer accessible. This solutions will not avoid your problem. Sometimes I have that problem because some users of my site think they can use site sucking programs to get all its content. What was done is to have a script monitoring the Web server logs and if the same user of the same IP makes an excessive amount of accesses in a short period, add it to the list of denied addresses for a while. This way, the Web server will not even spare resources for abusing users. Since you use .haccess based permissions, you can just update that file regularly. I do not have that script quite ready for release now, but if there is interest, I can release it later as a part of this class that already provides log watching services: http://www.phpclasses.org/logwatcher -- Regards, Manuel Lemos Free ready to use OOP components written in PHP http://www.phpclasses.org/ Thanks Manuel, Actually I like your idea -- it is much better. However, I do not use .htaccess permissions -- When I tried uploading the .htaccess file into the docroot area of my site, and it froze the works! Basically the idea of using the webaccess log file - searching for repetitive usage over a defined period of time (in my case it was every second!) -- sounds good. Now, I just have to determine whether I can use .htaccess with my IP -- they have very restrictive rules. Thanks again. Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sessions and AOL?
On Sunday 16 November 2003 01:54 pm, R. Van Tassel wrote: Hi everyone. I have a problem with a website that I don't understand. It seems that people using AOL can't see certain sections of this website. It is a directory section where a drop-down menu exists, you select the section you want to see and the page reloads with the information. The only problem is that AOL users don't see any content. The page comes up blank where the information should appear! I use sessions to see if a user is new to the site or if they've already been at the site by visiting a previous page. A session starts at the top of every page and the session id is stored in a mysql database. Every time someone visits a page a search is done to see if the session id exists. If it does it stores the page they are currently on as a last page. If it doesn't exist a new record is created storing the session id and some other stuff. Has anyone had problems with AOL and sessions before? Anyone have any suggestions on what I can do? It's a death wish for AOL users not to see this site as it's a community website with a lot of people using AOL. Thanks, Roy Hi Roy, Yes I had a problem with AOL -- specifically if your page is 'https' it won't load. Furthermore, if you're using sessions, it has been my experience that the user must have 'Cookies Enabled'. I wrote a little checker script to see if the user has them enabled on the opening page -- and informs them they are necessary. Don't know whether this is much help, but it's a start. Regards, Andr -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Limiting repetitive file access
On Sunday 16 November 2003 10:45 pm, David Otton wrote: On Sat, 15 Nov 2003 23:52:31 -0500, you wrote: Recently, a 'user' attempted to access a restricted area of my site repetitively (spanning five hours) entering the same url repetitively [probably by script]. A massive log file was generated. I would like to ban such behavior by limiting the number of successive 'get's a user can do (say 4 attempts) before an appropriate action is taken.. As a temporary measure (until I can figure a better way) the url in question was disabled. What I'd like to do, on a per-file basis using $_SESSION, is a combination of ipaddress perhaps with a counter that records the number of times that file was accessed, and limit the number of successive 'get's that can be done before the file is no longer accessible. Sessions won't work unless the script at the other end is co-operating by holding state for you, which is unlikely. Blocking is never an ideal solution - automated processing can catch innocent users, a DDoS can knock most sites over, IP bans can be got around by abusing open proxies, and assholes seem to have infinite free time. It's rarely worth getting into an arms race with them because ultimately, if someone wants your machine off the net badly enough, there's nothing you can do about it. Having said that, the earlier in the chain you block malicious traffic the better. ISP router firewall web server script. I think maybe a script that adds a firewall rule when triggered would be effective in your case (a quick Google will probably find something like this). Just bear in mind that it's not foolproof. You could also try blocking if a referer: is lacking... but again it's not really reliable. Thanks David, After reading about the options that I have at my disposal, I'm thinking that one bad 'user' in a year's operation ain't too shoddy. Perhaps the best line of attack to this problem, is to do nothing at all. Aside from filling up my webaccess.log, he didn't stop the flow of traffic, nor did he get anywhere. I seemed to do more damage than he! -- I just hosed that file good . . . sigh . . . It's been a great weekend - began with a 44 hour power outage, both phone lines dead, then I hosed my acccess file, and finished it off by taking out my developmental db -- not bad, huh? (Perhaps I need some sleep??) Tomorrow, I'll have a nice chat with my restrictive IP and figure out what I am allowed to do . . . Personally I like the firewall trigger -- put 'em out of business early! Thanks again for giving me the 'straight-goods'! Regards, andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Limiting repetitive file access
Hi, Recently, a 'user' attempted to access a restricted area of my site repetitively (spanning five hours) entering the same url repetitively [probably by script]. A massive log file was generated. I would like to ban such behavior by limiting the number of successive 'get's a user can do (say 4 attempts) before an appropriate action is taken.. As a temporary measure (until I can figure a better way) the url in question was disabled. What I'd like to do, on a per-file basis using $_SESSION, is a combination of ipaddress perhaps with a counter that records the number of times that file was accessed, and limit the number of successive 'get's that can be done before the file is no longer accessible. In a script that checks for bad words, I have used: ?php if ($_SESSION['text'] = badwords){ $_SESSION['attempt'] = 1; header(location: unwanted.php); } [In the file unwanted.php I checked for $_SESSION['attempt'] = 1 and booted if the condition was met] However, using this approach I cannot augment this number without resorting to a file get/put schema. Is there a way around this? Is there a better approach? I've tried .htaccess but the user in question has a dynamic address. Any help appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Form Validation: Surnames with Apostrophe
Hi, I made a little function that will allow allow alphabetical character with apostrophe then more alphabetical characters then hyphen then more alphabetical characters (D'Agostino-Wong). The downside is that it will automatically cap von Hollander-Smith function ucase_words($txt){ if(ereg(['-], $txt)){ $txt = strtolower($txt); $boom = explode(', $txt); foreach($boom as $key = $txt){ $boom[$key] = ucfirst($txt); } $booms = implode(', $boom); $boomer = explode(-, $booms); foreach($boomer as $key = $booms){ $boomer[$key] = ucfirst($booms); } $boomers = implode(-, $boomer); return($boomers); } else { $txt = strtolower($txt); $txt = ucwords($txt); return($txt); } } I suppose you could add an if-then test for the odd lowercase. It seems to work well and covers most of the scenarios you listed. [Btw, it was my 'very-first-function' so go easy on me! :] Just my $0.01 worth, Andre On Thursday 27 March 2003 06:49 pm, [EMAIL PROTECTED] wrote: Thank you. Strip_slashes was the key. The following Regular Expression: (preg_match(/^[[:alpha:]]{2,}[-]?[[:alpha:]]+$|^[[:alpha:]]{2,}[[:space:]] ?[[:alpha:]]+$|^[[:alpha:]]{1,1}[']?[[:alpha:]]+$/, $Last_Name) allows only alphabetical characters (e.g., Smith), alphabetical characters with whitespace then more alphabetical characters (e.g., Au Yong), alphabetical character with apostrophe then more alphabetical characters (e.g., O'Neal), or alphabetical characters with hyphen then more alphabetical characters (e.g., Zeta-Jones). It does not, however, allow alphabetical character with apostrophe then more alphabetical characters then hyphen then more alphabetical characters (D'Agostino-Wong), alphabetical characters with whitespace then more alphabetical characters then hyphen then more alphabetical characters (e.g., von Hollander-Smith), or alphabetical characters with whitespace then more alphabetical characters then hyphen then alphabetical character then apostrophe then more alphabetical characters (e.g, Van Horn-O'Reilly) or anything else anyone may type in or not type in. On Thu, 27 Mar 2003, Jennifer Goodie wrote: This is what I use $LastName = stripslashes($_POST['LastName']); preg_match(/^\w+[\s\-\'\.\w]*$/i, $LastName) This is less strict than yours as I'm allowing whitespace, periods, underscores, hyphens, apostrophes, and numbers because I don't so much care if someone tacks on Jr. or something like that to the end of their name. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 3:05 PM To: Jennifer Goodie Cc: John W. Holmes; 'John Nichel'; [EMAIL PROTECTED] Subject: RE: [PHP] Form Validation: Surnames with Apostrophe When I do that: (preg_match(/^[a-z](\\')?[a-z-]+$/i,$_POST[Last_Name]) it won't allow O'Reilly and seems to not allow anything at all On Thu, 27 Mar 2003, Jennifer Goodie wrote: That is because it is not saying that is all that can be in the string. The 'Re' matches that pattern. Put a ^ at the beginning to signify it must start with the pattern and a $ at the end to signify it must end there. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Thursday, March 27, 2003 1:19 PM To: John W. Holmes Cc: 'John Nichel'; [EMAIL PROTECTED] Subject: RE: [PHP] Form Validation: Surnames with Apostrophe I just tried your regexp: (preg_match(/[a-z](\\')?[a-z-]+/i,$_POST[Last_Name]) and it allows the following: O' [EMAIL PROTECTED] It seems to allow any number of characters and spaces between the O' and Re On Wed, 12 Mar 2003, John W. Holmes wrote: preg_match ( /[A-Za-z-']+/, $_POST['Last_Name'] ); [EMAIL PROTECTED] wrote: I have been trying to validate a form field Last_Name and have been unable to find a regexp to account for the apostrophe (e.g., O'Reilly). The following statement: preg_match('/^[[:alpha:]]+[-]?[[:alpha:]]+$/', $_POST[Last_Name]) accepts hyphenated surnames and I have tried escaping the apostrophe: [\\'] and [\\\'] to no avail. Any idea what I am doing wrong? that could work but the user may now submit one or more apostrophes as the Last Name. Watch out for magic_quotes. If O'Reilly is submitted, unless you stripslash() it, you're validating against O\'Relly. preg_match(/[a-z](\\')?[a-z-]+/i,$_POST['Last_Name']) ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today.
[PHP] Eliminating space between HR and Image
Hi, I've added an animated gif in the banner area of my site, and just above it, a horizontal rule to give added emphasis. The problem is, no matter what I do, I cannot get rid of an extra space that appears between the two. Is this a natural function? Is there some way of eliminating the space? The code: ?php . . . . div class=banner hr align=left size=8 width=1000 style=background: #9a3e2b; img src=icr.gif height=100 width=1000 /div . . . ? CSS code: div.banner { position: absolute; top: 0px; left: 1%; } I will be grateful for any ideas or advice on how to fix this. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Eliminating space between HR and Image
Thanks Michiel, After sending the message, I realized that it was an html question -- I've been so absorbed with coding, it all looks the same after a while. My apologies to the list. Thanks for the suggestion. I think it'll work. Otherwise, I'll leave it as is. Thanks for taking the trouble to answer. Reagrds and blessings, Andre On Wednesday 19 March 2003 07:31 pm, you wrote: this is an HTML-problem, not php..but anyway i have no clue why the extra space would appear, but I'd try to add absolute positiong to the HR and IMAGE as well, that should solve the problem like: style type=text/css !-- hr { position: absolute; top: 0px; } img { position: absolute; top: 8px; } -- /style grace michiel Andre Dubuc [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I've added an animated gif in the banner area of my site, and just above it, a horizontal rule to give added emphasis. The problem is, no matter what I do, I cannot get rid of an extra space that appears between the two. Is this a natural function? Is there some way of eliminating the space? The code: ?php . . . . div class=banner hr align=left size=8 width=1000 style=background: #9a3e2b; img src=icr.gif height=100 width=1000 /div . . . ? CSS code: div.banner { position: absolute; top: 0px; left: 1%; } I will be grateful for any ideas or advice on how to fix this. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Eliminating space between HR and Image
Thanks Richard, The obvious escaped me. Regards, Andre On Wednesday 19 March 2003 07:39 pm, you wrote: Here is your code: First, make a one pixel png the color you want your HR img src=images/color.png width=100% height=1br img src=images/yourbanner.gif width=468 height=60 Et, Voila! Quoting Michiel van Heusden [EMAIL PROTECTED]: ### this is an HTML-problem, not php..but anyway ### ### i have no clue why the extra space would appear, ### but I'd try to add absolute positiong to the HR and IMAGE as well, that ### should solve the problem ### ### like: ### style type=text/css ### !-- ### hr { ### position: absolute; ### top: 0px; ### } ### img { ### position: absolute; ### top: 8px; ### } ### -- ### /style ### ### grace ### michiel ### ### ### Andre Dubuc [EMAIL PROTECTED] wrote in message ### news:[EMAIL PROTECTED] ### Hi, ### ### I've added an animated gif in the banner area of my site, and just ### above ### it, ### a horizontal rule to give added emphasis. The problem is, no matter what ### I ### do, I cannot get rid of an extra space that appears between the two. Is ### this ### a natural function? Is there some way of eliminating the space? ### ### The code: ### ### ?php ### . . . . ### div class=banner ### hr align=left size=8 width=1000 style=background: #9a3e2b; ### img src=icr.gif height=100 width=1000 ### /div ### . . . ### ? ### ### CSS code: ### ### div.banner { ### position: absolute; ### top: 0px; ### left: 1%; ### } ### ### I will be grateful for any ideas or advice on how to fix this. ### 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
Re: [PHP] strange behaviour with login page
Hi Steve, Just out of curiosity, when you mention implement a user authentication process where users can click on an external link to my site are you using the https protocol? I had similar bizarre behavior with IE using a Confirmation Required' script. Worked great at home (localhost), with apache, linux, et al, but with IE sometimes it worked, most often not. I finally traced the route of my problem to the https protocol. I found this quite by mistake -- AOL, Hotmail, and Yahoo users were not being redirected to my site. Almost exactly the same problem occurred as you describe: if I clicked the link twice, it sometimes worked. (Btw, I lost a lot of registrants because of this problem. I finally dumped the whole thing, and now, users once registered, go immediately to specified areas of the site. Apparently, with AOL, Yahoo, Hotmail users the https protocol is 'optional' or 'premium' or somesuch idiocy!) If you do find the root of your problem, would you be so kind as to drop me an email with your resolution -- I'd like to get my little script to work. Hth, Andre On Sunday 09 March 2003 06:18 pm, you wrote: I have seen this as well. Try using netscape or an earlier version of IE and you will probably find it will work without issue. I posted about this many moons ago and unfortunately didn't get a solution. I can't recall the specifics of when it was doing it (and if I remember correctly, sometimes it would work and sometimes it wouldn't - in the context of a members area where sessions are used - some pages worked, others didn't - same sessions method), but on some servers, we had no issues (exactly the same versions of linux, php etc) and others this happens. There must have been some sort of variation at our end, but we couldn't see it. We upgraded to PHP Version 4.2.3, and this fixed it. Sorry I can't give you any more info. At the time I was having the problem, I was under a tight schedule and didn't have time to track down possible causes. As I said, the upgrade helped us (also fixed a few mysql query caching problems we were having too - caused a few GD ones though). My guess is that its some sort of cookies problem with windows IE 6 (as that was the only browser I saw the problem on). Best Regards Bob Irwin Server Admin Web Programmer Planet Netcom If anyone has come across a similar problem to the one described below, and has a solution I'd be really grateful if you can help me out. I'm trying to implement a user authentication process where users can click on an external link to my site. If they're not logged in they get presented with a login dialog. Once they log in they're redirected onwards to the page they initially wanted to visit. The system I have in place at the moment handles authentication using sessions. The bizarre thing is, while everything seems to work on my home pc (windows iis web server, php 4.2.1), on the host server (linux, apache, php 4.1.2) I get the login screen twice before I get redirected. My hunch is that it's something to do with when session variable become available after registering them. (I'm using the sesssion management functions built in to php 4). TIA Steve -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Tryng To Prevent Caching on IE 5-6.0
Hi Kurst, I don't know whether what I'm about to pass on will be of any help, or close to solving your problem, but perhaps the idea might lead you somewhere. I was faced with a problem: As my index page loaded, I had to test to see whether 'cookies' were enabled, without resorting to javascript. The reason I had to check: without cookies, sessions wouldn't work properly. The user would not be aware of anything amiss, until he accessed something from the db -- then all forms were messed up. The solution I hit upon was to create a test schema that relied on two additional 'pages' been called. On the 'index' page, the main one I wanted displayed, (and the one called for by url), has a simple script at the beginning. I have found that the 'index' page is not cached since it must be processed through this two-page filter on every encounter with the url -- else it is re-directed. Maybe it will work for you, or you could adapt it to your needs?? (I'm only a one-year 'php-veteran from the trenches' :) Code follows: Index page: ?php session_start(); ob_start(); ? ?php if ($_SESSION['test'] == ) { $_SESSION['test'] = 1; header(location: index-load.php); } ? Index-load page: ?php session_start(); ob_start(); ? ?php if ($_SESSION['test'] == 1) { $_SESSION['test'] = 1; session_write_close(); header(location: index.php); } else { header(location: index-message.php); } ? Index-message page: ?php session_start(); ob_start(); ? ?php switch ($_SESSION['test']): case 1: header(location: index.php) break; case $_SESSION['test'] = 1; /* you can put whatever message, commands in here */ break; endswitch; ? Hth, Andre On Saturday 08 March 2003 03:03 am, you wrote: -Original Message- From: Bryan Lipscy [mailto:[EMAIL PROTECTED] Sent: Saturday, March 08, 2003 1:38 AM To: 'Kurst'; [EMAIL PROTECTED] Subject: RE: [PHP] Tryng To Prevent Caching on IE 5-6.0 Try: header(Cache-control: private); It's a very good suggestion and I thank you for it but IE is still caching the data :(. For those people who are wondering - I used almost ever variation of that cache control in the header That includes: The cache-control as the only command, added to my huge cache-control statement, and put on it's own line. Anybody else have any suggestions or different ways? Thanks for the advice :) I appreciate it! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Printing an image - insights needed!
Hi, I have a very annoying little problem that someone might have an insight as to its cause. The opening page on my site has two small jpeg pixs (3.9KB) that display properly for any user. I have another page, with exactly the same code, and same jpeg pixs that displays properly as well. ?php . . . . /* Opening page graphic */ print aimg src='does_not_print_but_displays.jpeg' width='100' height='120' alt='What Gives?'/a; ? ** ?php . . . . /* Second page graphic - not linked to Opening page */ print aimg src='prints_and_displays_nicely.jpeg' width='100' height='120' alt='Prints nicely'/a; ? However, when I want to print a copy of these pages, while on the web, the first one (the opening page) does not print the jpeg pixs, whereas the second page does. The only difference I can see between the two is that the second page has img src and alt in caps (but that shouldn't make any difference). I've tried Opera, Konqueror, Galeon, and Mozilla with the same effect. Even tried changing to .jpg but no difference. Any ideas what might be messing up the print function? Btw, in Konqueror it displays an empty white box, while in Opera no box at all. Any ideas, suggestions, or where to look would be greatly appreciated. I'm stumped. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] IE 'Back' Button problem + SELECT dropdowns
Hi, I've managed to get Windows IE to pick up on most of my $_SESSION variables once a user clicks the 'Back' button using the following code in the base form: 'value=?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?' However, when I try this approach for a muliple SELECT dropdown box that is loaded by a 'require' statement, it doesn't pass the info. I've tried to isolate the individual components: ?php require(dobdod.fdd); if(!empty($_PST['bday'])) echo $_POST['bday']; if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; if(!empty($_POST['birth'])) echo $_POST['birth']; if(!empty($_POST['dday'])) echo $_POST['dday']; if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; if(!empty($_POST['death'])) echo $_POST['death']; ? Btw, the base form calls another form, which displays an error message. Once the 'Back' button is clicked, the base form reappears. [I've also tried putting a ?php . . . ? around each if(!empty . . .); statement above with same result.] Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, and nothing seems top work. Is it possible to pass the info back to the base form? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE 'Back' Button problem + SELECT dropdowns
On Monday 27 January 2003 11:46 am, 1LT John W. Holmes wrote: I've managed to get Windows IE to pick up on most of my $_SESSION variables once a user clicks the 'Back' button using the following code in the base form: 'value=?php if(!empty($_SESSION['rfname'])) echo $_SESSION['rfname']; ?' However, when I try this approach for a muliple SELECT dropdown box that is loaded by a 'require' statement, it doesn't pass the info. I've tried to isolate the individual components: ?php require(dobdod.fdd); if(!empty($_PST['bday'])) echo $_POST['bday']; if(!empty($_POST['bmonth'])) echo $_POST['bmonth']; if(!empty($_POST['birth'])) echo $_POST['birth']; if(!empty($_POST['dday'])) echo $_POST['dday']; if(!empty($_POST['dmonth'])) echo $_POST['dmonth']; if(!empty($_POST['death'])) echo $_POST['death']; ? Btw, the base form calls another form, which displays an error message. Once the 'Back' button is clicked, the base form reappears. [I've also tried putting a ?php . . . ? around each if(!empty . . .); statement above with same result.] Any ideas what I'm doing wrong? I've been at this one for a couple of weeks, and nothing seems top work. Is it possible to pass the info back to the base form? SELECT boxes work differently from text boxes. To set a select box to a certain value, you need to put SELECTED into the option tag, like: option value=some_value SELECTEDText Value/option So, you need to create some loop or test to see where you should put the SELECTED. For short lists, doing something like: option value=some_value ? if(isset($_SESSION['select']) $_SESSION['select'] == 'some_value') { echo SELECTED; }?Text Value/option For larger lists, it's easier to put the values into an array and make a function that loops through and test each value for where to put the SELECTED text. Hope that helps. ---John Holmes... Thanks John, Great to get your excellent advice again. I've been off-list for a few months. Never thought of doing the extra coding IN the require file! That's probably why it didn't work. I tried to pick up the values from $_POST (as above). In Linux, it works: (i.e. I can pick them up, display them, and manipulate them using the code above), but in IE something like $_POST['bday'] never shows up. Any idea why there's such a difference between OS behavior? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE 'Back' Button problem + SELECT dropdowns
Thanks John, I sort of thought that it should work. Will do as you suggest. Regards, Andre On Monday 27 January 2003 12:28 pm, John W. Holmes wrote: I tried to pick up the values from $_POST (as above). In Linux, it works: (i.e. I can pick them up, display them, and manipulate them using the code above), but in IE something like $_POST['bday'] never shows up. Any idea why there's such a difference between OS behavior? No. $_POST['bday'] should always show up, regardless of OS, if the scripts and PHP version are the same. Double check your logic. ---John W. Holmes... PHP Architect - A monthly magazine for PHP Professionals. Get your copy today. http://www.phparch.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SELECT with WHILE NOT
Hi, Using PostgreSql 7.2 + PHP I am trying to do a SELECT that will choose all records except ones that have a certain id number. I can't seem to get the syntax to work. Here's the code: SELECT * FROM rap WHERE NOT rsponsor = '{$_SESSION['sid']}' ORDER by rsname,rfname,rcountry,rcity DESC LIMIT 20; What I get is all the records including those with '{$_SESSION['sid']}' . How can I accomplish an exclusion in a table-wide search? Any help or advice will be greatly appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SELECT with WHILE NOT
Hi Sean, Before sending to the list, I had already tried your first suggestion and ended up with only the records that I wanted excluded. Your second suggestion with NOT IN works like a charm. (There wasn't much about 'NOT' in the docs, and I must have missed the 'IN' part.) Thanks for your help! Regards, Andre On Saturday 25 January 2003 07:48 pm, Sean Malloy wrote: SELECT * FROM rap WHERE rsponsor != '{$_SESSION['sid']}' ORDER by rsname,rfname,rcountry,rcity DESC LIMIT 20 SELECT * FROM rap WHERE rsponsor NOT IN ('{$_SESSION['sid']}') ORDER by rsname,rfname,rcountry,rcity DESC LIMIT 20 -Original Message- From: Andre Dubuc [mailto:[EMAIL PROTECTED]] Sent: Sunday, 26 January 2003 11:28 AM To: [EMAIL PROTECTED] Subject: [PHP] SELECT with WHILE NOT Hi, Using PostgreSql 7.2 + PHP I am trying to do a SELECT that will choose all records except ones that have a certain id number. I can't seem to get the syntax to work. Here's the code: SELECT * FROM rap WHERE NOT rsponsor = '{$_SESSION['sid']}' ORDER by rsname,rfname,rcountry,rcity DESC LIMIT 20; What I get is all the records including those with '{$_SESSION['sid']}' . How can I accomplish an exclusion in a table-wide search? Any help or advice will be greatly appreciated. Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Updating int4 field with multiple values
I would like to update an int4 column with new values appended to the end (preferably with a delimiter such as @ or a comma). With PostgreSQl 7.2, I can't seem to add the number with a delimiter (it gives me a parser error at the delimiter). For example, If I update the field 'radd' that already has number 36 in it, it does append the new number, but without any space. So, if I updated with a new number, 6, the 'radd' result would now be '366' instead of '36 6' Without the delimiter, it might be difficult to do selects on this field when I need to find a specific number within the field. (Btw, I'm using $_SESSION['rid'] . . . etc instead of $rid in the actual code.) Any ideas what I'm doing wrong? Any suggestions will be greatly appreciated. ** Simplified code: /php . . . /* for simplicity set $new= 6 $new is int4 */ $new = 6; include(dbc.php); $query = UPDATE rap SET radd = radd||', $new' WHERE rid = '12'; $result = pg_exec($db, $query); if (!$result) {print What? Can't do what you're asking me!;} if ($result) {print Record updated;} pg_close($db); . . . ? Tia, Andre -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating int4 field with multiple values
Hi Jason, So, I gather from your reply that I cannot add more digits to that integer field separated by spaces or whatever? I sort of figured I won't be able to do it, so I'm trying to get things working by changing the type to varchar() and doing it as a string. Seems to work - with glitches. An On Friday 06 December 2002 01:39 pm, you wrote: On Saturday 07 December 2002 00:56, Andre Dubuc wrote: I would like to update an int4 column with new values appended to the end (preferably with a delimiter such as @ or a comma). With PostgreSQl 7.2, I can't seem to add the number with a delimiter (it gives me a parser error at the delimiter). For example, If I update the field 'radd' that already has number 36 in it, it does append the new number, but without any space. So, if I updated with a new number, 6, the 'radd' result would now be '366' instead of '36 6' Without the delimiter, it might be difficult to do selects on this field when I need to find a specific number within the field. (Btw, I'm using $_SESSION['rid'] . . . etc instead of $rid in the actual code.) Any ideas what I'm doing wrong? Any suggestions will be greatly appreciated. Am I missing something or are you really trying to insert non-digits into an INTEGER field? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Updating int4 field with multiple values
de-ja vu (P) Pronunciation Key (du hhh) n . Foreign 1. Something unpleasantly familiar 2. 'Been-there-done-that' Don't you love it when you've set a field to a certain type, only to find out much later, after much coding, it's wrong? Thanks for the reminder. Guess it's back to Geek 1.0.1 for me. Regards, Andre On Friday 06 December 2002 03:31 pm, 1LT John W. Holmes wrote: I would like to update an int4 column with new values appended to the end (preferably with a delimiter such as @ or a comma). in·te·ger( P ) Pronunciation Key (nt-jr) n. Mathematics 1.. A member of the set of positive whole numbers 1, 2, 3,... , negative whole numbers -1, -2, -3,... , and zero {0}. 2.. A complete unit or entity. ---John Holmes... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem uploading files other than text/plain ones
Hi Wilmar, Check whether you have something similar: form action=auth-x.php method=post enctype=multipart/form-data You'll definetly need that for antything other than text/plain ones.. Here's a some code that works for me (uploading jpgs): if ($_FILES[pix][size] 0){ if ($_FILES[pix][type] == image/jpeg){ $pix_file = $_FILES[pix][name]; $pix_temp_file = $_FILES[pix][tmp_name]; $new_pix_file = new_name.jpg; if(is_uploaded_file($pix_temp_file)){ move_uploaded_file($pix_temp_file, pix/$new_pix_file); } } } Hth, Andre On Monday 02 December 2002 11:41 am, Wilmar Perez wrote: Hello guys I'm trying to do a simple task: upload files. However, when I try to upload files other than text/plain ones I get an empty $_FILES array. Is there anything I've got to modify in my php.ini file? I'm just following the expample in the php manual, the only thing different is that I process the upload task with a function: function upload_file($_POST, $_FILES) { //The same code as in the php manual return true; //If everything went ok } if (upload_file($_POST, $_FILES)) echo The file has been uploaded; else echo Sorry, try again; It works fine with text/plain files, so, am I overlooking anything here? Thanks a lot *** Wilmar Pérez Network Administrator Library System Tel: ++57(4)2105962 University of Antioquia Medellín - Colombia 2002 *** -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php