Re: [PHP] dynamic drop down
On Tue, 2005-05-31 at 22:08 -0700, Richard Lynch wrote: > On Tue, May 31, 2005 8:48 pm, Danny Brow said: > > Could someone point me to an example with code for dynamic drop downs in > > PHP? I would like to be able to have drop downs like "Select Country" > > and another drop down show the states/provinces based on the selected > > country. > > Well, the "dynamic" part of it isn't gonna be in PHP at all ; It's gonna > be JavaScript. I thought I'd have to use JS, but was hoping someone knew a way to do it with PHP. > You can Google for "JavaScript dynamic menus" to find what you want. Then > you just need to use PHP to spew out the JavaScript you want to spew out, > but that's no different than spewing out the HTML you want to spew out, > really. Tons on google, thanks, Dan. signature.asc Description: This is a digitally signed message part
Re: [PHP] Fwd: fopen for http://
fopen() most likely is not sending the same kinds of headers that an HTTP connection would send, which is what you are really checking in httpd.conf (Which might not be all that secure, come to think of it...) Anyway, you should dump out the data you test in the restricted page, and surf to it, and try to use PHP to get it, and see what is different. You might be able to "forge" the HTTP data using fsockopen/fputs/gets or, probably easier, http://php.net/curl once you figure out what data/headers need to get sent for your restricted site to respond. It's all matter of finding the restricted site's ticklish spot, you see. On Fri, May 27, 2005 1:08 pm, Jay Paulson said: > Hello all- > > I was wondering if anyone knew of a way to call a web site using fopen. > Let me tell you how things are set up and what I'm trying to do. I > can call fopen to read a site and then echo it back out. That's not a > problem. The problem I run into is when I try to go to a restricted > area of a site. > > For example, in my Apache httpd.conf file I have it set up to where I > have a directory that is only accessible from certain IP addresses, one > of which is 127. (the localhost). The script I'm running is located on > the server and the web site I'm trying to access via fopen() is on the > same server. Therefore, I'm thinking that the php script should have > access to read the site's restricted directory. For some reason it > does not have access. > > I was wondering if there was a way around this or am I just doomed to > never be able to access the directory via > fopen("http://someurl.com/somedirectory","r";); ?? > > Thanks. > Jay > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php not allowed in .htaccess
On Wed, May 25, 2005 3:01 pm, Jack Jackson said: > Hi, dumb config issue. > > > I'm putting a php_value include_path statement in an .htaccess file > >php_value include_path > ".:/home/user/public_html/dis/admin/:/home/nick/" >php_value auto_prepend_file > /home/user/public_html/dis/admin/wcsconf.php > > > and getting a 500 Server Error. Apache logs say, ".htaccess: php_value > not allowed here" > > Where can I change this behavior - is this an apache httpd.conf or > php.ini setting? Something else? For sure in httpd.conf -- as Apache is the one complaining about php_value not being allowed. Probably your AllowOverrides settings are "off"... I'm not an expert, though, and this probably now belongs on an Apache list anyway... http://apache.org -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] printf() in a variable, or alternative to printf()
http://php.net/sprintf On Thu, May 26, 2005 8:35 pm, mayo said: > I need to be able to format data. > > Printf() is perfect because I need a certain amount of characters (30 > for address). > > However I need this formatted data to be inside a file that's fwrite() > and then FTPed to a distributor who will parse it and input into their > database. > > > printf("% 4d",$orderID[0]); does not work in > > $thisContent=" > > "data" . > "moredate" . > "evenmoredata" . > > "; > > > In effect I need the output of printf() to be placed inside a variable > and I don't see how to do that. Str_pad(), of course, does not work. > > Thx for any hints. > > mayo > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP 5 Question about OO
Hi List, I'm using the oo orientation of PHP5 for a while now. All Classes I've got have a require on top them, if I try to reference to other classes. something like require (Class2.php); class Class1{ private function ... { $refClass2 = new Class2; } } Now my question, is it possible to skip that require/ include part? In Java you don't need that, as class and file names are identical. thx janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Files suffix] .inc.php files
On 1 Jun 2005, at 06:22, Richard Lynch wrote: You've got files that people can get executed *COMPLETELY* out of context, that *NOBODY* even though about being executed out of context, much less *TESTED* in any kind of QA process! I can surf to http://example.com/admin.inc and who knows what will happen if that PHP code in there gets executed without all the code you expected to be executed before that code? There is one simple habit that can mitigate this issue, and it's one I see very often: make your .inc.php and .class.php files do nothing. If you .inc files contain only function and constant definitions, and your .class files contain only class definitions, then nothing will happen when you run them - a bunch of functions or a class will get defined, but if nothing is run, they will just be forgotten. This route has a major advantage when it comes to deployment - you can just stick all your files in one place, and it will work without risk. Another simple approach is to put all your included files in a directory that contains a .htaccess file to prevent direct access to them. They can still be included from your PHP scripts. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Files suffix] .inc.php files
moving outside the webtree is the best option, where practical. Calling the files whatever.inc.php allows you to disallow access to .inc.php files via the apache config file. On 6/1/05, Richard Lynch <[EMAIL PROTECTED]> wrote: > On Tue, May 31, 2005 10:55 am, Leif Gregory said: > > Hello Martin, > > > > Sunday, May 29, 2005, 9:24:00 PM, you wrote: > > M> I saw files like "file.inc.php" and "file.inc" > > M> What is the *.inc suffix good for ? > > > > It's good for a lot of trouble if the webserver hasn't been set up to > > parse .inc files as PHP. If it hasn't then someone can request that > > file in a broswer and see the code. > > Gak! > > It's good for even *MORE* trouble if the webserver is set up to parse .inc > as PHP! > > You've got files that people can get executed *COMPLETELY* out of context, > that *NOBODY* even though about being executed out of context, much less > *TESTED* in any kind of QA process! > > I can surf to http://example.com/admin.inc and who knows what will happen > if that PHP code in there gets executed without all the code you expected > to be executed before that code? > > > I'd just stay away from using .inc for an include and do either of the > > below: > > > > config.inc.php > > > > or just > > > > config.php > > Neither of which solve the base problem: > > The *REAL* solution is to put your .inc files *OUTSIDE* the web-tree where > they simply CANNOT be executed out of context (by surfing to them) and > cannot be downloaded by Bad Guys looking for holes. > > You can also add code to the beginning of every .inc file which attempts > to examine the state of the HTTP request to determine that it is not being > called out of context, but that's a pain to have to put in every file, or > to have to remember to include the include file that does that, and to > hope that every developer (or even just you) remembers to do that. It's > really much easier to just fix your include_path, move the files where > they cannot get accessed, and be done with it. > > Just my opinion. > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php + cvs
> -Original Message- > From: Bostjan Skufca @ domenca.si [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 31, 2005 6:57 PM > > > is it possible to mount CVS/SVN repository as filesystem? > > > > a. why would you want to? (the whole idea is that you _dont_ edit files > > directly in the repository) b. this is a php mailinglist not a cvs > > mailinglist. ;-) > > > a. It would create a posibility to run application directly from CVS if > http server would have access to it If You really want that, then set it up in Your virtual host block? No need for mounting here as I see it. A typical setup is: /home/website/cvs // the CVS repository www.domain.com // /home/website/public_html (the live site) www.domain.com/~USERS/ // /home/USERS/ (the local checkouts) Everyone working on the site works on their local checkouts, and commits changes, then asking a sysadm/CVSadmin to put the changes into the live environment. Some companies use several levels like dev, pre-production before production. -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/Systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
On 1 Jun 2005, at 09:01, janbro wrote: require (Class2.php); class Class1{ private function ... { $refClass2 = new Class2; } } Now my question, is it possible to skip that require/ include part? In Java you don't need that, as class and file names are identical. PHP doesn't have this luxury - people can call files whatever they like. However, PHP5 does have a nice feature to deal with this. In your class1 class, create a function called __autoload like this: function __autoload($class_name) { require_once $class_name . '.php'; } In this case when you ask for a new class2 and you've not required it before, it will automatically call __autoload with $class_name set to 'Class2', which then requires the class file according to the pattern used in the function, in this case 'Class2.php'. Note that while PHP is not case sensitive to class names, the file system you're on probably is, so keep your case consistent throughout. Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
Hello janbro, Wednesday, June 1, 2005, 9:01:57 AM, you wrote: j> Now my question, is it possible to skip that require/ include part? j> In Java you don't need that, as class and file names are identical. Personally I'd __autoload them, but this might not be ideal for your file structure. Worth a look anyway perhaps? Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] .INC files
> > > > Order allow,deny > Deny from all > > > Without this rule people would be able to access the .inc file directly > and since PHP won't parse it, the raw source code would be visible which > could be a security problem. If you prevent this simply by putting .php > onto the end of your include files, you could have a different security > problem in that files designed to be included could be run out of their > include context and could potentially do something unexpected. I do not agree. First, this works the same way: Order allow,deny Deny from all Second, which way are you differ PHP .inc files from HTML .inc files? Many programs can't too... IMHO it is very inconvenient. Third, I always write context-independent include files. Objections? Thank you. Best regards, Denis Gerasimov, Chief Developer, VEKOS Ltd. www.vekos.ru > > -Rasmus > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
maybe have a look at extends class Class1 extends Class2 {... janbro wrote: Hi List, I'm using the oo orientation of PHP5 for a while now. All Classes I've got have a require on top them, if I try to reference to other classes. something like require (Class2.php); class Class1{ private function ... { $refClass2 = new Class2; } } Now my question, is it possible to skip that require/ include part? In Java you don't need that, as class and file names are identical. thx janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Security check
Hi all I just got the ok from the client pertaining the disclosure of parts of the code. Basically I made admin and a user must be loged in in order to access any file in that directory. (except index.php) Here is the file index.php LogedIn()) {$dest=PAGE_LOGIN_SUCCESS; $dest=getShopDest($dest,$_GET); header("Location: $dest"); die();} $thispage=PAGE_LOGIN; $message=''; $hiddens="\n\t"; $admin=ADMIN_STYLE;; $old_name=''; if(array_key_exists('name',$_POST)) $old_name=htmlspecialchars($_POST['name']); $valid=array('from','authorize','order'); #copy GET to POST if(count($_GET)>0) {foreach($_GET as $key=>$value) if(in_array($key,$valid)) {$key=htmlspecialchars($key); $value=htmlspecialchars($value); $hiddens.=<<<___hid \n\t ___hid; } } elseif(count($_POST)>0) foreach($_POST as $key=>$value) if( ($key!=='login') && ($key!=='name') && ($key!=='pass') ) $hiddens.=<<<_hid_ \n\t _hid_; if( (array_key_exists('savereferer',$_GET)) && ($_GET['savereferer']=='yes')) {safeReferer($ref,$chksum); $hiddens.=<<<_ref_ \t \t _ref_; } if(!empty($_POST['login'])) {#process request if(isset($_POST['login'])) if($_POST['login']=='Login') [EMAIL PROTECTED]'name']; [EMAIL PROTECTED]'pass']; #encode password $pass=sha1(crc32(md5($pass))); if($myDb->login($name,$pass,'users',$id)) {$dest=($id==777?PAGE_ROOT_LOGIN_SUCCESS:PAGE_LOGIN_SUCCESS); #added new destinations for the store $dest=GetShopDest($dest,$_POST); if( (array_key_exists('savereferer',$_POST)) && ($_POST['savereferer']=='yes')) $dest=safeReferer($nothing,$empty,$dest); header("Location: $dest"); die();} else {$message="Invalid login";}}} elseif(!empty($_POST['cancel'])) {if(isset($_POST['cancel'])) if($_POST['cancel']=='Cancel') {echo PAGE_PAGESTORE; header("Location: ".PAGE_PAGESTORE); exit();}} echo <<<_EMPTY_FORM http://www.w3.org/TR/html4/loose.dtd";> Admin Login page Admin Login $hiddens Login Name Password _EMPTY_FORM; if(!empty($message)) echo <<<_ERROR_FOUND $message _ERROR_FOUND; echo <<<_EMPTY_FORM Back to the previous page _EMPTY_FORM; ?> And in every file in the directory /admin, I require the file login.php Here is the file login.php LogedIn(); if($verify===false) {$where=AddGetVar(PAGE_LOGIN,'savereferer','yes'); header("Location: $where"); die();} if(!defined('USER_ID')) define('USER_ID',$login_verify->userid());?> And here are the relative parts of my database abstraction layer (database.php) class Login_Database extends database {function login($name,$pass,$table,&$id) {if(!$this->connected()) $this->halt(); #There is ONE builtin account that has UID 777 #Username root #For the password, see your release documentation if($name=='root' && $pass=ROOT_PASSWORD) {$this->addHistory(777,true); $this->doCookie(777); $id=777; return (bool) true;} $query="SELECT `id`, `password`,`active` FROM `$table` WHERE `name`='$name' LIMIT 1;"; $res=new_mysql_query($query,$this->dblink); if(!$res) {$this->addHistory($user,false); return (bool) false;} if(mysql_num_rows($res)!=1) return (bool) false; $res_array=mysql_fetch_assoc($res); mysql_free_result($res); if( ($res_array['password']==$pass) && ($res_array['active']=='1')) {$id=$res_array['id']; $this->addHistory($id,true); $this->doCookie($id); return (bool) true;} $this->addHistory($name,false); return (bool) false;} function addHistory($user,$valid,$table=TBL_HISTORY) {/*adds login(attempt) to the history databse In case the login is successfull, only user id is shown */ #mysql date time format is -MM-DD HH:MM:SS $timestamp=date("Y-m-d H:i:s"); $valid=($valid?'1':'0'); $ip=getDNSHost(); $query="INSERT INTO `$table` (`date`,`ip`,`user`, `valid`) VALUES ('$timestamp', '$ip', '$user', '$valid');"; $res=new_mysql_query($query,$this->dblink) or $this->halt();} function doCookie($id,$table=TBL_LOGINS,$code=null) {if(is_null($code)) {$cookie=md5(mt_rand()); $timestamp=date("Y-m-d H:i:s"); $origin=getDNSHost(); new_mysql_query("DELETE FROM `$table` WHERE `userid`='$id';", $this->dblink); #delete old data $query="INSERT INTO `$table` (`userid`, `login`, `cookie`, `origin`) VALUES ('$id', '$timestamp', '$cookie', '
Re: [PHP] PHP 5 Question about OO
Marcus Bointon wrote: On 1 Jun 2005, at 09:01, janbro wrote: require (Class2.php); I bet you didn't cut'n'paste that from a working file :-) class Class1{ private function ... { $refClass2 = new Class2; } } Now my question, is it possible to skip that require/ include part? In Java you don't need that, as class and file names are identical. PHP doesn't have this luxury - people can call files whatever they like. However, PHP5 does have a nice feature to deal with this. In your class1 class, create a function called __autoload like this: function __autoload($class_name) { require_once $class_name . '.php'; } In this case when you ask for a new class2 and you've not required it before, it will automatically call __autoload with $class_name set to 'Class2', which then requires the class file according to the pattern used in the function, in this case 'Class2.php'. Note that while PHP is not case sensitive to class names, the file system you're on probably is, so keep your case consistent throughout. all true, now imagine that you install a couple of 3rdparty php5 'packages' and they all define __autoload() - ain't gonna work! which is why there has been discussion on internals regarding the possibility of use a handler-function stack for autoloading (in the same way that you can register a stack of input/output filter-function)... something to keep an eye on in case things change :-) you may also consider that placing suitable require statements (I would use require_once for class files) before a class definition will probably/possibly (I don't know but it may be important to your project) be a minor performance boost over letting php call _autoload() whenever it needs. Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
eoghan wrote: maybe have a look at extends class Class1 extends Class2 {... he will still have to make sure that Class2 is loaded. besides wrapping 1 object inside another is perfectly acceptable, if my GOF terminology serves me well then this is usually termed a Delegation pattern (not that the name is that important, then again it helps to be talking about the same thing :-/). janbro wrote: Hi List, I'm using the oo orientation of PHP5 for a while now. All Classes I've got have a require on top them, if I try to reference to other classes. something like require (Class2.php); class Class1{ private function ... { $refClass2 = new Class2; } } Now my question, is it possible to skip that require/ include part? In Java you don't need that, as class and file names are identical. thx janbro -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .INC files
Denis Gerasimov wrote: Order allow,deny Deny from all Without this rule people would be able to access the .inc file directly and since PHP won't parse it, the raw source code would be visible which could be a security problem. If you prevent this simply by putting .php onto the end of your include files, you could have a different security problem in that files designed to be included could be run out of their include context and could potentially do something unexpected. I do not agree. First, this works the same way: Order allow,deny Deny from all cool. cheers for that :-) Second, which way are you differ PHP .inc files from HTML .inc files? Many programs can't too... IMHO it is very inconvenient. Third, I always write context-independent include files. Objections? I'd say so. a, your disagreement is more like an amendment. b, whats an HTML .inc file anyway? c, you can use a directory structure to help identify your files. d, seems to me Rasmus was offering his way of doing 'it' (and highlighting potential security issues) rather than stating how you must do it, granted he invented(is that the correct word?) php so chances are that his idea(s) are solid even though you may disagree initially :-) me I stick a '.php' at the end of every filename (habit mostly) and keep all my includes outside of the webroot. mostly its personal preference so long as you keep safety in mind, right? :-) Thank you. Best regards, Denis Gerasimov, Chief Developer, VEKOS Ltd. www.vekos.ru -Rasmus -- 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] APACHE
Hi! I assume many of you are running PHP under Apache. I just installed Apache 2.0 on Windows XP. To keep it simple, what changes to I have to make to the configuration file? I keep the .php fles in the D:/ drive (a CD-RW drive). Are there any other changes I need to make? Tony
Re: [PHP] PHP 5 Question about OO
On 1 Jun 2005, at 11:38, Jochem Maas wrote: all true, now imagine that you install a couple of 3rdparty php5 'packages' and they all define __autoload() - ain't gonna work! which is why there has been discussion on internals regarding the possibility of use a handler- function stack for autoloading (in the same way that you can register a stack of input/output filter-function)... something to keep an eye on in case things change :-) I've run into this one. One way that would work for me (and initially it's how I assumed it worked) is for __autoload to be a standard class method like __construct, so that a class would attempt to run its own autoloader before breaking out to the global function namespace. Marcus -- Marcus Bointon Synchromedia Limited: Putting you in the picture [EMAIL PROTECTED] | http://www.synchromedia.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Replacing 2 strings
On 31/05/05, W Luke <[EMAIL PROTECTED]> wrote: > On 31/05/05, Murray @ PlanetThoughtful <[EMAIL PROTECTED]> wrote: > > > > > > > > function replace($string){ > > > preg_match("/^<\^([a-zA-Z]+?)_([a-zA-Z]+?)>/", $string, $matcharr); > > > $string = str_replace($matcharr[0], $matcharr[1] . " " .$matcharr[2] > > > . ":", $string); > > > return $string; > > > > > > } > > > > > > $string = "<^JIM_JONES> Leicester, 1720. Oxford, 1800 CONFIRMED: meeting > > > at > > > 19.10"; > > > echo replace($string); > > > > > > ?> > > > > > > One of the small benefits of this solution is that Will doesn't need to > > > know > > > what is contained in the target substring beforehand. > > > > I should get into the habit of listing the assumptions my code makes. > > > > In the above example, the following assumptions are present: > > > > - The target substring (in this example, "<^JIM_JONES>") must *always* > > appear at the beginning of the string for the function to perform its task > > > > - The target substring will *always* begin with "<^", will feature a "_" > > between the two name elements, and will conclude with ">" > > > > - There will only be two name elements within the target substring (ie will > > match "<^JIM_JONES>" and "<^MARY_BETH>" but will not match "<^JIM>" or > > "<^MARY_BETH_JONES>") > > > > - The function will only replace the first incidence of the target > > substring. In the eventuality that the target substring value appears > > multiple times in the string being processed, all other instances will be > > left unchanged. > > > > - All other contents of the string being processed can vary without impact > > on the function. > > Thanks Murray, and Brian - both excellent and I'm really grateful for > the help! Clueless when it comes to these types of problems, so > thanks very much, One more question, then I'll leave you alone - promise! How simple would it be to split the two names into 2 vars ($n1 $n2)? -- Will The Corridor of Uncertainty http://www.cricket.mailliw.com/ - Sanity is a madness put to good use - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] building php, using mysql for apache2
hi... trying to build php4 with mysql4.1-12, for use in apache2. i have the following "./compile" that works for php5. however, when i try to use it for php4, i get a msg, stating that it can't find the MySQL Headers... can anybody provide any pointers as far as what the Headers are for mysql, and where they'd be located? if i knew the files, i could do a search to find where they're located. -- ./configure --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/bin/mysql_config -- thanks -bruce [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP and USB Devices
> -Original Message- > From: Joe Harman [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 31, 2005 8:24 PM > actually what I need to have it do is just fill in the user's name and > password... security is not high on the priority list... the only > thing that the fingerprint reader is going to do is make the process > of login fast and hopefuly error free... > > I am using the microsoft fingerprint reader... looks like I need to > find an activex (that doesn't seem to exist) that will pop the access > info into the username and password box... the problem with the > packaged software is that there can only be one fingerprint profile > per user account... i need like 80 profiles... there should be some > sort of other hardware/software solution out there that I will run > across... "microsoft fingerprint reader", " hopefuly error free"? Ehh... that doesn´t compute... You´re under arrest (Quote from Episode 1) No really, does the reader by any chance emulate a keyboard like a handscanner does? That would definetly be a nice thing for You :-) -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/Systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Copy to network share
I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: php forum and (almost certainly 0T) client editor
> -Original Message- > From: Amir Mohammad Saied [mailto:[EMAIL PROTECTED] > Sent: Tuesday, May 31, 2005 10:34 PM > To: php-general@lists.php.net > Subject: [PHP] Re: php forum and (almost certainly 0T) client editor > > For your 2nd question, try kupu > http://kupu.oscom.org/ > It really rocks! It made my FireFox crash! -- Med venlig hilsen / best regards ComX Networks A/S Kim Madsen Systemudvikler/Systemdeveloper -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
On Wednesday 01 June 2005 14:42, Jeff McKeon wrote: > > $dirhandle = opendir(server\\share); > Readdir($dirhandle); > > Chdir(server//share); > > Chdir(server\\share); > > Warning: chdir(): No such file or directory (errno 2) > > Is what I'm trying to do possible and if so, how? You should put the dirname in quotes Like $dirhandle=opendir("Server\\Share"); Regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++ L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e>$@ h++(*) r-->++ y--()> -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] building php, using mysql for apache2
> trying to build php4 with mysql4.1-12, for use in apache2. i have the > following "./compile" that works for php5. however, when i try to use it for > php4, i get a msg, stating that it can't find the MySQL Headers... >From http://us3.php.net/manual/en/ref.mysql.php: === For compiling, simply use the --with-mysql[=DIR] configuration option where the optional [DIR] points to the MySQL installation directory. This MySQL extension doesn't support full functionality of MySQL versions greater than 4.1.0. For that, use MySQLi. If you would like to install the mysql extension along with the mysqli extension you have to use the same client library to avoid any conflicts. === PHP4 doesn't support the mysqli extension, so you must compile PHP w/ --with-mysql=/your/mysql/prefix/dir -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: .INC files
Sorry I didnt know the post delay is that LONG... On 5/31/05, Jason Barnett <[EMAIL PROTECTED]> wrote: > > Martin Zvarik wrote: > > Hi, > > I saw files like "file.inc.php" and "file.inc" > > > > What is the *.inc suffix good for ? > > > > Thank you for replies. > > > > Martin > > STOP SPAMMING THE LIST! > > .inc is just a shorthand for include files and it's just a different way > of organizing code >
RE: [PHP] FW: write to file, difficulty inputting data
I need to write to file. After getting a customer's order I'm sending a file to a distribution company. The company wants all the information in a preset format which they will then parse. The problem comes when I try to put in multiple orders. In other words how does one use while($row = mysql_fetch_array( $result )) { } inside a variable -- or put the results into said variable The process I've set up is: 1. get data from session variables, $_POST and a database (this orderID, itemsOrdered and customerAddress, etc...) 2. put it into a variable called $fileContent 3. then write $fileContent to $file Example below: $thisOrder= sprintf("%12d",$orderID[0]); ... $fileContent= $thisOrder . $_POST["shippingMethodName"] . $a . $b . $c ; // end of $fileContent Now, I would like to put my orders into $fileContent. How does one place the output of while($row = mysql_fetch_array( $result )) { } into $fileContent? Thx. Mayo -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 1:13 AM To: mayo Cc: php-general@lists.php.net Subject: Re: [PHP] FW: write to file, difficulty inputting data On Tue, May 31, 2005 5:32 pm, mayo said: > if (!$handle = fopen($filename, 'w')) { This will WIPE OUT the existing file, and write a *NEW* file, from 0, starting from scratch. So you'll never have anything but the LAST item. You could use "a+" to append to the end of the file... But you *SHOULD* be using a database to avoid concurrency issues. You're going to have a MUCH better application if you store your data in the database, and it's EASIER than messing with a file. Only use a file if a database is absolutely forbidden by outside factors. Like badly-design homework assignments. Or not-very-smart pointy-haired-bosses. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] [Files suffix] .inc.php files
Leif Gregory wrote: Hello Martin, Sunday, May 29, 2005, 9:24:00 PM, you wrote: M> I saw files like "file.inc.php" and "file.inc" M> What is the *.inc suffix good for ? It's good for a lot of trouble if the webserver hasn't been set up to parse .inc files as PHP. If it hasn't then someone can request that file in a broswer and see the code. PHP will parse the file when called via include() or require(), no matter the extension and how the web server is configured. Now if a user tries to access the file directly, then the webserver comes into playbut one would think that you don't want include files accessed directly anyway. Best ways to do this is to put them outside of document root, give them a unique extension (like .inc or .inc.php) that you can filter out in Apache, and put some 'security measure' in the file itself (like checking to see if a constant is set). -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP and USB Devices
Hey thanks for all the replies... the finger print scanner is actually alot more convient than anything else for $38 it's became pretty addictive... now i don't have to type all those long server passwords anymore.. LOL... i am way too lazy!!! I actually bought this thing to integrate a quick time clock into our extranet system... all i need the thing to do is pass some scrambled code based on the user's finger print into a text field and I could then tie it to a user account on setup... I will be calling DigitalPersona, the company who actually makes this thing... but their website comes right out and says they don't support the microsoft one.. go figure.. but they do have a couple other models that I may consider getting for the project.. what really needs to happen is someone start a source forge project that authenticates finger prints using MySQL and Java... with a PHP front end for user authentication.. someone mentioned using the PHP functions to call the COM object... guess I have do some reading ;o) Cheers Joe Cheers! On 6/1/05, Kim Madsen <[EMAIL PROTECTED]> wrote: > > > -Original Message- > > From: Joe Harman [mailto:[EMAIL PROTECTED] > > Sent: Tuesday, May 31, 2005 8:24 PM > > > actually what I need to have it do is just fill in the user's name and > > password... security is not high on the priority list... the only > > thing that the fingerprint reader is going to do is make the process > > of login fast and hopefuly error free... > > > > I am using the microsoft fingerprint reader... looks like I need to > > find an activex (that doesn't seem to exist) that will pop the access > > info into the username and password box... the problem with the > > packaged software is that there can only be one fingerprint profile > > per user account... i need like 80 profiles... there should be some > > sort of other hardware/software solution out there that I will run > > across... > > "microsoft fingerprint reader", " hopefuly error free"? Ehh... that doesn´t > compute... You´re under arrest (Quote from Episode 1) > > No really, does the reader by any chance emulate a keyboard like a > handscanner does? That would definetly be a nice thing for You :-) > > -- > Med venlig hilsen / best regards > ComX Networks A/S > Kim Madsen > Systemudvikler/Systemdeveloper > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- Joe Harman - Do not go where the path may lead, go instead where there is no path and leave a trail. - Ralph Waldo Emerson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
sorry I ment to send to email to the list I tried the code bellow on my windows machine. I have a mapped network drive on my windows machine (i: drive) that links to a samba share (my htdocs directory on my linux dev machine). It worked fine. echo getcwd(); chdir('i:'); echo ""; echo getcwd(); clive Jeff McKeon wrote: Yes, doesn't work either Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:19 PM To: Jeff McKeon Subject: Re: [PHP] Copy to network share Hi jave you tried creating a mapped network drive on windows? clive Jeff McKeon wrote: I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
All, The syntax is correct... It's not a quotes problem. I have the path in quotes in my actual code. Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 > -Original Message- > From: Andy Pieters [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 9:34 AM > To: php-general@lists.php.net > Subject: Re: [PHP] Copy to network share > > > On Wednesday 01 June 2005 14:42, Jeff McKeon wrote: > > > > $dirhandle = opendir(server\\share); > > Readdir($dirhandle); > > > > Chdir(server//share); > > > > Chdir(server\\share); > > > > > Warning: chdir(): No such file or directory (errno 2) > > > > Is what I'm trying to do possible and if so, how? > > You should put the dirname in quotes > > Like $dirhandle=opendir("Server\\Share"); > > > Regards > > > Andy > > -- > Registered Linux User Number 379093 > -- --BEGIN GEEK CODE BLOCK- > Version: 3.1 > GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++ > L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) > PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) > D+(+++) G(+) > e>$@ h++(*) r-->++ y--()> > -- ---END GEEK CODE BLOCK-- > -- > Check out these few php utilities that I released > under the GPL2 and that are meant for use with a > php cli binary: > http://www.vlaamse-kern.com/sas/ -- -- -- 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] Copy to network share
Is that drive mapped on your local machine or on the web server? Jeff > -Original Message- > From: Clive Zagno [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 8:31 PM > To: Jeff McKeon; php > Subject: Re: [PHP] Copy to network share > > > sorry I ment to send to email to the list > > I tried the code bellow on my windows machine. I have a > mapped network > drive on my windows machine (i: drive) that links to a samba > share (my > htdocs directory on my linux dev machine). It worked fine. > > echo getcwd(); > chdir('i:'); > echo ""; > echo getcwd(); > > clive > > > > Jeff McKeon wrote: > > Yes, doesn't work either > > > > Jeffrey S. McKeon > > Manager of Information Technology > > Telaurus Communications LLC > > [EMAIL PROTECTED] > > +1 (973) 889-8990 ex 209 > > > > > > > >>-Original Message- > >>From: Clive Zagno [mailto:[EMAIL PROTECTED] > >>Sent: Wednesday, June 01, 2005 8:19 PM > >>To: Jeff McKeon > >>Subject: Re: [PHP] Copy to network share > >> > >> > >>Hi > >> > >>jave you tried creating a mapped network drive on windows? > >> > >>clive > >> > >> > >>Jeff McKeon wrote: > >> > >>>I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to > >>>upload a file and then copy it to a samba share (share > >> > >>level security) > >> > >>>on a linux box across the network. > >>> > >>>I can > >>> > >>>$dirhandle = opendir(server\\share); Readdir($dirhandle); > >>> > >>>With no problem but I can't changed to the that dir to copy the > >>>uploaded files to it. > >>> > >>>I've tried > >>> > >>>Chdir(server//share); > >>> > >>>Chdir(server\\share); > >>> > >>>But it always returns: > >>> > >>>Warning: chdir(): No such file or directory (errno 2) > >>> > >>>Is what I'm trying to do possible and if so, how? > >>> > >>>Many thanks, > >>> > >>>Jeff > >>> > >> > >> > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
its on my local machine, in your case it will your w2k box. clive Jeff McKeon wrote: Is that drive mapped on your local machine or on the web server? Jeff -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:31 PM To: Jeff McKeon; php Subject: Re: [PHP] Copy to network share sorry I ment to send to email to the list I tried the code bellow on my windows machine. I have a mapped network drive on my windows machine (i: drive) that links to a samba share (my htdocs directory on my linux dev machine). It worked fine. echo getcwd(); chdir('i:'); echo ""; echo getcwd(); clive Jeff McKeon wrote: Yes, doesn't work either Jeffrey S. McKeon Manager of Information Technology Telaurus Communications LLC [EMAIL PROTECTED] +1 (973) 889-8990 ex 209 -Original Message- From: Clive Zagno [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 01, 2005 8:19 PM To: Jeff McKeon Subject: Re: [PHP] Copy to network share Hi jave you tried creating a mapped network drive on windows? clive Jeff McKeon wrote: I've got PHP 4.3 running on a Win2k IIS 5.0 web server. I need to upload a file and then copy it to a samba share (share level security) on a linux box across the network. I can $dirhandle = opendir(server\\share); Readdir($dirhandle); With no problem but I can't changed to the that dir to copy the uploaded files to it. I've tried Chdir(server//share); Chdir(server\\share); But it always returns: Warning: chdir(): No such file or directory (errno 2) Is what I'm trying to do possible and if so, how? Many thanks, Jeff -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
That won't work. I don't want the users mapping a drive on their local machine. I tried mapping it on the server running the IIS and doing as you suggest, but it doesn't work. Jeff > -Original Message- > From: Clive Zagno [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 10:04 PM > To: php > Subject: Re: [PHP] Copy to network share > > > its on my local machine, in your case it will your w2k box. > > clive > > Jeff McKeon wrote: > > Is that drive mapped on your local machine or on the web server? > > > > Jeff > > > > > >>-Original Message- > >>From: Clive Zagno [mailto:[EMAIL PROTECTED] > >>Sent: Wednesday, June 01, 2005 8:31 PM > >>To: Jeff McKeon; php > >>Subject: Re: [PHP] Copy to network share > >> > >> > >>sorry I ment to send to email to the list > >> > >>I tried the code bellow on my windows machine. I have a > >>mapped network > >>drive on my windows machine (i: drive) that links to a samba > >>share (my > >>htdocs directory on my linux dev machine). It worked fine. > >> > >>echo getcwd(); > >>chdir('i:'); > >>echo ""; > >>echo getcwd(); > >> > >>clive > >> > >> > >> > >>Jeff McKeon wrote: > >> > >>>Yes, doesn't work either > >>> > >>>Jeffrey S. McKeon > >>>Manager of Information Technology > >>>Telaurus Communications LLC > >>>[EMAIL PROTECTED] > >>>+1 (973) 889-8990 ex 209 > >>> > >>> > >>> > >>> > -Original Message- > From: Clive Zagno [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 8:19 PM > To: Jeff McKeon > Subject: Re: [PHP] Copy to network share > > > Hi > > jave you tried creating a mapped network drive on windows? > > clive > > > Jeff McKeon wrote: > > > >I've got PHP 4.3 running on a Win2k IIS 5.0 web server. > I need to > >upload a file and then copy it to a samba share (share > > level security) > > > >on a linux box across the network. > > > >I can > > > >$dirhandle = opendir(server\\share); Readdir($dirhandle); > > > >With no problem but I can't changed to the that dir to copy the > >uploaded files to it. > > > >I've tried > > > >Chdir(server//share); > > > >Chdir(server\\share); > > > >But it always returns: > > > >Warning: chdir(): No such file or directory (errno 2) > > > >Is what I'm trying to do possible and if so, how? > > > >Many thanks, > > > >Jeff > > > > > >>> > >>-- > >>PHP General Mailing List (http://www.php.net/) > >>To unsubscribe, visit: http://www.php.net/unsub.php > >> > >> > > > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Craig's List Clone part deux
On May 31, 2005, at 1:48 PM, Michael O'Neal wrote: Thanks John. That's one of the reasons I haven't gone that route. The whole operation seemed cheesy to me. I appreciate the feedback though. On Tue, 31 May 2005, Michael O'Neal wrote: Anyone else? I have a hard time believing it's not out there...but I could be wrong!!! I'm trusting you've looked at all 900,000 results here? :-) http://www.google.com/search?q=php+classified+script&start=0&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official Seems like there is a *lot* out there, but whether or not they are any good is another matter :-) Maybe one of those sites will point you in the right direction. The app itself wouldn't be that hard to develop yourself I don't think... -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] if(($mydata->address
This should be easy, but refuses to work: if( ($mydata->address != "") and ($mydata->addresspublic == "yes") ) { } But in other combinations, they work? if($mydata->address != ""){} or if($mydata->addresspublic == "yes"){} So what new lesson am I to learn now? :) John -- John Taylor-Johnston - "If it's not Open Source, it's Murphy's Law." ' ' 'Collège de Sherbrooke: ô¿ôhttp://www.collegesherbrooke.qc.ca/languesmodernes/ - 819-569-2064 °v° Bibliography of Comparative Studies in Canadian, Québec and Foreign Literatures /(_)\ Université de Sherbrooke ^ ^ http://compcanlit.ca/ T: 819.569.2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] foreach ($media as $key => $val) problem
Hi, all, This might look like a mysql problem but I assure you it's my botching the PHP which is the problem! I'm building a part of a page with info from three tables: art, media and media_art. Media_art is the intersection table. For every entry in art there can be one or more entries in media. art.art_id 1 has two entries in media_art: Media_id art_id 32 52 I do this SQL, which in phpmyadmin returns the two names of media as expected SELECT media.media_name FROM art, media_art, media WHERE art.art_id = 1 AND art.art_id = media_art.art_id AND media.media_id = media_art.media_id Yet here's where I mess up. To see if I've got them in an array, I do: $media = mysql_fetch_assoc($media_result); while ($media = mysql_fetch_assoc($media_result)) { asort($media); foreach($media as $key => $val) { echo "key: $key value: $val "; } } //end while $media = mysql_fetch_assoc($media_result) and this returns only the name of the HIGHer number of the two (that is, 5). What have I done wrong to echo out each name of the media associated with this record? I'm trying, eventually, to echo it out in the age so that it appears as [art_id 1] comprises Ink, watercolor. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] DOM: copying from one document to another
Consider the following test code: $doc = domxml_new_doc( '1.0' ); $baseDocument = domxml_new_doc( '1.0' ); $domNode = $doc->create_element( 'Node' ); $node = $doc->create_element( 'NodeChild' ); $textNode = $doc->create_text_node( 'this' ); $node->append_child( $textNode ); $domNode->append_child( $node ); $doc->append_child( $domNode ); $node = $doc->create_element( 'AnotherNode' ); $childNode = $doc->create_element( 'AnotherNodeChild' ); $textNode = $doc->create_text_node( 'that' ); $childNode->append_child( $textNode ); $node->append_child( $childNode ); $domNode->append_child( $node ); $doc->append_child( $domNode ); $elements = $doc->get_elements_by_tagname( '*' ); $element = $elements[0]; $child = $element->first_child(); while( $child ) { $baseDocument->append_child( $child ); $child = $child->next_sibling(); } When I run it, I am presented with the error: Warning: append_child(): Can't append node, which is in a different document than the parent node in test_dom.php on line 31 Is there any way I can copy an element from one DOM document to another without having to dissect the original node/element and create a new node/element from scratch using the new DOM document and append to it? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
Okay, I see there is a workaround but nothing realy satisfying, but I'm not hoing to complain, I'm hapy to have oo in PHP at all. I never worked with __autoload so far, but I will give it a try and check it out thx janbro Marcus Bointon schrieb: > On 1 Jun 2005, at 09:01, janbro wrote: > >> require (Class2.php); >> class Class1{ >> private function ... { >> $refClass2 = new Class2; >> } >> } >> >> Now my question, is it possible to skip that require/ include part? In >> Java you don't need that, as class and file names are identical. > > > PHP doesn't have this luxury - people can call files whatever they > like. However, PHP5 does have a nice feature to deal with this. In your > class1 class, create a function called __autoload like this: > > function __autoload($class_name) { >require_once $class_name . '.php'; > } > > In this case when you ask for a new class2 and you've not required it > before, it will automatically call __autoload with $class_name set to > 'Class2', which then requires the class file according to the pattern > used in the function, in this case 'Class2.php'. Note that while PHP is > not case sensitive to class names, the file system you're on probably > is, so keep your case consistent throughout. > > Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php > > Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(($mydata->address
John Taylor-Johnston wrote: This should be easy, but refuses to work: if( ($mydata->address != "") and ($mydata->addresspublic == "yes") ) { } But in other combinations, they work? if($mydata->address != ""){} or if($mydata->addresspublic == "yes"){} So what new lesson am I to learn now? :) in both cases it does nothing... how do you consider one working and the other one not? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(($mydata->address
> This should be easy, but refuses to work: > if( > ($mydata->address != "") > and > ($mydata->addresspublic == "yes") > ) > { > } Are you getting any errors? If so, what are they? Also, shouldn't the code look like this: if( ($mydata->address != "") && ($mydata->addresspublic == "yes") ) { } ? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
Alright thanks, I see there is a workaround to cope with that. I've never worked with __autoload, but will sure give it a look. I don't realy feel this satisfying, but hey I'm thankful to have oo at all. janbro Marcus Bointon schrieb: > On 1 Jun 2005, at 09:01, janbro wrote: > >> require (Class2.php); >> class Class1{ >> private function ... { >> $refClass2 = new Class2; >> } >> } >> >> Now my question, is it possible to skip that require/ include part? In >> Java you don't need that, as class and file names are identical. > > > PHP doesn't have this luxury - people can call files whatever they > like. However, PHP5 does have a nice feature to deal with this. In your > class1 class, create a function called __autoload like this: > > function __autoload($class_name) { >require_once $class_name . '.php'; > } > > In this case when you ask for a new class2 and you've not required it > before, it will automatically call __autoload with $class_name set to > 'Class2', which then requires the class file according to the pattern > used in the function, in this case 'Class2.php'. Note that while PHP is > not case sensitive to class names, the file system you're on probably > is, so keep your case consistent throughout. > > Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php > > Marcus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] domxml_open_mem()
Consider the following test script: $doc = domxml_new_doc( '1.0' ); $domNode = $doc->create_element( 'Node' ); $node = $doc->create_element( 'NodeChild' ); $textNode = $doc->create_text_node( 'this' ); $node->append_child( $textNode ); $domNode->append_child( $node ); $doc->append_child( $domNode ); $domNode = $doc->create_element( 'AnotherNode' ); $node = $doc->create_element( 'AnotherNodeChild' ); $textNode = $doc->create_text_node( 'that' ); $node->append_child( $textNode ); $domNode->append_child( $node ); $doc->append_child( $domNode ); $baseDocument = domxml_open_mem( trim( $doc->dump_mem( TRUE ))); // line 20 echo '' . @$baseDocument->dump_mem( TRUE ) . ''; When I run it, I am presented with the error: Warning: domxml_open_mem(): Extra content at the end of the document in my_test.php on line 20 Why am I getting that error? I'm using PHP 4.3.8 and I've done some searching in Google and I couldn't find any decent information as to why this might be occuring. Any ideas? thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
Jeff McKeon wrote: That won't work. I don't want the users mapping a drive on their local machine. I tried mapping it on the server running the IIS and doing as you suggest, but it doesn't work. Jeff Have you made sure that the IUSR account that IIS is running has has got the right permissions to access the drive that you have mapped? HTH, Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach ($media as $key => $val) problem
Jack Jackson wrote: Hi, all, This might look like a mysql problem but I assure you it's my botching the PHP which is the problem! I'm building a part of a page with info from three tables: art, media and media_art. Media_art is the intersection table. For every entry in art there can be one or more entries in media. art.art_id 1 has two entries in media_art: Media_id art_id 32 52 I do this SQL, which in phpmyadmin returns the two names of media as expected SELECT media.media_name FROM art, media_art, media WHERE art.art_id = 1 AND art.art_id = media_art.art_id AND media.media_id = media_art.media_id Yet here's where I mess up. To see if I've got them in an array, I do: $media = mysql_fetch_assoc($media_result); while ($media = mysql_fetch_assoc($media_result)) { If this particular example has only two rows to return, then the above two lines look like the culprit. $media = ... is fetching the first row, but you're not doing anything with it, then while( $media = ...) will fetch the second and print it out. Take out the first line above. asort($media); foreach($media as $key => $val) { echo "key: $key value: $val "; } } //end while $media = mysql_fetch_assoc($media_result) and this returns only the name of the HIGHer number of the two (that is, 5). What have I done wrong to echo out each name of the media associated with this record? I'm trying, eventually, to echo it out in the age so that it appears as [art_id 1] comprises Ink, watercolor. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach ($media as $key => $val) problem
Ahh.. an easy one. Unless I'm mistaken (and it does happen more often than I'd like.. hah :) then you might want to ommit the first: $media = mysql_fetch_assoc($media_result); That's reading data into $media and then it happens again at the start of your while loop which is why you're only getting the second item. -TG = = = Original message = = = Hi, all, This might look like a mysql problem but I assure you it's my botching the PHP which is the problem! I'm building a part of a page with info from three tables: art, media and media_art. Media_art is the intersection table. For every entry in art there can be one or more entries in media. art.art_id 1 has two entries in media_art: Media_id art_id 32 52 I do this SQL, which in phpmyadmin returns the two names of media as expected SELECT media.media_name FROM art, media_art, media WHERE art.art_id = 1 AND art.art_id = media_art.art_id AND media.media_id = media_art.media_id Yet here's where I mess up. To see if I've got them in an array, I do: $media = mysql_fetch_assoc($media_result); while ($media = mysql_fetch_assoc($media_result)) ~ asort($media); foreach($media as $key => $val) ~ echo "key: $key value: $val "; ~ //end while $media = mysql_fetch_assoc($media_result) and this returns only the name of the HIGHer number of the two (that is, 5). What have I done wrong to echo out each name of the media associated with this record? I'm trying, eventually, to echo it out in the age so that it appears as [art_id 1] comprises Ink, watercolor. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php ___ Sent by ePrompter, the premier email notification software. Free download at http://www.ePrompter.com. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] DOM: copying from one document to another
> Is there any way I can copy an element from one DOM document to another > without having to dissect the original node/element and create a new > node/element from scratch using the new DOM document and append to it? Never mind. Apparently I can use clone_node(). When I tried that before I was presented with different issues. But I now have those other issues sorted. My apologies for being a little dense. :p thnx, Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] if(($mydata->address
[snip] if( ($mydata->address != "") and ($mydata->addresspublic == "yes") ) { } But in other combinations, they work? if($mydata->address != ""){} or if($mydata->addresspublic == "yes"){} So what new lesson am I to learn now? :) [/snip] Always put the value first in case you accidentally try an assignment operator. Now, on to your code...(with my recommendations) if(("" != $mydata->address) && ("yes" == $mydata->addresspublic)){ ...stuff... } if(("" != $mydata->address) || ("yes" == $mydata->addresspublic)){ ...stuff... } Those should work. Now, why do I recommend the value first? Easy. Consider... if($mydata->foo = "") // always true, $mydata->foo is now equal to blank If I do this... if("" = $mydata->foo) // an error is thrown. If I come back in and finish the comparison operator (which I needed to know was broken) it fixes the conditional statement at this point. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what is -- $this variable -> $this other variable -- means?
What does $this variable -> $this other variable Means? I have seen it and i have "used" but I am not sure what exactly it means in regular English or Spanish wording that is. TAI -- ...helmut helmutgranda.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach ($media as $key => $val) problem SOLVED
Thanks Kristen and TG!! Worked like a charm Kristen G. Thorson wrote: Jack Jackson wrote: Hi, all, This might look like a mysql problem but I assure you it's my botching the PHP which is the problem! I'm building a part of a page with info from three tables: art, media and media_art. Media_art is the intersection table. For every entry in art there can be one or more entries in media. art.art_id 1 has two entries in media_art: Media_id art_id 32 52 I do this SQL, which in phpmyadmin returns the two names of media as expected SELECT media.media_name FROM art, media_art, media WHERE art.art_id = 1 AND art.art_id = media_art.art_id AND media.media_id = media_art.media_id Yet here's where I mess up. To see if I've got them in an array, I do: $media = mysql_fetch_assoc($media_result); while ($media = mysql_fetch_assoc($media_result)) { If this particular example has only two rows to return, then the above two lines look like the culprit. $media = ... is fetching the first row, but you're not doing anything with it, then while( $media = ...) will fetch the second and print it out. Take out the first line above. asort($media); foreach($media as $key => $val) { echo "key: $key value: $val "; } } //end while $media = mysql_fetch_assoc($media_result) and this returns only the name of the HIGHer number of the two (that is, 5). What have I done wrong to echo out each name of the media associated with this record? I'm trying, eventually, to echo it out in the age so that it appears as [art_id 1] comprises Ink, watercolor. Thanks in advance, Jack -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Copy to network share
I never managed to get this working with IIS. I could with Apache (win) though, after making sure that Apache was logged in as the administrator. George > -Original Message- > From: Mikey [mailto:[EMAIL PROTECTED] > Sent: 1 June 2005 7:54 pm > To: php > Subject: Re: [PHP] Copy to network share > > > Jeff McKeon wrote: > > >That won't work. I don't want the users mapping a drive on their local > >machine. I tried mapping it on the server running the IIS and doing as > >you suggest, but it doesn't work. > > > >Jeff > > > > > > > Have you made sure that the IUSR account that IIS is running has has got > the right permissions to access the drive that you have mapped? > > HTH, > > Mikey > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
* janbro <[EMAIL PROTECTED]> : > Okay, I see there is a workaround but nothing realy satisfying, but I'm > not hoing to complain, I'm hapy to have oo in PHP at all. I never worked > with __autoload so far, but I will give it a try and check it out The best way to use autoload is with the auto_prepend_file configuration directive. By adding the __autoload() function to a file that is automatically prepended, you don't even have to think about it in your scripts. This kind of flexibility is nice -- you can have different prepend files for different sites or different areas of the same site -- so that you only have the funcationality accessible that you need right there. You can also define your own naming schema -- which, admittedly is a dubious advantage, but an advantage nonetheless. > Marcus Bointon schrieb: > > On 1 Jun 2005, at 09:01, janbro wrote: > > > > > require (Class2.php); > > > class Class1{ > > > private function ... { > > > $refClass2 = new Class2; > > > } > > > } > > > > > > Now my question, is it possible to skip that require/ include part? In > > > Java you don't need that, as class and file names are identical. > > > > > > PHP doesn't have this luxury - people can call files whatever they > > like. However, PHP5 does have a nice feature to deal with this. In your > > class1 class, create a function called __autoload like this: > > > > function __autoload($class_name) { > >require_once $class_name . '.php'; > > } > > > > In this case when you ask for a new class2 and you've not required it > > before, it will automatically call __autoload with $class_name set to > > 'Class2', which then requires the class file according to the pattern > > used in the function, in this case 'Class2.php'. Note that while PHP is > > not case sensitive to class names, the file system you're on probably > > is, so keep your case consistent throughout. > > > > Docs are here: http://www.php.net/manual/en/language.oop5.autoload.php -- Matthew Weier O'Phinney | WEBSITES: Webmaster and IT Specialist | http://www.garden.org National Gardening Association| http://www.kidsgardening.com 802-863-5251 x156 | http://nationalgardenmonth.org mailto:[EMAIL PROTECTED] | http://vermontbotanical.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security check
Andy Pieters wrote: > $valid=array('from','authorize','order'); >#copy GET to POST >if(count($_GET)>0) >{foreach($_GET as $key=>$value) > if(in_array($key,$valid)) > {$key=htmlspecialchars($key); > $value=htmlspecialchars($value); > $hiddens.=<<<___hid > \n\t > ___hid; > } >} Ok, you are cleaning your input data nicely here. >elseif(count($_POST)>0) > foreach($_POST as $key=>$value) > if( ($key!=='login') && ($key!=='name') && ($key!=='pass') ) > $hiddens.=<<<_hid_ > \n\t > _hid_; But what happened here? Why do you assume POST data is safe? >if( (array_key_exists('savereferer',$_GET)) && > ($_GET['savereferer']=='yes')) >{safeReferer($ref,$chksum); > $hiddens.=<<<_ref_ > \t > \t > _ref_; > } I don't see where $ref comes from. I am assuming it somehow trickles down from HTTP_REFERER? If so, did you clean it? -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Security check
On Wednesday 01 June 2005 22:33, you wrote: > > >elseif(count($_POST)>0) > > foreach($_POST as $key=>$value) > > if( ($key!=='login') && ($key!=='name') && ($key!=='pass') ) > > $hiddens.=<<<_hid_ > > \n\t > > _hid_; > > But what happened here? Why do you assume POST data is safe? You're right it isn't. Thanks! > > >if( (array_key_exists('savereferer',$_GET)) && > > ($_GET['savereferer']=='yes')) > >{safeReferer($ref,$chksum); > > $hiddens.=<<<_ref_ > > \t > > \t > > _ref_; > > } > > I don't see where $ref comes from. I am assuming it somehow trickles > down from HTTP_REFERER? If so, did you clean it? Here is the function safeReferer function safeReferer(&$referer,&$checksum,$default=PAGE_PAGESTORE) {#small piece of code to safely include referers in html code #+ get referer, save it in the form with a digest code with some noise #+ on request, verify the by adding the noise to the referer and calculating the digest code. #+ if it does not match, use standard page as referer $referer=htmlspecialchars(urlencode( @ $_SERVER['HTTP_REFERER'])); if($referer=='') $referer=$default; $checksum=makeCheckSum($referer); $req_ref=$req_chk=null; if( (!(empty($_POST['referer']))) && (!(empty($_POST['checksum']))) ) {$req_ref=$_POST['referer']; $req_chk=$_POST['checksum'];} elseif( (!(empty($_GET['referer']))) && (!(empty($_GET['checksum']))) ) {$req_ref=urlencode($_GET['referer']); #parameters passed urlencoded are automatically decoded by php! $req_chk=$_GET['checksum'];} else makeCheckSum($referer); if(!(is_null($req_ref))) {if(makeCheckSum($req_ref)==$req_chk) {$referer=$req_ref; $checksum=$req_chk;} else {$referer=urlencode($default); $checksum=makeCheckSum($referer);} } return urldecode($referer); } function makeCheckSum($input) {$noise="+++some'(-546%noise#*"; $checksum=sha1(md5("$input$noise")); return $checksum; } Thank you With kind regards Andy -- Registered Linux User Number 379093 -- --BEGIN GEEK CODE BLOCK- Version: 3.1 GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C$(+++) UL>$ P-(+)>++ L+++>$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++) PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+) e>$@ h++(*) r-->++ y--()> -- ---END GEEK CODE BLOCK-- -- Check out these few php utilities that I released under the GPL2 and that are meant for use with a php cli binary: http://www.vlaamse-kern.com/sas/ -- -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is -- $this variable -> $this other variable -- means?
...helmut wrote: What does $this variable -> $this other variable Means? I have seen it and i have "used" but I am not sure what exactly it means in regular English or Spanish wording that is. read about variable variables -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Copy to network share
George Pitcher wrote: I never managed to get this working with IIS. I could with Apache (win) though, after making sure that Apache was logged in as the administrator. George Thus proving that this is a permissions issue, not a PHP issue! Mikey -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] What Works Works Validator
This is OT in that it's more about HTML than PHP, but solutions involving PHP would be particularly welcome. After playing with the W3C validator again for an hour or so... The thing is, I really want to be backwards compatible with ancient browsers. Like, REALLY ancient. Like, say, going back as far as 3.0 browsers. So, relying on CSS to do my layout is a non-option. It's just not there. But I LIKE the idea of having HTML validated to catch tag imbalance, typos in attributes, and maybe even layout problems in weird versions of browsers (eg Netscape 4.7 or IE on the Mac). I don't really want to be compatible with the W3C standards, however, since the penalty is layout that just plain doesn't work in ancient browsers. For example, I simply can't validate with a 100% height table, but that's the only way to get the layout I want on both ancient and current browsers. Does anybody know of a "What Works Works Validator" which checks for maxiumum browser compatibility rather than the W3C standard? Or even just some tools that check HTML tag balancing, and maybe spell-check attributes. It has to be post-PHP URL-based on not IDE/editor based, unless there's a PHP interpreter built into the editor to figure out the HTML I'm spitting out... Failing all that, does anybody know a non-CSS way to get a table to be 100% tall so I can get rid of this last error? Or, perhaps, a way between JavaScript and PHP to calculate how much white-space I need to make a spacer image to be the right height? Or... PS Please let's not start a flame war about browser versions, browser makers, standards-compliance, etc. You can do whatever you want ; I just happen to believe that backwards compatibility is more important than compliance with standards that aren't even implemented correctly at this time. So if your answer doesn't actually match my question, just hit "delete" Thanks. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php forum and (almost certainly 0T) client editor
On 5/31/05, Leif Gregory <[EMAIL PROTECTED]> wrote: > FCKEditor http://www.fckeditor.net/ > > It rocks. > i'm currently working on a content management system designed for less-than-computer-saavy users that utilized fckeditor to create/edit content. i found it pretty easy to integrate (their documentation site helped quite a bit) and havent had any troubles. it just generates plain html (no special markup language like bbcode) but that just saves you the trouble of writing a parser. drew -- dc .. drewcore.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What Works Works Validator
Hello Richard, Wednesday, June 1, 2005, 10:16:50 PM, you wrote: RL> For example, I simply can't validate with a 100% height table, but RL> that's the only way to get the layout I want on both ancient and RL> current browsers. I think you need to define, quite clearly, what you regard as an "ancient" browser here. To my mind an "ancient" browser would be Lynx or the early Mozilla / Spyglass builds where tables were just a dream. What do you regard as "ancient" ? RL> Does anybody know of a "What Works Works Validator" which checks RL> for maxiumum browser compatibility rather than the W3C standard? CSE HTML Validator for Windows does a nice job. Beyond that, why not just download the browsers and install them? :) I'm sure they're in the Evolt browser archive. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re[2]: [PHP] what is -- $this variable -> $this other variable -- means?
Hello Marek, Wednesday, June 1, 2005, 9:48:36 PM, you wrote: >> What does >> $this variable -> $this other variable >> Means? MK> read about variable variables Wouldn't that be $$variable? :) It looks like an object method request to me. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] write to file question, rewritten
I'm trying to write the results of a mysql_fetch_array db query to a file and am unable to. I'm putting the results into a variable $fileContent and then using fwrite(). I would have liked to do something like: $filecontent = . $result = mysql_query( " SELECT orderedItems.*, items.* FROM orderedItems, items WHERE orderedItems.orderID=$orderID[0] AND orderedItems.itemID=items.itemsID "); while($row = mysql_fetch_array( $result )) { $theItemID=$row["orderedItems.itemID"]; $theItemPrice=$row["itemPrice"]; $theItemQty=$row["itemQty"]; $thisItemID= sprintf("% 6d",$theItemID); $thisItemPrice= sprintf("%7.2f",$theItemPrice); $thisItemQty= sprintf("% 7d",$theItemQty); $thisOrder . $thisItemID . $thisItemPrice . $thisItemQty . } "; // end of $filecontent but that doesn't work. Mayo
[PHP] Re: OT [PHP] What Works Works Validator
Net Mechanic free for up to 5 pages spellchecker browser check image check link check load time calculations I've used it for many years. http://www.netmechanic.com/toolbox/html-code.htm Mark Cain - Original Message - From: "Richard Lynch" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 01, 2005 5:16 PM Subject: [PHP] What Works Works Validator > This is OT in that it's more about HTML than PHP, but solutions involving > PHP would be particularly welcome. > > After playing with the W3C validator again for an hour or so... > > The thing is, I really want to be backwards compatible with ancient > browsers. Like, REALLY ancient. > > Like, say, going back as far as 3.0 browsers. > > So, relying on CSS to do my layout is a non-option. It's just not there. > > But I LIKE the idea of having HTML validated to catch tag imbalance, typos > in attributes, and maybe even layout problems in weird versions of > browsers (eg Netscape 4.7 or IE on the Mac). > > I don't really want to be compatible with the W3C standards, however, > since the penalty is layout that just plain doesn't work in ancient > browsers. > > For example, I simply can't validate with a 100% height table, but that's > the only way to get the layout I want on both ancient and current > browsers. > > Does anybody know of a "What Works Works Validator" which checks for > maxiumum browser compatibility rather than the W3C standard? > > Or even just some tools that check HTML tag balancing, and maybe > spell-check attributes. It has to be post-PHP URL-based on not IDE/editor > based, unless there's a PHP interpreter built into the editor to figure > out the HTML I'm spitting out... > > Failing all that, does anybody know a non-CSS way to get a table to be > 100% tall so I can get rid of this last error? > > Or, perhaps, a way between JavaScript and PHP to calculate how much > white-space I need to make a spacer image to be the right height? > > Or... > > PS > Please let's not start a flame war about browser versions, browser makers, > standards-compliance, etc. > > You can do whatever you want ; I just happen to believe that backwards > compatibility is more important than compliance with standards that aren't > even implemented correctly at this time. > > So if your answer doesn't actually match my question, just hit "delete" > Thanks. > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Advise needed on moderated threaded chat
I've been given the bombed task of coming up with a pre-moderated threaded chat solution. I had implemented a moderated flash chat however with 100 users all making bulky comments to the chat guests, it became unbearable for the moderator to check them all off in time to make them cohesive to the discussion, as it was a java xml socket based flash chat therefore had no threading capabilities. Now I dont particularly want to have to write something like this in php, I can just see the Apache 1.3 server with a Mysql backend grinding as there is no threading. What could be the best solution here ? I use special tricks these days to prevent page state changing when posting using XMLHTTP , well I am using a package called Aframe which uses Sajax but allows for OO based services, so this could be a solution for the posting mechanism. However I would need to find the best solution which will use the less resources when posting, and refreshing, and adding moderated comments back into the chat thread in the position when it was posted possibly by the database primary key. If there is better ways either using sockets to another mechanism let me know. Dan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is -- $this variable -> $this other variable -- means?
Richard Davey wrote: Hello Marek, Wednesday, June 1, 2005, 9:48:36 PM, you wrote: What does $this variable -> $this other variable Means? MK> read about variable variables Wouldn't that be $$variable? :) It looks like an object method request to me. I thought this was covered in that section too :) I didn't find where it's fully documented, but it's similar: class A { var $variable = "I'm objects's variable\n"; function method() { echo "I'm object's method\n"; } } $a = new A; $var = 'variable'; echo $a->$var; $meth = 'method'; echo $a->$meth(); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] if(($mydata->address
Jay, Thanks. Sth new learned :) Thought mine was working. It wasn't I guess. I received no errors. I have other scripts to revise :) if("" = $mydata->foo) // an error is thrown. If I come back in and finish the comparison operator (which I needed to know was broken) it fixes the conditional statement at this point. Appreciated. John Jay Blanchard wrote: [snip] if( ($mydata->address != "") and ($mydata->addresspublic == "yes") ) { } But in other combinations, they work? if($mydata->address != ""){} or if($mydata->addresspublic == "yes"){} So what new lesson am I to learn now? :) [/snip] Always put the value first in case you accidentally try an assignment operator. Now, on to your code...(with my recommendations) if(("" != $mydata->address) && ("yes" == $mydata->addresspublic)){ ...stuff... } if(("" != $mydata->address) || ("yes" == $mydata->addresspublic)){ ...stuff... } Those should work. Now, why do I recommend the value first? Easy. Consider... if($mydata->foo = "") // always true, $mydata->foo is now equal to blank If I do this... if("" = $mydata->foo) // an error is thrown. If I come back in and finish the comparison operator (which I needed to know was broken) it fixes the conditional statement at this point. -- John Taylor-Johnston - "If it's not Open Source, it's Murphy's Law." ' ' ' Collège de Sherbrooke: ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/ - 819-569-2064 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese with UTF-8 and mysql
Hello Mark, Monday, May 30, 2005, 4:18:20 PM, you wrote: MS> I have my settings in php.ini set for UTF-8, and the encoding for MS> the mysql database table's column that is using Japanese to UTF-8. MS> Now, if I view the data stored in that column in phpmyadmin, via MS> say, firefox, it displays in UTF-8, but, if I pull the code from MS> the database and display it in a UTF-8 set page, it is just ? MS> marks, although static J text displays fine...any thoughts on MS> this..? Driving me nutz. Cheers. Are you doing anything to the data after you've pulled it back from MySQL? Perhaps parsing it, or pushing it through a PHP function that might convert it back to Latin1? (i.e. using non-overloaded PHP functions when you should be using the mb functions) Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is -- $this variable -> $this other variable -- means?
On Wed, June 1, 2005 12:43 pm, ...helmut said: > $this variable -> $this other variable > > Means? > > I have seen it and i have "used" but I am not sure what exactly it means > in > regular English or Spanish wording that is. In Computer Science it is known as: slot property member variable depending on which language you use (Lisp, Scheme, C++, PHP, ...) Dunno what it would be in English, much less Spanish. It really isn't all that different from PHP's array indices, though in other languages the differences are magnified between an array element and -> There are also funky things you can do (in PHP, even) to trigger action (code) when somebody accesses/reads a slot, or stores data/writes to a slot. If you Google for "Object Oriented" and "Properties, Slots, Member Variables" in various combinations you should find a ton of info. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what is -- $this variable -> $this other variable -- means?
Marek Kilimajer wrote: ...helmut wrote: What does $this variable -> $this other variable Means? I have seen it and i have "used" but I am not sure what exactly it means in regular English or Spanish wording that is. read about variable variables While variable variables are useful, and a good thing to learn, they have nothing to do with the OP's question. This is calling a member function on an object (don't take my word for it though...my OO's weak). -- 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] FW: write to file, difficulty inputting data
On Wed, June 1, 2005 6:41 am, mayo said: > I need to write to file. After getting a customer's order I'm sending a > file to a distribution company. The company wants all the information in > a preset format which they will then parse. > > The problem comes when I try to put in multiple orders. In other words > how does one use > $file = fopen("/path/to/file", "a+"); > while($row = mysql_fetch_array( $result )) > { fputs($file, "whatever you want"); > } fclose($file); > > inside a variable -- or put the results into said variable > > The process I've set up is: > 1. get data from session variables, $_POST and a database > (this orderID, itemsOrdered and customerAddress, etc...) > 2. put it into a variable called $fileContent > 3. then write $fileContent to $file Actually you should *STILL* put all the crap in a database. Then, say, once a week, pull all the stuff out of the database, send it to the guy in whatever format they want, and mark the records you sent (and ONLY the records you successfully sent) as "done" Separate the capturing and recording of the data from the sending it off to somebody in whatever format they want. One, because they will probably change their format on you, or go out of business, or whatever, and then you'd have to change the guts of your form processing. Not good. Two, because when it comes time to work out what happened to "missing" orders/data, you've got a database trail of what you did. Three, because by separating the order-taking from the order-fulfillment (or, in your case, sending it off to somebody else to deal with) you are dividing your problem into two smaller, more managable chunks. Always a good idea. > Example below: > > $thisOrder= sprintf("%12d",$orderID[0]); > ... > > $fileContent= > > $thisOrder . > $_POST["shippingMethodName"] . > $a . > $b . > $c > > ; // end of $fileContent > > > Now, I would like to put my orders into $fileContent. How does one place > the output of > > while($row = mysql_fetch_array( $result )) > { > } > > into $fileContent? > > Thx. > > Mayo > > > > > > -Original Message- > From: Richard Lynch [mailto:[EMAIL PROTECTED] > Sent: Wednesday, June 01, 2005 1:13 AM > To: mayo > Cc: php-general@lists.php.net > Subject: Re: [PHP] FW: write to file, difficulty inputting data > > On Tue, May 31, 2005 5:32 pm, mayo said: >> if (!$handle = fopen($filename, 'w')) { > > This will WIPE OUT the existing file, and write a *NEW* file, from 0, > starting from scratch. > > So you'll never have anything but the LAST item. > > You could use "a+" to append to the end of the file... > > But you *SHOULD* be using a database to avoid concurrency issues. > > You're going to have a MUCH better application if you store your data in > the database, and it's EASIER than messing with a file. > > Only use a file if a database is absolutely forbidden by outside > factors. > Like badly-design homework assignments. Or not-very-smart > pointy-haired-bosses. > > -- > Like Music? > http://l-i-e.com/artists.htm > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] write to file question, rewritten
Here is a function I use to write data to a file (It is similar to PHP 5's file_put_contents but works for those who don't have a PHP 5 installation:) function file_put_contents($filename, $data, $file_append = false) { $fp = fopen($filename, (!$file_append ? 'w+' : 'a+')); if(!$fp) { trigger_error('file_put_contents cannot write in file.', E_USER_ERROR); return; }; fputs($fp, $data); fclose($fp); }; in addition to using the above code, be sure that you are writing to a folder in which you have write permissions. Once the function is available to your code you can write your data in a manner like this: file_put_contents('/root/directory/pathtoyourfile/mydata.txt',$filecontent); Mark Cain - Original Message - From: "mayo" <[EMAIL PROTECTED]> To: Sent: Wednesday, June 01, 2005 7:01 PM Subject: [PHP] write to file question, rewritten > I'm trying to write the results of a mysql_fetch_array db query to a > file and am unable to. > > I'm putting the results into a variable $fileContent and then using > fwrite(). > > I would have liked to do something like: > > $filecontent = > > . > > > $result = mysql_query( " > > SELECT orderedItems.*, items.* > FROM orderedItems, items > WHERE > orderedItems.orderID=$orderID[0] AND > orderedItems.itemID=items.itemsID > > "); > > while($row = mysql_fetch_array( $result )) > { > > $theItemID=$row["orderedItems.itemID"]; > $theItemPrice=$row["itemPrice"]; > $theItemQty=$row["itemQty"]; > > $thisItemID= sprintf("% 6d",$theItemID); > $thisItemPrice= sprintf("%7.2f",$theItemPrice); > $thisItemQty= sprintf("% 7d",$theItemQty); > > $thisOrder . > > $thisItemID . > > $thisItemPrice . > > $thisItemQty . > } > > "; // end of $filecontent > > but that doesn't work. > > Mayo > > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] building php, using mysql for apache2
--with-mysql is supposed to be the directory in which configure can find the mysql header (.h) files and the mysql library (mysql.so) underneath that directory. /usr/bin/mysql_config is a program -- a "binary" if you will It's incredibly unlikely that your MySQL header files and the mysql.so library are in files underneath this binary, which isn't even a directory, much less the directory where your header and library files are living... Try --with-mysql=/usr or --with-mysql=/usr/local or... Do this: locate mysql.h locate mysql.so Then find the common portion of the directories where those files live. Silly Example: /elephant/snake/tiger/mysql.h /elephant/gorilla/pume/mysql.so You should use --with-mysql=/elephant because that's the common portion. In theory, configure will dig around in there and find the files it needs. In reality, it expects them to be in directories like 'include' and 'lib' with maybe an intervening directory like 'local' somewhere in the mess... On Wed, June 1, 2005 5:13 am, bruce said: > hi... > > trying to build php4 with mysql4.1-12, for use in apache2. i have the > following "./compile" that works for php5. however, when i try to use it > for > php4, i get a msg, stating that it can't find the MySQL Headers... > > can anybody provide any pointers as far as what the Headers are for mysql, > and where they'd be located? if i knew the files, i could do a search to > find where they're located. > > -- > ./configure --with-apxs2=/usr/sbin/apxs --with-mysql=/usr/bin/mysql_config > -- > > thanks > > -bruce > [EMAIL PROTECTED] > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP 5 Question about OO
On Wed, June 1, 2005 3:53 am, Marcus Bointon said: > On 1 Jun 2005, at 11:38, Jochem Maas wrote: > >> all true, now imagine that you install a couple of 3rdparty php5 >> 'packages' >> and they all define __autoload() - ain't gonna work! which is why >> there has been >> discussion on internals regarding the possibility of use a handler- >> function stack >> for autoloading (in the same way that you can register a stack of >> input/output >> filter-function)... something to keep an eye on in case things >> change :-) > > I've run into this one. One way that would work for me (and initially > it's how I assumed it worked) is for __autoload to be a standard > class method like __construct, so that a class would attempt to run > its own autoloader before breaking out to the global function namespace. Maybe I'm being dumb, but how can an object's __autoload function get called when the object class definition hasn't been loaded, and that's why you're calling __autoload in the first place... That seems like classic chicken/egg situation to me... It's also incredibly likely that __autoload's being "stacked" won't work out too well. Consider this: foo software defines an __autoload Some foo_* classes get defined, autoloaded, everybody's happy. bar software defines an __autoload Some bar_* classes get defined, autoloaded, everybody's happy. Now some foo_* classes try to get instantiated, for whateve reason. bar's __autoload function is gonna kick, and that ain't good for foo_* Seems to me you'd need an array of regular expressions and the function to call: array('foo_*'=>'foo__autoload', 'bar_*'=>'bar__autoload') if you wanted to allow multiple __autoload functions to exist... I'm sure there are other ideas/solutions floating around, but that's A possibility. For performance, maybe just use stristr and 'foo_' instead of RegEx and 'foo_*' [shrug] -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Quick q, most prolly 0T
Hey, I noticed a site that is using php, but he is has shortened the url so that the filename was not shown.. eg: somesite.com/?a=1 How did they do that? if it was url rewriting it would be somesite.com/1/ so what is he using? Thanks, Ryan -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 6/1/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] .INC files
On Wed, June 1, 2005 1:29 am, Denis Gerasimov said: > Second, which way are you differ PHP .inc files from HTML .inc files? There is no such thing as an HTML .inc file. :-) All your HTML .inc files, by definition, if they are being require'd or include'd into PHP *are* PHP .inc files. It is merely a coincidence of your design that they happen to have no tags in them. You *MAY* want to separate those into another other non-web tree directory. > Third, I always write context-independent include files. Example?... Can you guarantee that ever .inc and .inc.php and .php file in every third-party application is context-independent? Suppose your client insists tomorrow that you install [insert least favority forum software here]? You *NEED* to have the policy/procedure in place to get those .inc and .inc.php and non-entry .php files *OUT* of the web-tree, or you will get bit, sooner or later. It's simply too easy to transfer a site and lose the .htaccess files, or for a new/changed httpd.conf to not have the .inc rules or mess up PHP completely or... Why risk the possibility of your code being exposed or executed out of context when it's so *EASY* to move the include files and set include_path? I just don't understand the resistance to such a simple straight-forward elegant security measure. For 5 minutes of time, you can avoid dozens of potential pitfalls. [shrug] -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Japanese with UTF-8 and mysql
Richard Davey wrote: Hello Mark, Monday, May 30, 2005, 4:18:20 PM, you wrote: MS> I have my settings in php.ini set for UTF-8, and the encoding for MS> the mysql database table's column that is using Japanese to UTF-8. MS> Now, if I view the data stored in that column in phpmyadmin, via MS> say, firefox, it displays in UTF-8, but, if I pull the code from MS> the database and display it in a UTF-8 set page, it is just ? MS> marks, although static J text displays fine...any thoughts on MS> this..? Driving me nutz. Cheers. Are you doing anything to the data after you've pulled it back from MySQL? Perhaps parsing it, or pushing it through a PHP function that might convert it back to Latin1? (i.e. using non-overloaded PHP functions when you should be using the mb functions) Best regards, Richard Davey Hi All, Richard, please view code provided below. Cheers. Mark Sargent. http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";> Jumbo Status-Product Details JUMBO STATUS Used Hardware Specialist Home href="search.php">Search width="60%"> $result = mysql_query("SELECT Products.product_id, Products.product_name, Products.product_model_number, Products.product_price, Products.product_qty, Products.product_desc, Products.product_data_output, Conditions.condition_detail FROM Products INNER JOIN Conditions On Products.condition_id = Conditions.condition_id WHERE Products.product_id = '$product_id'"); if (!$result) { echo "Query failed: " . mysql_error(); exit; } $num = mysql_num_rows($result); $rows = mysql_fetch_array($result); echo "Status-Product Details"; } for ($i=0; $i<$num; $i++){ echo "PRODUCT NAME".$rows['product_name']."align=\"center\">QUANTITY".$rows['product_qty']."align=\"center\">PRICE".$rows['product_price yen']."align=\"center\">CONDITION".$rows['product_condition']."align=\"center\">MORE DETAILSalign=\"center\">colspan=\"2\">".$rows['product_desc']."align=\"center\">DATA OUTPUTalign=\"center\">colspan=\"2\">".$rows['product_data_output'].""; } ?> email: Telephone: Fax: -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Advise needed on moderated threaded chat
One suggestion: Allow the moderator to pre-approve specific logins/users/handles for a session or if they login, forever. So after Joe User proves him/her self as a worthy chat-ter, their posts go through un-moderated. On Wed, June 1, 2005 5:21 pm, Dan Rossi said: > I've been given the bombed task of coming up with a pre-moderated > threaded chat solution. I had implemented a moderated flash chat > however with 100 users all making bulky comments to the chat guests, it > became unbearable for the moderator to check them all off in time to > make them cohesive to the discussion, as it was a java xml socket based > flash chat therefore had no threading capabilities. > > Now I dont particularly want to have to write something like this in > php, I can just see the Apache 1.3 server with a Mysql backend grinding > as there is no threading. What could be the best solution here ? I use > special tricks these days to prevent page state changing when posting > using XMLHTTP , well I am using a package called Aframe which uses > Sajax but allows for OO based services, so this could be a solution for > the posting mechanism. > > However I would need to find the best solution which will use the less > resources when posting, and refreshing, and adding moderated comments > back into the chat thread in the position when it was posted possibly > by the database primary key. If there is better ways either using > sockets to another mechanism let me know. > > Dan > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] What Works Works Validator
On Wed, June 1, 2005 3:17 pm, Richard Davey said: > Wednesday, June 1, 2005, 10:16:50 PM, you wrote: > > RL> For example, I simply can't validate with a 100% height table, but > RL> that's the only way to get the layout I want on both ancient and > RL> current browsers. > > I think you need to define, quite clearly, what you regard as an > "ancient" browser here. To my mind an "ancient" browser would be Lynx > or the early Mozilla / Spyglass builds where tables were just a dream. > > What do you regard as "ancient" ? I thought I said something about including 3.x browsers in my original post... At any rate: ancient: Browser 2.x supported: Browser 3.x Actually, I *think* I'd be okay in 2.x browsers, mostly sorta... But I'm not worried about anybody actually running 2.x 3.x is still "out there" in dwindling but non-zero numbers. > Beyond that, why not just download the browsers and install them? :) > I'm sure they're in the Evolt browser archive. It's not that I don't know what HTML to use to support those browsers: It's that I don't know that I didn't mis-type the tags in my HTML. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick q, most prolly 0T
URL re-writing can do that -- It ends up using his 'index' file (or whatever) but you don't see it in the URL. On Wed, June 1, 2005 7:25 pm, Ryan A said: > Hey, > I noticed a site that is using php, but he is has shortened the url so > that > the filename was not shown.. > eg: > somesite.com/?a=1 > > How did they do that? if it was url rewriting it would be somesite.com/1/ > so > what is he using? > > Thanks, > Ryan > > > > -- > No virus found in this outgoing message. > Checked by AVG Anti-Virus. > Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 6/1/2005 > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick q, most prolly 0T
you can do that with just an index.php file. say you have a directory called 'foo' with an index.php you can do something like this: if($_GET['a'] == 1) { echo 'blah'; } mysite.com/foo/index.php?a=1 would be the same as: mysite.com/foo/?a=1 Ryan A wrote: Hey, I noticed a site that is using php, but he is has shortened the url so that the filename was not shown.. eg: somesite.com/?a=1 How did they do that? if it was url rewriting it would be somesite.com/1/ so what is he using? Thanks, Ryan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick q, most prolly 0T
Hey, On 6/2/2005 5:17:47 AM, Richard Lynch ([EMAIL PROTECTED]) wrote: > URL re-writing can do that -- It ends up using his 'index' file (or > whatever) but you don't see it in the URL. Thanks for replying. But if I want to copy his exact way of doing things...instead of index file I would like to use main.phphow would i do that? The reason I dont think its url rewriting is the rest of the files have all their values eg: somesite.com/?blah=blah somesite.com/?something=something&do=1 somesite.com/?page=intro&flash=no etc Thanks, Ryan > On Wed, June 1, 2005 7:25 pm, Ryan A said: > > Hey, > > I noticed a site that is using php, but he is has shortened the url so > > that > > the filename was not shown.. > > eg: > > somesite.com/?a=1 > > > > How did they do that? if it was url rewriting it would be somesite.com/1/ > > so > > what is he using? > > > > Thanks, > > Ryan > > > > > > > > -- > > No virus found in this outgoing message. > > Checked by AVG Anti-Virus. > > Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 6/1/2005 > > > > -- > > PHP General Mailing List (http://www.php.net/) > > To unsubscribe, visit: http://www.php.net/unsub.php > > > > > > > -- > Like Music? > http://l-i-e.com/artists.htm -- No virus found in this outgoing message. Checked by AVG Anti-Virus. Version: 7.0.322 / Virus Database: 267.4.0 - Release Date: 6/1/2005 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Quick q, most prolly 0T
Ryan A wrote: I noticed a site that is using php, but he is has shortened the url so that the filename was not shown.. eg: somesite.com/?a=1 How did they do that? It's called a directory index. Examples include index.html and index.php. You configure this with the DirectoryIndex directive in httpd.conf. Hope that helps. Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] .INC files
Richard Lynch wrote: Why risk the possibility of your code being exposed or executed out of context when it's so *EASY* to move the include files and set include_path? I just don't understand the resistance to such a simple straight-forward elegant security measure. For 5 minutes of time, you can avoid dozens of potential pitfalls. [shrug] I completely agree with this sentiment, and it is relevant to many discussions, such as: 1. The debate between using mysql_real_escape_string() versus addslashes() or magic_quotes_gpc. 2. The debate between escaping data to be sent to the client with htmlentities() versus using str_replace() to just replace angled brackets with their HTML entity equivalents. 3. The debate between storing includes outside of document root versus using a .php file extension, instructing Apache to process .inc files as PHP, instructing PHP to deny requests for .inc files, etc. All of these discussions are a result of developers being foolish and stubborn. Just because you might not be able to think of an exploit for your particular approach doesn't mean that it's safe. Web application security is a highly specialized discipline, and unless you really know what you're doing, it's unlikely that you can properly refute practices that have been developed and refined over many years. Stick with best practices unless you are certain that they're not actually best, in which case, you should share your evidence with the community. :-) (By the way, it's faster to specify an absolute path to your includes than to rely on include_path. You can save PHP the hassle of searching.) Chris -- Chris Shiflett Brain Bulb, The PHP Consultancy http://brainbulb.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php