[PHP] simple DOM/XML test fails in php
I have a very simple DOM test set up which is failing. Environment is apacie 1.3.x, WIN xp, PHP 5.1.2 ; DOM seetings outlined in phpinfo() indicate various DOM/XML support is enabled. Failing php is: ?php $dom = new DOMDocument('1.0', 'iso-8859-1'); echo $dom-saveXML(); ? which results in: The XML page cannot be displayed Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later. XML document must have a top level element. Error processing resource 'http://127.0.0.1/domtest.php'. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] input validation?
I need to check that user input text is less than 300 characters long. How? if (strlen($_POST['input']) 300) { ... You may want to also apply trim() to the input text to get rid of extraneous white space at the beginning and end of the input. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Forum
Does anyone of you know of a good forum that is easy to customize and supports sticky notes, user registration, bb code and stuff like that? I would suggest that Phorum (www.phorum.org) and phpBB (www.phpbb.com) are the two biggies (written in PHP). Both have all these features plus many available mods. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gotta learn asp.net...
On Wed, November 9, 2005 6:54 pm, Joseph Szobody wrote: *sigh* I'm a hardcore PHP programmer.. I've been using it for over five years now, and would consider myself fairly advanced. I have a project where I'm being forced to do some ASP.NET development, which I've never touched. I need to learn it fast. Nobody has enough money to make me do ASP again. ASP.NET is leaps and bounds better than ASP. I would never use ASP but do do the occasional ASP.NET job (although PHP is my primary and preferred language). I'm not sure about learning ASP.NET fast, but you should start by: - Picking a language to use. VB Script and C# are the biggies. IMHO VB Script is easier, C# is better. - Picking an IDE. WebMatrix is free and easy to use. Visual Studio .NET is expensive and not easy to use but potent. - Knowing what database you'll be using. Probably Access (which totally sucks) or SQL Server (which kind of sucks). Other than that, I personally always start with a good book. If you do that, pick a book that uses the same language and IDE that you'll be using. Also, in my opinion, having a good knowledge of how to create a dynamic Web site helps when going from PHP to ASP.NET. If you know what the program must do in terms of functionality, protocol, etc., then it's mostly a matter of picking up the right syntax. I found that ASP.NET is the opposite of PHP: doing something simple is ridiculously hard but doing something kind of complex is pretty simple. All the built in widgets and wizards help and the form validation tools are really nice. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Fixing ID's in mySQL Table
Is there a way to fix ID sequence in a MySQL table using PHP? Basically I have some tables with a lot of records, 1000 to 5000. ‘ID’ is the Primary Key column in these tables, and at the time the code was originally written, there weren’t much verification of data being input going on. Thus a lot of junk records were being let in, which had to be deleted at some point or another. Now the ID sequence is all screwed up. It’s not in sequence anymore. You may not like this answer but you shouldn't fix this. Primary keys, by definition, should never change. Their purpose is to uniquely refer to a record. If you change the primary key of a record, then you've undermined this purpose. If you have holes in your sequencing, this isn't a problem either, as how the records are stored in the database is completely meaningless. If you need the records to be listed in some sort of order, you should add another column or table that manages that. But leave the primary key alone. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No forums?
One of the fallacies in your argument is that the lack of an official forum on php.net implies such distaste for message boards. I don't have a big screen TV but I have anything but distaste for them! Well, let me give you a different example. I don't have a TV at all, even though I could buy one. Knowing this, would you assume that I don't like watching it? No, I wouldn't, as my point is that the lack of something doesn't imply _any_one_thing_. There are many reasons why something may or may not exist. Assuming that there is such distaste for message boards is fallacious (as would be my assuming you don't like TV). The same thing with forum. It's a usual feature, just like website is. Would you be surprised if PHP had no website? Yes, I would, particularly as I've been going to it for years. Finding out that PHP had no website would definitely mess with my perception of reality. But I disagree with your theory that having a forum is implied by the technology. PHP is open source, so the fact that ANYBODY freely supports it in any way is just plain nice. Also, you should realize that your question could be rephrased as Why hasn't someone else done all this extra work (creating and managing a forum) because I would prefer it? Are you saying that I'm the only PHP user that might like discussing things on a forum? I'm pretty sure I didn't say that but I'll have to check my notes. I'm saying that you seem to be incredulous over the lack of something which you think makes sense. But my point is that there can be any number of reasons why php.net does not have a forum so the lack need not be ironic. In fact, that lack may even make sense (at least to those that run the Web site). Besides, you're implying that maintaining forum is extra work, while maintaining mailing lists isn't. Extra work for extra users you can live without, eh? Eh? What? Well, it IS extra work. The mailing list exists and, many believe, work just fine. Doing more than what is currently being done is extra, right? Or more? I'm almost positive about that. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php mac folder
I have shared my windows folder 'wwwroot' across the network but when I preview my .php file it connot find it because the specified php folder on the mac is http://127.0.0.1/~myname/Sites Actually the folder is ~myname/Sites but the URL should just be http://127.0.0.1/~myname You should not use Sites in the URL, as the Mac is already setup to redirect ~myname to the user's Sites directory. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Register Globals
mail($to, stripslashes($_POST[subject]), wordwrap($_POST [message], 60), From: $_POST[from]\r\n); and I get: Parse error: parse error, unexpected '\', expecting T_STRING or T_VARIABLE or T_NUM_STRING in /www-html/emailer/index.html on line 41 The use of $var['index'] or $var[index] ($_POST['from'], $_GET [to], etc.) within double quotation marks is causing the problem. To fix this, wrap the whole construct in curly braces: mail($to, stripslashes($_POST[subject]), wordwrap($_POST [message], 60), From: {$_POST[from]}\r\n); You only have to do this within other quotation marks and only if the array's index is a string. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] No forums?
AFAIK, there are no official forums for PHP. Considering the fact that PHP is a web development tool, such distaste for message boards is ironic at the least. So why exactly there aren't any forums on php.net? One of the fallacies in your argument is that the lack of an official forum on php.net implies such distaste for message boards. I don't have a big screen TV but I have anything but distaste for them! Also, you should realize that your question could be rephrased as Why hasn't someone else done all this extra work (creating and managing a forum) because I would prefer it? The obvious answer, which someone else has already suggested, is that maybe others (or those in charge of php.net) don't feel the need. In any case, if you are sincerely interested in either a support Web forum or a legitimate answer to your question, you may have better luck if your inquiry were more I would appreciate it if... or has an official forum been considered? and less this system that you've been using for years sucks and this is why I'm right. All that being said, I think everyone should send me $5. I've monitored this list long enough to predict the most probable replies... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] connect to MySql
I have windows XP sevice pack 1 and 2, PHPv5.0.5, Mysql v1. I am working in web design. I am unable to connect to the mysql server. Althought my php files running fine and my mysql server is also running fine. i) i had changed the php.ini-dist file to php.ini. ii)i uncommented the extensions of php_mysql.dll in php.ini file iii)i set the extensions_dir to extension_dir = D:\PHP\php-5.0.3 \ext\ in php.ini file iv)i had copied the libmysql.dll in windows\system32 and windows \system but after all these i am still getting the error Fatal error: Call to undefined function mysql_connect() in D:\PHP\teknohub\new.php on line 14 please help me to solve this problem out. You haven't successfully enabled MySQL support. You can confirm this by running a phpinfo() script. Did you restart Apache after editing the php.ini file? And are you certain you are editing the _right_ php.ini file (the one indicated when you run phpinfo())? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] setcookie() is not my friend
I'm trying to setcookie('username',$username,15552000) but on subsequent pages $_COOKIE('username') is always null. I verified that I'm setting it before any other output is sent to the browser. I verified that $username does have some valid contents. I also verified that the browsers I'm testing are set to allow all cookies. I do have a $username and a $_SESSION ['username'] that contain the same data. Well, the stupid/obvious question is: are you checking $_COOKIE ('username') like you posted or $_COOKIE['username'], which is syntactically correct? Secondarily, have you set your browser to prompt you when a cookie is sent and, if so, what happens? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP]PHP Syntax Notation
I'm trying to expand my understanding of PHP by looking at some pre- built code modules. I don't fully understand the syntax $site-Run (); in the following code. Can someone offer a helpful explanation? ?php //define(PB_CRYPT_LINKS , 1); define(_LIBPATH,./lib/); require_once _LIBPATH . site.php; $site = new CSite(./site.xml,true); $site-Run(); ? The $site variable is an object, specifically an instance of the CSite class. Run() is a method (i.e., a function) defined within this class, so the statement $site-Run() executes that function. This is basic object oriented stuff which you may not have run across before. Hope that helps, larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] colleges/schools that offer php/web development courses
can you guys give the names of any schools/colleges that have formal programs to teach web development/security applications. I was teaching one online through the University of California at Berkeley. I'm no longer teaching it but my understanding is that they'll be hiring a replacement and the class will be available again. It is a credit-earning course. The URL is http:// explore.berkeley.edu/UCExt/courseview.asp? secid=426value=relatedaction=Internet Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade
Yes, tested and verified. It was the accelerator. They have multiple binaries, one for each version of PHP. Matching the new binary to the new version of PHP solved this problem. Thanks again. Larry On Tue, 2005-08-23 at 20:35, Larry Brown wrote: Sorry, that last one went out without a comment. I think this is most likely the cause. I haven't dug back into it yet to verify, but it makes the most sense. Thanks everyone... Larry On Tue, 2005-08-23 at 05:30, Ford, Mike wrote: -Original Message- From: Larry Brown To: php Sent: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) You have an out-of-date code optimizer insatalled -- install the latest version of whichever one you are using. This is a known incompatibility -- a quick search in the bugs database would have found multiple entries about it (see, for instance, http://bugs.php.net/bug.php?id=30914, http://bugs.php.net/bug.php?id=31194, and at least a couple of dozen others). Cheers! Mike To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade
On Tue, 2005-08-23 at 05:30, Ford, Mike wrote: -Original Message- From: Larry Brown To: php Sent: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) You have an out-of-date code optimizer insatalled -- install the latest version of whichever one you are using. This is a known incompatibility -- a quick search in the bugs database would have found multiple entries about it (see, for instance, http://bugs.php.net/bug.php?id=30914, http://bugs.php.net/bug.php?id=31194, and at least a couple of dozen others). Cheers! Mike To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] foreach loop changed after 4.3 - 4.4 upgrade
Sorry, that last one went out without a comment. I think this is most likely the cause. I haven't dug back into it yet to verify, but it makes the most sense. Thanks everyone... Larry On Tue, 2005-08-23 at 05:30, Ford, Mike wrote: -Original Message- From: Larry Brown To: php Sent: 23/08/05 02:28 Subject: [PHP] foreach loop changed after 4.3 - 4.4 upgrade I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) You have an out-of-date code optimizer insatalled -- install the latest version of whichever one you are using. This is a known incompatibility -- a quick search in the bugs database would have found multiple entries about it (see, for instance, http://bugs.php.net/bug.php?id=30914, http://bugs.php.net/bug.php?id=31194, and at least a couple of dozen others). Cheers! Mike To view the terms under which this email is distributed, please go to http://disclaimer.leedsmet.ac.uk/email.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] foreach loop changed after 4.3 - 4.4 upgrade
I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) I find it hard to believe that I must rewrite every foreach loop in my application to adjust to this. After all everything I've read states that the 4.4 release was just a bug and security fix release. Has anyone seen this behaviour? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] foreach loop changed after 4.3 - 4.4 upgrade
I found that the only way to get the function to behave is to add the key... foreach($multiarray as $key=$subArray) Now it displays as it previously did where $subArray is concerned. Is there something I'm missing here? Was I the only person not using keys? On Mon, 2005-08-22 at 21:28, Larry Brown wrote: I had a foreach loop working on an array as such: $multiarray = array(array('person','person'),array('another','another')) the array was put through foreach($multiarray as $subArray){ do something with array } on each loop I would see $subArray= array([0] = 'person',[1] = 'person') and then $subArray= array([0] = 'another',[1] = 'another') In other cases person might have some other value in the [1] position. (it is being used in a function to create a select statement). After the upgrade from 4.3 to 4.4 though each iteration gives... array([0] = array([0] = 'person', [1] = 'person'),[1] = 0) and array([0] = array([0] = 'another', [1] = 'another'),[1] = 1) I find it hard to believe that I must rewrite every foreach loop in my application to adjust to this. After all everything I've read states that the 4.4 release was just a bug and security fix release. Has anyone seen this behaviour? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] [JOB] Need a Developer for PHP-MySQL Project
The National Coalition for Dialogue and Deliberation (NCDD) is seeking an independent contractor or company to perform some PHP and MySQL Web development work. In simplest terms, the Web site is a MySQL-driven content management system (CMS), written in PHP, running on a Unix/Linux server. The project can be done remotely but must be completed by the end of 2005. A full and descriptive request for proposal can be found at http://www.thataway.org/misc/ncdd_rfp.pdf Questions can be addressed to the contact person named in the RFP or by replying to this email (not to the mailing list). Thanks, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] file upload
I might have asked this already but I am still ignorent ;-) How to check if a same name file already exists in a upload directory when uploading new file? Use the appropriately named file_exists() function. L. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] rounding test fails when I try to make test
Hi, I am trying to build the latest stable release of php (4.3.10) I've successfully compiled but when I run make test the following are the two bugs that fail. FAILED TEST SUMMARY - Bug #24142 (round() problems) [ext/standard/tests/math/bug24142.phpt] Bug #25694 (round() and number_format() inconsistency) [ext/standard/tests/math/bug25694.phpt] I've been searching for the past few days and haven't been able find any resolution. From looking at the Changelog for 4.3.10 http://www.php.net/ChangeLog-4.php it shows that both of these bugs were fixed in the 4.3.10 release. But still the tests fail? Are the bugs fixed and the test case hasn't been updated? My PHP app relies heavily on round(). Any insight into this issue is much appreciated. Thanks, Larry
Re: [PHP] Passing Arrays between pages
Please can someone tell me how you pass arrays between PHP pages. $var = serialize($testArray); echo INPUT NAME = \kcompany[]\ TYPE = \hidden\ VALUE=\$var\; Then unserialize the variable on the receiving page. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
which means because I i getting a match for well over 50% of the records...its disregarding it. Yes, this is exactly the problem. Now i am in two minds if i should use this or go back to the same old dirty way...of exploding the search and using LIKE '%%' for each word FULLTEXT searches are great; it's your testing of them that is poor. What validity is there is searching through X number of identical records? This isn't a real test at all. Also, FULLTEXT searches are improved as the number of __different__ records increase. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Full-text searches sucks?
Thanks for replying. You're quite welcome. If you want to see some results, regardless of the 50% threshold, use the IN BOOLEAN MODE feature. Keep in mind, though, that in your case any search will return either 0 or 700 results. I dont want to do that as its only mysql 4.1+ compatable, IN BOOLEAN MODE was added in version 4.0.1 not 4.1, for what it's worth. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[suspicious - maybe spam] [PHP] [suspicious - maybe spam] detecting a leading hyphen from post data
I know this is pretty petty, but it is a sunday and I'm missing this for some reason... I'm trying to detect a leading hyphen in an element of an array. I've been using strpos to find strings and if getting 1 as the result, I know it was at the beginning of the string. However, -, \-, nor /^-/ give me a hit? Could someone throw me a bone here? Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] WORK WITH PHP FILES REMOTELY WITH NotePad ? YES/NO ?
WORK WITH PHP FILES REMOTELY WITH NotePad ? YES/NO ? I want to know if when be online I CAN OPEN A FILE FROM A WEB LOCATION HOST - MINE and after I modify it save it again to my hosting space WITHOUT save it to my PC first using NotePad and I mean entering the host usernamepassword when OPEN / SAVE ...? ATTENTION: I DO NOT MEAN SAVE IT TO MY HDD FIRST AND AFTER UPLOAD IT !!! TELL ME THIS SAMELY FOR Dreamweaver MX ? First of all, you need to calm down, STOP YELLING, and be less aggressive in your emails. Remember that you're asking for free help from strangers here. Second, what you are asking is a Notepad question, it actually has __nothing__ to do with PHP. Third, Notepad is a very bare bones text editor and does not have features like the one you're looking for. Fourth, a great way to see what an application can do is open it and look at the menus. Like File. Like FileOpen. Fifth, yes, Notepad can open remote files if you can connect to the remote server from your computer. This is true of any application. Sixth, can __you__ actually connect to your remote server from Windows so that you can open a networked file? Um, I'm guessing not. Seventh, many FTP applications let you set an external text editor. This would let you connect to the server, edit a file in Notepad, and save it, without saving it to your hard drive first. Eighth, many of these answers will be the same for Dreamweaver, although that's a much more sophisticated application. That being said, DW probably has the ability to open and edit remote files. You know what would be a good way to find out for certain? Check out a DW reference or open the application. Ninth, there's is no number nine. Tenth, again, this isn't really a PHP question. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving an URL paramter via fsockopen
Hi, who can give me a solution or at least a hint for the following problem: I have to get an URL parameter with an fsockopen connection. I can connect with fsockopen an given link and get back this link with an URL parameter cnr=xx Who can I do this? And who can I read this URL parameter? Thx in advance from a newbie LL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Retrieving an URL paramter via fsockopen
Hi, who can give me a solution or at least a hint for the following problem: I have to get an URL parameter via fsockopen connection. I shall connect with fsockopen to a given link and get back this link with an URL parameter cnr=xx Who can I do this? And who can I read this URL parameter? Thx in advance from a newbie LL -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OT Re: [PHP] can I compile php source
While Yes may be a technically accurate answer to a question like Can I ... or Can anyone ..., a couple of points must be acknowledged: 1) Such an answer doesn't help the original poster. Period. And the purpose of a resource like this is to help, right? Even a RTFM or search Google at least gives the user __something__ to work with (and the lesson there being that if they read the manual or search Google, they'll quickly find answers). If your argument for answering Yes is that you're teaching the user to ask questions the smart way, then why not answer their intended question AND refer them to the smart questions page? Do you honestly think people are learning __anything__ when you reply with a Yes? Moreover... 2) It's commonplace in human discourse to attempt to address the *intent* of a person's question rather than the literal question itself. If you were helping a friend re-shingle a roof and they said Can you hand me that hammer?, hopefully you would actually hand them the hammer, not say Yes. They are many colloquialisms in languages--like when someone says What's up?--and it's just obstinate not to recognize them as such and respond accordingly. Finally, if you don't agree that Yes isn't helpful and that it's an inappropriate answer anyway, how about this: such emails are a waste of resources. It's a waste of the time (.1 nanoseconds or whatever) it took you to write. It's a waste of bandwidth (at a few bits a pop). It's a waste of everyone's time in reading and deleting such emails (another second). And it tends to start a sequence of even longer, off topic threads such as this one. So, seriously, if you don't feel like helping or you don't believe that a message should be posted here because it's off topic or you don't believe that a question was phrased properly, wouldn't it be better for everyone if you just didn't respond? It'd certainly be easier. Oy vay! Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] can I compile php source
Guys, this is trivial. It takes the same effort to provide the answer to whoever this guy was, than to lecture him on how to think. Teach a person to fish ... That's a good and true adage and certainly a philosophy to be put forth by this list. But, the question is, does an answer of Yes teach a person anything? I truly suspect not. Whereas Yes, here's how, and by the way you should read this page about how to ask smart questions. teaches a person quite a bit. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] first letter
if i have for example this variable $name = John; how can i echo the first letter only so the result on the browser will be J echo $name[0]; You could also use the substr() function. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] formating output
I'm sure this is easy and I'll feel silly when I see how it's done, but, my mnd is a blank, this structure prints out a table with a new row for each item table ? While ( $results = mysql_fetch_array($pointer)) { print trtd $results[1] /td/tr ; } ? /table what I want to do is print out a table 4 columns wide and however many rows high needed to run through the data HOW do I loop through the array and get tddata/td printed 4 times then a new row started and then 4 more td cells printed, etc thank you in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] ScreenHeight?
Is there any way of getting the clients screenheight in PHP? (or do I have to do it in Javascript) You have to do it with JavaScript. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] sql insert into 2 tables
Hi there - I was wondering if anyone could point me in the right direction to be able to add data to two different tables (I am using mysql and php V4). I understand joins, etc for the query of the data, however adding the data - still getting my head wrapped around it (multiple tables). You'll need to run separate INSERT queries, I suspect. If one query relies upon a primary key created by the other, make use of the mysql_insert_id() function. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: and statement
err i mean ... an 'or' statement sry is there an 'and' statement for mysql, when you are doing multiple wheres? MySQL allows SQL statements that support both AND and OR. With OR, you can often use IN instead. SELECT columns FROM tablename WHERE (condition1) AND (condition2)... All of this is in the MySQL manual, of course. Larry PS Technically speaking, this question would have been more appropriate on a MySQL list (or the PHP-DB list). -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] alert function
In html, there is the alert() function that makes a popup with a ok button. Is there such a thing in php? Actually, that's a JavaScript function. You can't do the same thing in PHP although you can use PHP to create the JavaScript. Printing an error message, like you already had, is probably a better choice, though (IMHO). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object oriented??
Is PHP an object oriented language. If not is it gonna be? PHP is not an object oriented language (like Java). Although PHP supports the creation of objects, you can still do pretty much everything without ever using OOP. I can't imagine PHP ever being turned into a true OO language, but I could be wrong on that. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Object oriented??
Yes of course...but was confused since some says it is so and some says it is not...So thought of asking the pros.. It is. PHP4 had limited support for OOP, though it was quite usable. PHP5 goes further and provides pretty much everything else. See the documentation on php.net for the complete language reference. I guess this is where the OP's confusion stemmed from (Robert said Yes, I said No)! A liberal definition of OO is An adjective applied to any system or language that supports the use of objects, under which PHP would qualify. But, in strict OO languages, everything must be done using objects. You can't even do a simple Hello, World without them (I could be wrong on this, of course). With that understanding PHP would not be OO. So, in short, PHP __supports__ objects but does not __require__ them. There's a good chance that 20 people will chime in now, with their own corrections. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] getting screen resolution
is there a function that gets the screen resolution of the user? you can also reply directly to me... [EMAIL PROTECTED] No, you cannot get the screen resolution using PHP. You must use JavaScript. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] User Screen Resolution
I am new to PHP and couldn't find any Globals for the User's Screen Resolution. (don't laugh at me please) I used to use a Javascript function to pass the resolution using screen.width and screen.height. What I am actually trying to do is make a page resize depending on screen resolution, in case that helps anyone. Using PHP you can neither find the screen resolution nor resize the browser window. Both must be accomplished using JavaScript. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mac OS X and Editor
Hi guys, I just like to ask those using Macs here as to what editor and/or IDE they are using for writing PHP codes. BBEdit is generally consider to be one of the best (note: I said one of the best, not best, so let's not start about how emacs, vi, and vim are better) text editors available on any platform. It's very easy to use yet powerful (supports grep, works with Xcode, has command line tools, etc). The new version 8 ties into Apache, letting you test PHP scripts in the application. It's a text editor, not an IDE, though. There are PHP- and SQL-specific libraries built in so that it recognizes function names and such. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] empty variable
What is the best way to determine if a variable is empty? I have a feeling there is a better way than the way I'm doing it now... if ($variable == ) You could try the empty() or isset() functions, depending upon exactly what you're wanting to test. See the manual for descriptions of both. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] xml tags interfere with php tags
How do I get an xml tag to work with a php script? ?xml version=1.0? php is trying to parse that. Either turn off the Short Tags setting in your php.ini file or have PHP echo out that line. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Does this beginner's book exist?
Does a book for complete beginners exist that also demonstrates basic good programming practices, has decent examples, and perhaps exercises/quizzes (not as important as the first two)? The newest edition of my PHP for the World Wide Web: Visual QuickStart Guide takes into account register globals and addresses new additions in PHP 5 (as well as those things in PHP 4.3.x). It still doesn't have quizzes or exercises, though. Best wishes, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extra byte added to PDF streaming file
I've seen cases where extra buffer content gets added to the downloaded file. The problem was fixed by deleting any existing buffer before sending the file to the client. Not sure that will solve the problem but it's worth a shot. How does one delete an existing buffer? ob_end_flush();? ob_end_clean() For future reference, you should normally reply to the entire PHP list, not just to the person replying to your message. That way you're not imposing upon a person trying to help and you're not waiting for that one person to respond. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Extra byte added to PDF streaming file
It appears as though some readers (such as adobe acrobat) can read this file fine yet others (such as the program gv in *NIX) cannot read it. The reason for this is that somehow a hex 0A is added before the inital %PDF-1.2 which marks the start of the PDF file causing some readers to not recognize it as a PDF file. Is there anything in this code which could possibly (always) cause an extra byte (0A) to be added before the real start of the file? And no, the file is not corrupted (I've already tried that) - this only happens when it goes through this script, and not loaded directly as example.com/file.pdf. I've seen cases where extra buffer content gets added to the downloaded file. The problem was fixed by deleting any existing buffer before sending the file to the client. Not sure that will solve the problem but it's worth a shot. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] viewing PHP files on Internet Explorer 6
Rocky, First off, when working with mailing lists like these, you generally should reply to the entire group, not to an individual person. Doing so takes the burden off of the person who initially replied to you. Moreover it means that you won't have to wait for that one person to get back to you. Thanks Larry, but how do i save my php files to http://localhost? I don't understand if this is a subdirectory in apache or not. You don't mention your OS but I assume it's Windows. I forget the details and it depends upon your installation of Apache but you'll want to save your files in a location like C:\Apache\www. You can always check the Apache documentation for assistance on things like this but it should be a 'www' folder. Because when i do access the php scrips via URL (e.g. http://localhost/test.php) i get an error message saying the page does not exist. It is currenly saved in a regular folder away from apache. Yeah, you need to place the files in the Web root directory. Larry PS I've cc'd the list on this message, to widen the knowledge loop. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Is Function Constants the Correct Term?
I have been experimenting with defining functions as constants. Below is what I am using to test Function Constants: pre ? define(LOGIN,user); define(PASS,pass); define(DB,mysql); define(DBLOGIN,dblogin(LOGIN,PASS,DB)); This is simply not allowed. see: http://php.net/define Can you elaborate on what is not allowed? Are you saying defining function constants are not allowed or are you saying redefining constants are not allowed? I believe the answer is that both concepts are not allowed. Constants, by their very definition, cannot be redefined (except for magic constants, which is a different thing). Also, constants must be set as scalar values. PHP doesn't support function-like macros as you might have seen in the C preprocessor. This is all in the PHP manual, under define() and constants. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] viewing PHP files on Internet Explorer 6
So I have Internet Explorer 6.0 with XP and have also installed Microsoft .NET framework 1.1. I can't get my .php files to be viewed with my web browser. html files are diplayed okay but with php files i get a blank screen. I guess i need plug-ins for Internet Explorer but i thought that .NET covered that. Btw, I'm using Apache 2 and MySQL 3.23 with PHP 5.0. Can anyone give me a helping hand? Thanks A couple of suggestions: - Make sure you're accessing the PHP scripts via a URL (http://localhost/mypage.php) - Turn on display_errors in your php.ini file and then restart Apache. It's possible you have an error which is causing the blank screen. - If all else fails, run a simple phpinfo() script: ?php phpinfo(); ? to test your PHP installation. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP on MAC
We've just bought a new Power Mac G5 Macintosh computer for the office and I'll need to do some backend engineering work using it. I've never worked with PHP on MAC, so I really have no experience with what happens on a MAC... are there on issues regarding working with PHP on a MAC? Not at all. OS X is essentially Unix and you've already got Apache built in. I believe it comes with PHP installed (but not enabled) but I would recommend using Marc's installer from www.entropy.ch. This will give you the most current version of PHP (normally). In short, PHP is great on a Mac. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] displaying database results with forward and back buttons
I have a query that returns lots of rows so I want to display the results in blocks of 25 or so on my web page and have forward and back buttons to navigate the results. Can someone point me in the right directions please I have tried to look around for something using google but cant think of a suitable search term I think pagination might be the term you're looking for. I'm pretty sure there's a PEAR class which will help with this or you can check PHPBuilder.com or Zend.com for articles on the subject. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] get the month's last day
how can i retrieve the last day of the month? like 31 - Jul, 30 - Jun , 28 - Feb ?php $month = 8; $year = 2003; $lastdayofmonth = mktime(12,0,0,$month+1,0,$year); ? You could also use the date() function with the t parameter. Of course, that also requires a timestamp... Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Unable to retrieve value from database and echo on screen
/* Select User's First Name From Table */ $sql = SELECT UserFirstName FROM RegisteredMembers WHERE UserID='$_POST[TXT_UserID]'; $result5 = mysql_query($sql) or die (couldn't select UserID from database); $num = mysql_num_rows($result); /* Welcome Registsred Member */ echo welcome to the registered members area ; echo ($result); There are a few problems here: 1) Your query result is assigned to $result5 but then you use $result in the mysql_num_rows() function. 2) You never fetch any information. You need something like $row = mysql_fetch_array($result5). 3) You're trying to print the query result when you should be printing the fetched information like so echo $row['UserFirstName']; Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] help ???
I wonder why my website runs smooth in PHP 4.1.1 but it does not in 4.3.7. Without knowing any relevant details at all, I would suggest that the settings are different between the two servers, particularly register_globals and magic_quotes. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Error Reporting
I ave a strange problem with my error reporting! I have set php.ini to: error_reporting = E_ALL but I don't see any errors. (After I was happy things were working on my Apache Test Server, I uploaded to my web host and discovered errors.) Make sure that display_errors is on and that you restart the Web server after changing the php.ini file (as another responder already pointed out). Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Printing invoices
I would highly recommend pdf. I use it for different reports. I use pdflib which my employer has gratiously afforded; however, I believe there is an open source version. I don't know how well it works, but pdflib creates some really attractive results. Larry. On Sun, 2004-06-20 at 19:33, Manuel Lemos wrote: Hello, On 06/20/2004 08:30 PM, Bskolb wrote: Could someone direct me to a printing solution from a static document that would render variable data elements to be sent to a printer queue? I was thing perhaps of an RTF for the static page, but can't seem to locate any way of inserting the variable data, then spit out each occurrance to a printer. If HTML would not do, how about sending in PDF as attachament? You may want to try this class that can either send HTML messages or messages with attachments: http://www.phpclasses.org/mimemessage -- Regards, Manuel Lemos PHP Classes - Free ready to use OOP components written in PHP http://www.phpclasses.org/ PHP Reviews - Reviews of PHP books and other products http://www.phpclasses.org/reviews/ Metastorage - Data object relational mapping layer generator http://www.meta-language.net/metastorage.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] post data
im posting a form to itself... and im wondering if there is any way to clear the post data from the page after if have dealt with it? $_POST = array(); Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] session_start() warnings
When I use session_start function, I receive the following warning messages: Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/w4t3c101/public_html/ListClientInfo.php:2) in /home/w4t3c101/public_html/SessionControl.php on line 9 Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/w4t3c101/public_html/ListClientInfo.php:2) in /home/w4t3c101/public_html/SessionControl.php on line 9 Can anyone explain why it happens and how to solve the warnings. Thanks :) Something on or about line 2 of ListClientInfo.php is sending data to the Web browser. This could be HTML, plain text, or blank spaces. Get rid of that and you'll get rid of the warnings. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] export from mysql to csv file
Can anyone point me to an existing script or tutorial to learn this? I'm fairly sure there's a tutorial at PHPBuilder.com or Zend.com. Or you can check the PEAR modules for code (I know there are database to Excel classes). If all else fails, Google's always helpful. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] previous page
Thanks all makes sense, but, if I add this: ?php echo($_SERVER['HTTP_REFERRER']); ? I don't get anything back when the page is called? Yes, that can happen, which is why I said it wasn't perfect. I think using some sort of form to go through is the better option. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] previous page
I have a .php page I don't want anyone being able to just open it unless they've been through a previous page that is a disclaimer http referrer etc come to mind but not exactly sure how to implement it in PHP. Yes, you could check the value of $_SERVER['HTTP_REFERRER'] but that's not perfect. Instead, you could have the previous page contain a form with a special hidden input. The form is submitted to the protected page, where you check for that hidden input's value. If that protected page doesn't receive $_POST data containing whatever meaningful data, redirect them accordingly. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Newbie question about good coding practice [isset]
if($var) do something; verses if(isset($var)) do something; The simple form if($var) seems to work fine and I see it in code often. Is there a good reason for using isset? Yes, if you don't use isset(), you may see notices (errors) if the variable is not set. This depends upon the error reporting settings of the server. However, if you use isset() you won't see notices regardless. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] mail() problem
Sounds like a problem for the maintainers of the spam blocking software? You can't correct the problem with the headers if you don't know what the spam software is objecting to. It may be objecting to the fact that the source is 127.0.0.1? -Original Message- From: Rick [mailto:[EMAIL PROTECTED] Sent: Wednesday, June 02, 2004 8:35 PM To: [EMAIL PROTECTED] Subject: [PHP] mail() problem Hi All, Does anyone know a good format for sending email using the mail() function that doesnt get stopped by antispam software? I need to send and email from my sever when a new member creates an account, this ive done but my email gets binned straight away? must be the headers? Regards Rick -- 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] Simple preg I think
That works for me... $testVal = this is the ./command; if(preg_match(/\.\//i, $testVal)) { echo hello; } This printed hello, then I removed the slash and it did not match and did not print hello. Sounds like it is a logic problem, or the variable is not arriving as you expected. -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED] Sent: Sunday, May 30, 2004 6:55 AM To: [EMAIL PROTECTED] Subject: [PHP] Simple preg I think Hi List, How do I match an accordance of ./ in a string (without the quotes) ? I have tried preg_match(/\.\//i, $str); Which I thought would work , as per the manual, but no joy. Any help or guidance is appreciated Thank you in advance Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.692 / Virus Database: 453 - Release Date: 28/05/2004 -- 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] array key starting with digit ending with string
I have an unusual situation where I have to communicate with an MS based soap server. They have named one of their variables with a name leading with a 1 such as 1variable. Nusoap loads the variable descriptions from the wsdl document and compares the variable names I am trying to send with the ones listed in the wsdl. In this process my sent to the function is something like $data = array('thisvar'=$myFirstVar,'thatvar'=$mySecondVar,'1othervar'=$myLastVar ). Later when the variable names are cycled through on a loop the following test is used... if($data[$currentVarNameInCycle]) { do something } Is there some way force the recognition of the key when it leads with a digit? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Finding Screen Size
I know it's easy to find the screen res of a user from javascript- but I want to let my PHP script know what the resolution is. Is this possible? I would like the easiest way possible- I'd rather not resort to sessions/cookies. Is there a way to make a variable available to PHP? I find the get_browser function really useful for the browser info but it doesn't tell me the res. This comes up occasionally here so you can check the archives for different solutions. But the basic answer is that you CANNOT use PHP to find the screen size. You must use JavaScript and then pass these values to PHP using cookies, forms, etc. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] session var puzzle
In the last pair of examples where it fails, you know you are first assigning the value of $Data['ID'] to the $_SESSION['CategoryID'] and the over-writing that value with the value of intval($Data['ID'])? Why are you assigning $Data['ID'] to it if you are going to overwrite it? If those other tests work then I doubt that it is a session problem. I'd double-check to make sure that $Data['ID'] is holding a reasonable value. -Original Message- From: Kathleen Ballard [mailto:[EMAIL PROTECTED] Sent: Sunday, April 18, 2004 6:46 PM To: [EMAIL PROTECTED] Subject: [PHP] session var puzzle Dear list, I am sorry for the second posting, but this is going to drive me to drink something other than lattes! I have one page, index.php. when it calls mod_sub, a directory type of page is printed. Here I am trying to set a session var of the most recently selected category to allow the user to return the to same place in the directory. when I do this: $_SESSION['CategoryID'] = 230; in mod_sub then in mod_profile: print($_SESSION['CategoryID']); will print 230 when I do this: $Tmp = 230; $_SESSION['CategoryID'] = $Tmp; in mod_sub in mod_profile: print($_SESSION['CategoryID']); will print 230 BUT, when I do this: $_SESSION['CategoryID'] = $Data['ID']; in mod_sub $_SESSION['CategoryID'] = intval($Data['ID']); in mod_profile: print($_SESSION['CategoryID']); will print '' and 0 I am setting several other session variables throughout the code without any unexpected behavior. I have even tried changing the index to something odd in case I am resetting 'CategoryID' somewhere and forgotten it. But no matter what I try, once I set it = $Data['ID'] I get the odd result. BTW, if I print $_SESSION['CategoryID'] from mod_sub right after setting, it holds the expected value. This is really frustrating, I must be missing something basic about the way session vars can be set. Kathleen -- 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] how to validate a domain
According to google there are several soap services that offer whois. It looks like a lot of them are old outdated links, however some still seem to exist. I'm not sure how anyone could ever profit from free soap services unless they gave the service for free for long enough to become the standard and then start to charge. I'm guessing that is why a lot of the older links no longer exist. http://wavendon.dsdata.co.uk/axis/services/WhoisData?wsdl responded to generate the schema. I don't know if they search all of the domain names or not either. Larry -Original Message- From: Vail, Warren [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 13, 2004 9:45 PM To: 'Elliot J. Balanza'; [EMAIL PROTECTED] Subject: RE: [PHP] how to validate a domain If you register as a domain name reseller, your registrar provider will usually provide you access to checking which domains that are available, sometimes beyond the usual .com/.net/.org/ etc. top level domain. you should be able to Google a list. I don't know of any that are free anymore. Warren Vail -Original Message- From: Elliot J. Balanza [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 13, 2004 7:21 PM To: [EMAIL PROTECTED] Subject: [PHP] how to validate a domain I used to use a socket to whois database to validate if a domain name is available or not. Now i can't do that cause whois requires different parameters does anyone knows how i can validate if a domain name is available or not true .php? Vamp -- 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] Cookies
Does Any One Knows How To Set And Get Cookies? The PHP manual is really good for stuff like this. Check out the setcookie() function. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] $HTTP_SESSION_VARS still holds original values even after unset?
Something else in your code is messing you up if you cannot change the value after setting it in the first place. This happens all the time in my code as my client makes decisions along the way. Try a small test creating a session variable, displaying it, changing it, and redisplaying it. If it does not show the change, post the test code so we might be able to tell why it fails. Provided you can change the variable, you should be able to create a loop that sets all the variables to or some base values etc. Larry -Original Message- From: Andy B [mailto:[EMAIL PROTECTED] Sent: Sunday, April 04, 2004 6:03 PM To: [EMAIL PROTECTED] Subject: [PHP] $HTTP_SESSION_VARS still holds original values even after unset? how would you empty all the contents of $HTTP_SESSION_VARS when you dont need them anymore but still keep the current session running? the problem seems to be that when i try to fill them with something else (dont need the original values anymore) but need new ones without destroying the session itself they wont fill with new things. unset($HTTP_SESSION_VARS); does nothing to help at all because they still have the same values that they were originally filled with (and not to mention they are still in the session)... anybody have any ideas how to delete or empty out the array but keep the session active ?? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] php as default value in html
When someone pulls up a form and fills it out, they subsequently submit that form. When submitting a form your browser creates a one on one connection with the server where the server inputs the data from your form before or after the next person without mixing the two. (no matter if the two submitted simultaneously it know who is who) -Original Message- From: Andy B [mailto:[EMAIL PROTECTED] Sent: Sunday, April 04, 2004 1:35 PM To: [EMAIL PROTECTED] Subject: [PHP] php as default value in html is there any way to keep multiple users using the same form from mixing up variables I have no idea what you mean here. if user #1 logs in and starts using a form and then user #2 logs in and starts using the same one as user #1, say by chance they submit it at the same time... is there any way to keep the forms from overwriting each other... -- 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] passing variables
When using a link like xxx.proceed.php?language=gbr the 'proceed.php' script does not receive any $language variable. Does someone know how to get it run? This is a register_globals issue. Refer to $_GET['language'] instead of just language. Or, at the top of your script, add $language = $_GET['language']; and you shouldn't have to change anything else. See the manual for $_GET and $_POST for more information. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] multi-dim array from text file
Hi, I need to do some text file manipulation of a text file from an html interface. I have a file with multiple lines where each line has 2 fields each (a mac address and an associated vlan). Here's an example of rht text file: /tmp/TEST: a1b2.c3d4.e5cc VLAN3 a1b2.c3d4.e5dd VLAN4 a1b2.c3d4.e5ee IS a1b2.c3d4.e5ff VLAN6 a1b2.c3d4.e5a1 VLAN7 a1b2.c3d4.e5b2 VLAN8 a1b2.c3d4.e5c3 Printer a1b2.c3d4.e5d4 Guest a1b2.c3d4.e5e5 IS a1b2.c3d4.e5f6 VLAN6 a1b2.c3d4.e5a2 VLAN2 a1b2.c3d4.e5a3 VLAN4 Being an admin and not a developer of any kind, I'm having trouble reading in the file and being able to output specific lines and fields of a php array. This is what I have so far: HTML HEAD TITLEMAC address Listing/TITLE /HEAD BODY ?php $CnfRec=array(); $CnfRec=file(/tmp/TEST); foreach ($CnfRec as $line) { $CnfRec=explode( ,$line); echo LINE: ; print_r($line); echo CnfRec: ; print_r($CnfRec); echo P; }; ? /BODY /HTML What I want to eventually do is read in the records and fields of this file, present it as a form, allow admins to modify the second field and write that back to the text file (while backing up the original file). As a reference, I handle it in a completely different way, but this is how I'd kinds like things to look visually ( just one submit button would be preferable): == HTML HEAD TITLEMAC address listing/TITLE /HEAD BODY ?php echo table border='1' align=center\n; echo tr BGCOLOR='#99CCFF'th width=150MAC Address/thth width=150VLAN/th/tr; $res = system(/bin/sort -k 1 /tmp/TEST | /bin/awk '{ print \tr align='center'td\$1\/tdtdFORM METHOD=POST ACTION='/cgi-bin/change_mac-vlan_list.sh'SELECT NAME='VLAN' OPTION SELECTED VALUE='\$2\'\$2\/OPTION OPTION VALUE='VLAN0002'VLAN2/OPTION OPTION VALUE='VLAN0003'VLAN3/OPTION OPTION VALUE='VLAN0004'VLAN4/OPTION OPTION VALUE='IS'IS/OPTION OPTION VALUE='VLAN0006'VLAN6/OPTION OPTION VALUE='VLAN0007'VLAN7/OPTION OPTION VALUE='VLAN0008'VLAN8/OPTION OPTION VALUE='Printer_VLAN'Printers/OPTION OPTION VALUE='Guest'Guest/OPTION/SELECTINPUT TYPE='SUBMIT' VALUE='Change'/FORM/td/tr\ }' ); ? /BODY /HTML == TIA, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] debug on build
Does anyone know what --enable-debug gives you when building php? Does this hinder normal operation of php or just take a small hit in performance to be able to render more debug information when needed? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Letters and Numbers limitation
Form takes parameter username, so I want to accept username taht includes only numbers and letters. How can I check if variable contains only letters and numbers? Use regular expressions. See the PHP manual (for PCRE or POSIX) for more. You'll also find a number of tutorials online about validating form input with regex, I suspect. Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Let's start a php-advanced list!
what do you guys think of using a tag for discussion messages? This way people that don't want to weed out lengthy discussions and attachments etc can filter them out of list messages. A tag such as discussion in the subject line? Just my two cents. Larry -Original Message- From: Marc Greenstock [mailto:[EMAIL PROTECTED] Sent: Saturday, March 06, 2004 7:57 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Let's start a php-advanced list! Interesting topic, However I don't necessarily agree that newbie's wont get their question answered. There are a lot of helpfully people out there, a lot of them are advanced in their programing but find the satisfaction of helping, or mentoring someone into advanced programming who is less advanced. I know that when i started I posted messages at phpbuilder in the newbie area. I found more often than not I would get a response from someone who cared, and would treat a newbie for what he or she is rather than a just a plain old idiot. My point is; yes advanced users would be separated from beginners, but most of the questions asked in the beginners list would be answered by advanced programmers looking for a bit of 'fuzzy wazzies' :) Two thumbs up for the idea. Marc Ryan A wrote: This has come up many times before and I really don't think it will work. Splitting advanced users from beginners means that there will be nobody to answer the beginner questions which means they will get posted to the advanced list where the people with the answers are. It is a self-defeating separation. Having everyone in one big lump means that both camps and all the camps in between learn from each other. The other question is who decides what is advanced? Chances are what you think is advanced may seem trivial to me, or vice-versa. -Rasmus True, When I started learning PHP one of the guys who answered most of the questions for me and a lot of people was Capt John Holmes, now that dude knows a load of php (I mean that as a complement). If there was an advanced list he would probably be in it and very unlikely that he would also be in the newbie list to help which would have made my learning curve that much harder. Some other guys who are really helpful and advanced are Jason, Chris, Chris, David to name a few..take all of them out and put them in the advanced list...and the newbies, not-so-newbies etc will follow just coz we have no choice when we run into problems. If only newbies and average knowledge dudes are in the not advance list it wont work coz the blind leading the blind does not work. My $0.2 Cheers, -Ryan -- 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] Re: RFC: Job listings
I don't see how it could be to anyone's disadvantage. As a matter of fact, I think that it would be great to also have it available as a soap service as well. If people well versed in different open source projects were able to be listed on each projects' sites and provide soap service as well, anyone could create an all-encompassing list of open source tallent at any one place on the web and pull from all of the resources. Sounds great for the unemployed and the employers. -Original Message- From: Ben Ramsey [mailto:[EMAIL PROTECTED] Sent: Sunday, March 07, 2004 8:05 PM To: [EMAIL PROTECTED]; Anders Hellström Subject: [PHP] Re: RFC: Job listings Anders, I think this really depends on how we get the word out to employers about this service. I, for one, hope to use the new Atlanta PHP (http://www.atlphp.org) group as a resource not only to educate and network PHP developers, but as a way to bring knowledge of PHP to the business world in the southeastern US. I think that local user groups worldwide will need to take part in promoting such a thing to the local business owners. -Ben Anders Hellström wrote: Hi, I'm one of the volunteers working on PHPCommunity.org. There's been some talk about having a Job Listings section on the site, something along the lines of jobs.perl.org, and We're wondering how much interest there is in such a service. I'm sure all the unemployed PHP developers on the list would like it, if companies actually used it. So the biggest question is probably if companies looking to hire PHP developers would use it. I would really appreciate it if you could reply to this message, off-list, if you're interested in this or have anything to say on the topic. Please mention in what way you're interested, if you're in a position to hire people, looking for work, etc. Anything you feel is relevant. All comments are welcome, both positive and negative. I can be reached at [EMAIL PROTECTED] Looking forward to reading your comments! Thanks in advance, -- Regards, Ben Ramsey http://benramsey.com http://www.phpcommunity.org/wiki/People/BenRamsey -- 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] scope problem
Apparently I'm having some kind of meltdown here. Can anyone explain the logic behind why the following variable has the original value and how I can pull/push the value to access it at the end? while loop { $variable = 100; while loop { switch($othervar) { case 1: $variable = $variable + 100; break; case 2: $variable = $variable + 200; break; case 3: $variable = $variable + 300; break; } echo $variable.br; } echo brThe final value is .$variable.br; } This gives values something to the tune of... 200 400 700 100 I usually have variables set outside of a while loop that increment based on the contents of the loop and I could swear that they hold the value on the other side of the loop. I don't usually use break; in my scripts unless I'm using switch. However, I would think that if using break was throwing me, that the value wouldn't print on each cycle of the loop. TIA Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] scope problem
Thanks for the help, but it turned out to be the nut on top of the keyboard! Something I missed. Good to know my concept of scope with php is still healthy (at least). Thanks -Original Message- From: Richard Davey [mailto:[EMAIL PROTECTED] Sent: Friday, March 05, 2004 11:17 AM To: PHP List Subject: Re: [PHP] scope problem Hello Larry, Friday, March 5, 2004, 4:01:39 PM, you wrote: LB This gives values something to the tune of... LB 200 LB 400 LB 700 LB 100 Hard to say with so little code, but... Your first where loop is probably running twice, i.e. resetting variable back to 100 after the 2nd (internal) where loop has finished modifying it. Move $variable = 100 above the first where loop and see what happens. -- Best regards, Richard Davey http://www.phpcommunity.org/wiki/296.html -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP (and optionally MySQL) textbook
I am looking for suggestions for a textbook for an undergraduate class introducing PHP and MySQL (using PHP, not MySQL administration). Right now I am using the McCarty book PHP 4 A Beginner's Guide but there might be new and/or better books out there? Both my PHP for the World Wide Web: Visual QuickStart Guide and my PHP and MySQL for Dynamic Web Sites: Visual QuickPro Guide are being used for similar classes at Northwestern, Penn State, and in high schools. People say they're pretty good, particularly for beginners. For the online PHP class I teach through Berkeley, I use one of Julie Meloni's PHP books (couldn't use my own, in case you were wondering). Her books are great for beginners, although there's a lot of overlap between the two so pick just one. Finally, the Welling/Thomson PHP and MySQL for Web Development (or something similar to that) is excellent. A bit more expensive and more advanced in focus, but very thorough and well written. Hope that helps, Larry -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] [Q] Problems invoking a PHP script - Have no hair left to pull - Please help [:-)
is the html code you have listed below the file register_new_member.php? Is it in the same directory as the previously successful script? -Original Message- From: news [mailto:[EMAIL PROTECTED] Behalf Of Michael T. Peterson Sent: Tuesday, February 10, 2004 9:48 PM To: [EMAIL PROTECTED] Subject: [PHP] [Q] Problems invoking a PHP script - Have no hair left to pull - Please help [:-) I have a registration form which collects some data then, when the user clicks the submit button sends the data to a second page (a PHP script). The problem I'm having is getting my webserver (apache) to invoke the PHP scrip to process the data. What's so baffling about this is that I've already written another, similar facility ( a login form which sends user supplied info to php script for authentication). The login app works great. The registration app doesn't even tho' the registration app is semantically and syntactally identical to the login app. I think what's happening is I'm missing something really simple. Does anyone have any suggestions as to what I need to be looking for? I've been at this for about 5 hours now and am going crazy looking at this [very simple] code. Finally, in my php.ini file display_errors is set to ON (But no errors are displayed or written to error log). Here's the form code fragment in the file member_registration_form.html: ... form name=member_registration_form method=post action=register_new_member.php ... And here's the preamble and the PHP block in the file, register_new_member.php: html head titleNew member registration/title meta http-equiv=Content-Type content=text/html; charset=iso-8859-1 /head body hr h1Registration Results/h1 hr ?php print( Hello world.);// This doesn't get executed. ? /body /html Again, no are any errors displayed or logged. Any help would be greatly appreciated. Cheers, Michael -- 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] SQL help
Correct me if I'm wrong...PLEASE.. but, I believe you are looking for... SELECT * FROM user_data left join image_data on user_data.User_ID=image_data.User_ID where image_data.Default_Img = 'Yes' GROUP BY user_data.User_ID I haven't used enum('Yes','No') so I'm taking your word for the fact that you are restricting your selection to values of 'Yes' works as anticipated. As long as there is a one to one relationship on user id I believe the left join works for this. Larry -Original Message- From: Marc Greenstock [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 10, 2004 9:53 PM To: [EMAIL PROTECTED] Subject: [PHP] SQL help Hi all here's my problem, I have two tables: 'user_data' and 'image_data' obviously user_data has all the user information and image_data has all the image information in image_data are the fields: Image_ID int(11), User_ID int(11) and Default_Img enum('Yes','No'). Users can have as many images as they like, but it is optional. I want to select from user_data and image_data and get the results based upon the rest of the query. The problem is my sql is only pulling out the users with images and ignoring the rest my sql looks like this: SELECT * FROM user_data, image_data WHERE user_data.User_ID = image_data.User_ID AND image_data.Default_Img = 'Yes' GROUP BY user_data.User_ID thanks for your help. -- 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] check if user session exists
I don't know of a function, but you could possibly read the directory where the SID files are stored. I use sessions a lot; however, I've not tried to accomplish this. I don't know if by default you can read the SID directory from a script or if this is blocked for security reasons or not. If not, you could read the directory, match the SIDs from your list and go from there. There is no way of knowing if the person is still actively using the SID this way though. Larry. -Original Message- From: Christian Calloway [mailto:[EMAIL PROTECTED] Sent: Monday, February 09, 2004 9:28 AM To: [EMAIL PROTECTED] Subject: [PHP] check if user session exists Given a set of session id's, is it possible to query whether a given session exists. I am not talking about the current user session, instead I am referring to any and all possible user sessions currently in play. For example: if (session_exists($sessionId)) doSomething(); I've been looking very hard for this one and haven't found an answer at all. Any ideas? -- 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] Session troubles
I know I may be displaying severe ignorance, but I have to ask... What do you mean by this page also uses paging? What is paging? Larry -Original Message- From: DL [mailto:[EMAIL PROTECTED] Sent: Tuesday, February 03, 2004 4:20 PM To: [EMAIL PROTECTED] Subject: [PHP] Session troubles Hi all, I am using PHP v4.12, and here is the scenario. I have one page, index.php with a form that has a searchfield (dropdown) and searchcriteria (textbox). When submitted I want to populate two session variables with the form values of searchfield and searchcriteria. This page also uses paging, and whenever I click next, my session variables seem to die. I have globals turned on. So basically, we the page initially loads I display all the results from a db query. Paging works fine. If someone submits the form, I want to populate two session variables and build a new sql statment based on the user input. Clickling next or previous should retain the same search results until the user submits the form again or those session variables expire. Help please. Cheers, David -- 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] Seems Simple enough
you need one of the to if's to be either $Balance =1 elseif($Balance 1000) or $Balance 1 elseif($Balance = 1). Yours has the first saying everything equal to or greater than 10001 which 1 is not else everything less than or equal to which 1 is not. =) Larry -Original Message- From: Christopher J. Crane [mailto:[EMAIL PROTECTED] Sent: Monday, January 26, 2004 11:29 AM To: [EMAIL PROTECTED] Subject: [PHP] Seems Simple enough I have these lines of code, that I thought was simple enough, but it doesn't work how I thought. The Variable $Balance is set to 1 in the database, and I thought it would be outputed as purple or the be found true of the else part of the code. It comes out as red or the elseif part of the code. if($Balance = 10001) { echo font color=\green\\$$Balance/fontbr\n; } elseif($Balance = ) { echo font color=\red\\$$Balance/fontbr\n; } else { echo font color=\purple\\$$Balance/fontbr\n; } I originally had it as follows, but that didn't work either. if($Balance 1) { echo font color=\green\\$$Balance/fontbr\n; } elseif($Balance 1) { echo font color=\red\\$$Balance/fontbr\n; } else { echo font color=\purple\\$$Balance/fontbr\n; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Variables not working!
It is most likely globals. Access the variables by... echo $_GET['fname']; or $_POST['fname']; if you are using post which it doesn't appear you do. Larry PS it is adviseable to leave globals alone in php.ini since it is set that way for security concerns. -Original Message- From: Kaushan [mailto:[EMAIL PROTECTED] Sent: Monday, January 19, 2004 10:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Variables not working! Hi, I am new to PHP scripting and struggling with the following problem. I have two files, an HTML file and a PHP file. HTML file contains a form with one text field and a submit button. When a user pressed the submit button, it calls the php file (form action=test.php ...). What the php file does is just echo back the text received from html file to the user again. Name of the text field is 'fname'. When I used this variable in the php file (as $fname) it does not contain the value of the text field. Query-string appended to the url during the submission is also correct. I checked for all syntax errors, but the codings are perfect. Do I have to change php.ini file to fix this problem. Could anyone can help me to solve this problem. Kaushan -- 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] Is this possible ?
Toby's solution still holds in this scenario. Actually exactly has you have rem'ed out. You get back two components to the array, first array[0] holds the concatenated string you made with the while loop and the second array[1] holds the total number of result rows from your query. Larry -Original Message- From: Dave Carrera [mailto:[EMAIL PROTECTED] Sent: Sunday, January 18, 2004 6:11 AM To: 'Toby Irmer' Cc: [EMAIL PROTECTED] Subject: RE: [PHP] Is this possible ? Thanks Toby, But I forgot to mention something that makes retuning an array not usable in the context of my needs. ? Function MyFunc() { if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\); $num = mysql_num_rows($sql); // I want to use this result outside this function in another function elsewhere. While($rows = mysql_fetch_array($sql){ $returnsomething .=blah blah; } } return $returnsomething; // return array($returnsomething, $num); // your suggested answer } // list($text, $numrows) = MyFunc(); // Your suggested answer ? As you can see with my ammeded example I am already returning and array. I thought I could cast the result $num into the $GLOBAL array for use later but that dose not seem to work or be do able. I could relicate the function and call it something else say MyFunc2() but that seems a waste of code and mysql connection load when I am already retrieving the var I want to use. Any further ideas are appreciated. Dave C -Original Message- From: Toby Irmer [mailto:[EMAIL PROTECTED] Sent: 18 January 2004 10:29 To: Dave Carrera; [EMAIL PROTECTED] Subject: Re: [PHP] Is this possible ? One way: ? Function MyFunc() { if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\); $num = mysql_num_rows($sql); // I want to use this result outside this function. $returnsomething =blah blah; } return array($returnsomething, $num); } list($text, $numrows) = MyFunc(); ? hth toby - Original Message - From: Dave Carrera [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Sunday, January 18, 2004 11:22 AM Subject: [PHP] Is this possible ? Hi List, I have a function that makes a call to mysql based on certain vars. ---example Function MyFunc(){ if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $returnsomething =blah blah; } return $returnsomething; } And that all works fine no probs here but. I want to use a result somewhere in my script that is not returned by return. Let me show you... ---example Function MyFunc(){ if(isset($_POST[var])){ $sql = mysql_query(select * from table_name where field=\$_POST[var]\ ); $num = mysql_num_rows($sql); // I want to use this result outside this function. $returnsomething =blah blah; } return $returnsomething; } So $num contains a number that I want to use outside the function which is not covered by return. I know return stops a script and returns what I want it to return but how do I send out of the function the var I want. I have tried $GLOBAL[var]=$num; but that dont work, but I thought I would'nt anyway just tried it and yes I know I have to declare it inside my new function using global $var; to use it. So I ask is this achiveable or how can I do this. Thank you in advance Dave C --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php --- Incoming mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 --- Outgoing mail is certified Virus Free. Checked by AVG anti-virus system (http://www.grisoft.com). Version: 6.0.560 / Virus Database: 352 - Release Date: 08/01/2004 -- 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] Image Header Issues
try adding showpicture.php?pid=111384img=x.jpg to the end even though you aren't using that variable, IE may see that the type is jpg here. I have this same problem/workaround in place right now for a script that wouldn't work with IE without it for downloading pdf. (pdf was generated on the fly) -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues Again, it is *not* that known issue. That's the very first thing I checked. If that were the issue, jpgs from other sources would also not save properly. But they do, as I've stated several times. Thanks, though. Bob - Original Message - From: Brian V Bonini [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED] Cc: PHP Lists [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 7:28 AM Subject: Re: [PHP] Image Header Issues This is a known issue with IE. And it is in their knowledge base. If I recall the fix is to clear the cache, cookies, and broken/corrupt objects. -- 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] Image Header Issues
Since putting .jpg solved the problem for me, I'm ok with that work around, but you're right. I'm using session_start() on all of my scripts. That's also good to know that it doesn't fail without that function so I have a better idea of where to look, the next time I have header problems. Thanks Larry -Original Message- From: Toby Irmer [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 5:12 PM To: Larry Brown; Bob Eldred; PHP List Subject: Re: [PHP] Image Header Issues I have the same problem. Strange: I have a session_start(); before the header... if I take that out, the image will download as a JPG... so maybe if you find a way to do things in this script without starting the session first... toby - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 6:32 PM Subject: RE: [PHP] Image Header Issues try adding showpicture.php?pid=111384img=x.jpg to the end even though you aren't using that variable, IE may see that the type is jpg here. I have this same problem/workaround in place right now for a script that wouldn't work with IE without it for downloading pdf. (pdf was generated on the fly) -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues Again, it is *not* that known issue. That's the very first thing I checked. If that were the issue, jpgs from other sources would also not save properly. But they do, as I've stated several times. Thanks, though. Bob - Original Message - From: Brian V Bonini [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED] Cc: PHP Lists [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 7:28 AM Subject: Re: [PHP] Image Header Issues This is a known issue with IE. And it is in their knowledge base. If I recall the fix is to clear the cache, cookies, and broken/corrupt objects. -- 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] Image Header Issues
Giving up sessions for one simple issue sounds a bit drastic. I'll dig up the header information I'm sending that the x.pdf addition helped me with and send them to you if you'd like. I can't see anything as strong/secure as sessions to manage authentication as well as a dozen other performance benefits. Larry. -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 11:30 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues OK, that's it. The session_start() is the issue. Unfortunately, the img=x.jpg didn't help. Now I've got to figure out some sorta security without using sessions. Thanks, for at least pointing me in the right direction. Now if we could figure out why this would be happening, that would be great. Bob - Original Message - From: Toby Irmer [EMAIL PROTECTED] To: Larry Brown [EMAIL PROTECTED]; Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 2:11 PM Subject: Re: [PHP] Image Header Issues I have the same problem. Strange: I have a session_start(); before the header... if I take that out, the image will download as a JPG... so maybe if you find a way to do things in this script without starting the session first... toby - Original Message - From: Larry Brown [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED]; PHP List [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 6:32 PM Subject: RE: [PHP] Image Header Issues try adding showpicture.php?pid=111384img=x.jpg to the end even though you aren't using that variable, IE may see that the type is jpg here. I have this same problem/workaround in place right now for a script that wouldn't work with IE without it for downloading pdf. (pdf was generated on the fly) -Original Message- From: Bob Eldred [mailto:[EMAIL PROTECTED] Sent: Saturday, January 17, 2004 12:00 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Image Header Issues Again, it is *not* that known issue. That's the very first thing I checked. If that were the issue, jpgs from other sources would also not save properly. But they do, as I've stated several times. Thanks, though. Bob - Original Message - From: Brian V Bonini [EMAIL PROTECTED] To: Bob Eldred [EMAIL PROTECTED] Cc: PHP Lists [EMAIL PROTECTED] Sent: Saturday, January 17, 2004 7:28 AM Subject: Re: [PHP] Image Header Issues This is a known issue with IE. And it is in their knowledge base. If I recall the fix is to clear the cache, cookies, and broken/corrupt objects. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: Session expiry issues in IE, still.
Interesting point. After all, to remove a cookie you simply give it an expire time in the past. However, it should only explain the lack of cookie receipt. Since the user is able to surf for a period of time on the site before getting the boot, I wouldn't think it would apply. In the last post it sounded like it is not at 5 min but rather expiring very speradically. I bet there is a particular page that is killing them. Perhaps one of the re-writes or something. I would take IE and start traversing the site to see if you can't localize it to one area when it happens.(or more in particular where you just came from when it dropped). Larry PS if you have a dev site to work on, and the session checks are in a header, try changing the header to display the session ID and watch it for a change while you surf it. -Original Message- From: Matthew Weier O'Phinney [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 9:08 PM To: [EMAIL PROTECTED] Subject: [PHP] Re: Session expiry issues in IE, still. * Tarrant Costelloe [EMAIL PROTECTED]: I wrote to the list a couple of days ago about issues Planet-Tolkien.com members were experiencing with Internet Explorer, where their PHP based $_SESSION seemed to be expiring very speradically, where as Mozilla and Opera browsers this issue was not occuring and they would stay logged-in. It would appear this is a bit of a lost subject and little is known as to why this might be happening on the list. Something I read in the past week while investigating session issues of my own is that you can run into problems using cookie-based sessions with IE if your server's clock is behind the client machine's clock -- IE is particularly sensitive to this particular situation, and expires the cookies -- which leaves the person using IE without a session. -- Matthew Weier O'Phinney Webmaster and IT Specialist National Gardening Association 802-863-5251 x156 mailto:[EMAIL PROTECTED] http://www.garden.org http://www.kidsgardening.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Submit Button Refresh Problem?
we need more code than ? makeArrays(); ?... By the looks of that alone, it appears that you have that inserted into the html somewhere around the submit button. If that is the case, the function will run every time you load the page. You have to set a trigger to determine whether it should run or not. For instance, the form in which the submit button is in can have a variable such as input type=hidden name=executeRand value=1 so that when you hit submit, that value is sent to the target of the form, (which I take it is this same page). The code around the function in php could be... if($executeRand == 1){ makeArrays(); } You'll need a second form around your other submit along with a variable for it to send etc. Hope that helps Larry -Original Message- From: wknit [mailto:[EMAIL PROTECTED] Sent: Monday, January 05, 2004 8:22 AM To: [EMAIL PROTECTED] Subject: [PHP] Submit Button Refresh Problem? I have a php file that contains all the functions that I run on the page that is displayed, self-contained. The main function is ? makeArrays(); ? I am invoking that function with a Submit button OnClick event. Whenever I click the button, the page refreshes and the function runs just fine displaying a dynamically generated random sequence of numbers. The problem is the page refresh itself. When the page first loads the function runs and it shouldn't, the display should be blank until the button is clicked. This is a problem because I have another button that will be coded to write the data generated to a database, at present that function is empty, however when I click that button the page refreshes again and the number data changes. How do I keep the page from refreshing on load and apparently self clicking the form button, and how do I keep the page from refreshing and running the 'makearrays' function when I click the 'writedata' function? When the 'writedata' function is invoked from a button click only that function should be called and the data from the previous page should be returned to the page again (same).. i.e. the random number sequence does not change. Thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP, Server-Side?
You can create a soap server. I have one set up, the client side runs a function which is translated into xml sent to the other server (in my case over ssl) the other server translates to php, executes the function and returns the results. You create the actual code for the function on the server and give the client details on what the function does and what data it requires. If you build both it is very easy. The client has no other options but to run the function name while supplying the data. ex. server... function pullLatestReport($login,$password,$howfarback) { check db for authentication... if auth correct to run this function run do queries nec. for request return result. else return error } As you can see the server has total control over what gets executed, soap is designed to be platform independant. .net, java etc. can be used as the client. Of course that is only a added benefit since you are making both ends. I use nusoap which is all php and isn't too hard to figure out. Larry. -Original Message- From: Tarrant Costelloe [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 11:31 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP, Server-Side? php-general, I was wondering if it is possible with PHP to create a snippet of code which could execute on one server but be stored of a different server? Basic premise is to sell a product written in PHP which people could include on their site but not be able to edit or see the code, maybe by using some kind of include(), url() or snippet method? In Fellowship, Tarrant -- 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 Accelerator Support?
I use the accelerator, but I don't have a lot of users. I use it to protect confidential information in the event the web server screws up and starts displaying my scripts instead of parsing them etc. It works smooth as silk for me though. I just can't tell you anything about high volume performance. Larry -Original Message- From: mastershay [mailto:[EMAIL PROTECTED] Sent: Sunday, January 04, 2004 7:05 PM To: [EMAIL PROTECTED] Subject: [PHP] PHP Accelerator Support? Hello, I have spent hours searching the web for any kind of support regarding Ioncube's PHP Accelerator. We are interested in using it in conjuction with some Cyrus servers and Squirrel Mail, but cannot seem to find any kind of support whatsoever. The number of users is planned to be in the thousands, so any kind of help would be much appreciated. Thanks. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] PHP $_SESSION Expiring in IE
I use sessions with IE all the time without such a problem. Are there any points in the program that redirect the user off site and back or something with that affect that IE might be handling in a wierd way? Do you have pages that detect the browser and feed alternate content based on the browser? If so do you always run the session_start before these checks? -Original Message- From: Tarrant Costelloe [mailto:[EMAIL PROTECTED] Sent: Saturday, January 03, 2004 10:27 AM To: [EMAIL PROTECTED] Subject: [PHP] PHP $_SESSION Expiring in IE Hello, I have recently launched the new Planet-Tolkien.com, one would think that writing a message board from scratch and a dynamic weather system, a simple session login would be the least of my problems right? Wrong. It would appear that for Mozilla and Opera keep a $_SESSION is not an issue and the $_SESSION is continued until the member logs out. However when members are using Internet Explorer browser (most versions it seems), they can go around the site for varied amounts of time, usually less than five minutes and then their $_SESSION will expire!!?? I cannot for the life of me figure out why a server side $_SESSION would expire on IE but not for MOZ or Opera but it is, and I need to figure out why and how can I fix this. REF. All login information is saved as such: session_save_path($path/sessions); session_start(); $_SESSION['session_memberID']=$session_memberID; $_SESSION['session_username']=$session_username; $_SESSION['session_groupID']=$membergroup; In Fellowship, Tarrant -- 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] No cookie is being set?
shouldn't $row[member_id] be $row['member_id']. In case anyone can profit from this, when I find a function doesn't work right and I am using variables in its execution I run an echo/die combination immediately before the function to verify the data being fed to it is as it should be. In this example... ... $id = $_SESSION[user]; echo setcookie(\memberlogin\, .$id., .time() +60*60*24*365.);; die(); setcookie... What does this yeild? -Original Message- From: Cesar Aracena [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 2:28 AM To: [EMAIL PROTECTED] Subject: [PHP] No cookie is being set? Hi again, I have the following code to first start a session and then write a cookie... is that so hard? Well it is starting the session but the cookie is not being set. see: $row = mysql_fetch_array($result); $_SESSION[user] = $row[member_id]; if ($_POST[autologin] == yes) { $id = $_SESSION[user]; setcookie(memberlogin, $id, time()+60*60*24*365); header(Location: $CFG-wwwroot); exit(); } else { header(Location: $CFG-wwwroot); exit(); } What can it be? No error is posted. Thanks in advanced, Cesar Aracena -- 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] Array into $_SESSION
session_register(user); session_register(authLevel); session_register(sessionExpire); $user=$userDataFromForm; $authLevel = $authLevelFromDB; $sessionExpire = time() + 3600; etc... -Original Message- From: Cesar Aracena [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 2:11 AM To: [EMAIL PROTECTED] Subject: [PHP] Array into $_SESSION Hi all, can somebody remind me how to propperly insert not just one but many variables into a $_SESSION handle? php manual doesn't explain it very well. It just says that it can be done. Thanks in advanced, Cesar Aracena -- 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] Array into $_SESSION
Sorry, my bad. This is the Register Globals on version... with RegisterGlobals off you would simply use.. $_SESSION['user'] = $userDataFromForm; $_SESSION['authLevel'] -Original Message- From: Larry Brown [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 11:33 AM To: Cesar Aracena; PHP List Subject: RE: [PHP] Array into $_SESSION session_register(user); session_register(authLevel); session_register(sessionExpire); $user=$userDataFromForm; $authLevel = $authLevelFromDB; $sessionExpire = time() + 3600; etc... -Original Message- From: Cesar Aracena [mailto:[EMAIL PROTECTED] Sent: Friday, January 02, 2004 2:11 AM To: [EMAIL PROTECTED] Subject: [PHP] Array into $_SESSION Hi all, can somebody remind me how to propperly insert not just one but many variables into a $_SESSION handle? php manual doesn't explain it very well. It just says that it can be done. Thanks in advanced, Cesar Aracena -- 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] urlencoding.
How about this one? Add it to an include for the site and use it whenever you have an error check. function goBack($newSite,$errMsg) { $send = ; foreach($_GET as $key=$value) { $send = $send..$key.=.$value; } $goTo = urlencode($newSite.?errMsg=.$errMsg.$send); header(Location: $goTo); die(); } if(there is a problem with the data) { $errorMessage = some error; goBack($HTTP_REFERER,$errorMessage); } I'd have to test the $HTTP_REFERER part, but I don't see why it wouldn't work. I like the die() in there so I can just use an if statement at the beginning without having to indent the rest of the script. Especially if you have a lot of error checks. -Original Message- From: Chris W [mailto:[EMAIL PROTECTED] Sent: Monday, December 29, 2003 12:02 PM To: [EMAIL PROTECTED] Subject: [PHP] urlencoding. Let me give a quick background. I am a very experienced programmer but I haven't done much php and only a little web development in perl. I am now creating a web site with Apache, php and MySQL. I am having the user fill out a form and then save the data in MySQL. Before I save the data I do a few checks and if there is a problem I do a redirect back to the form and send all the data back so they don't have to fill out the whole form again. Here is some sample code I use to build my redirect url $UserID = $_POST['UserID']; $Password1 = $_POST['Password1']; $Password2 = $_POST['Password2']; $Email = $_POST['Email']; $FName = $_POST['FName']; $LName = $_POST['LName']; do checking of data here. if(there is a problem with the data){ $ErrorMsg = some error; $redirectStr = $httpHost/CreateAccount.php?; $redirectStr .= UserID= . urlencode(stripslashes($UserID)); $redirectStr .= Password= . urlencode(stripslashes($Password)); $redirectStr .= Email= . urlencode(stripslashes($Email)); $redirectStr .= FName= . urlencode(stripslashes($FName)); $redirectStr .= LName= . urlencode(stripslashes($LName)); $redirectStr .= ErrorMsg= . urlencode($ErrorMsg); header(Location: $redirectStr); exit; } My problem is that any field that contains a double quote, all data after the first double quote is missing from the form field. When I look at the long URL I do see a %22 where the are supposed to be, and all other data is there too. Any Ideas? If there is a better way to do this feel free to suggest a change in my whole method here. Just as a note validation of the UserID has to be done on the server side, to check for duplicates in the MySQL db. I would also welcome insight on standard techniques to make sure the user isn't trying to break the code by sending bogus data. I am already checking that the data isn't longer than I am expecting. Chris W -- 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] Setting a 'life-time' clock to a displayed information
The timer on the client browser would have to be done in some client-side language. On the server side you can place any order information that is out with a supplier in a db field along with the time it was pulled. When the next supplier submits a request, the db is parsed for pending jobs whose time has gone over the 30 minutes. If it has, then provide the same information to this supplier and update the record to show who it is out with. If there are none that have gone over the 30 then generate a new set for this supplier and record the time it was provided and the supplier it was given to. When the supplier publishes the completed information, check to make sure it was in time, if it was in time remove the entry from the db so that it isn't given back out. If it is too late you can generate an error page and start back over if he still wants to try. Note there may be some additional steps necessary to make sure that two suppliers aren't trying get an expired entry at the same instance where there is a fraction of a second between checking the time on the record and taking the record where both check the time and take the same record. You will probably have to use locking on the db to avoid this. Larry -Original Message- From: ike strong [mailto:[EMAIL PROTECTED] Sent: Thursday, January 01, 2004 9:44 AM To: [EMAIL PROTECTED] Subject: [PHP] Setting a 'life-time' clock to a displayed information Hi all, I'm interested in finding out a way to set a time limit to a displayed information - i.e. the displayed information will sieze to appear to a viewer's browser once a set time period is reached. What I'm trying to achieve is a situation whereby a certain 'info' (like an order!) would only appear to a target viewer (like a supplier!) for example (say) 30 minutes and if that viewer did not react within the set time, the information will sieze to appear to his/her browser so that the same information could be forwarded to the next viewer (supplier)on the list. The setting of time approach is to avoid having two people working on the same information at the same time. I'd really appreciate any hint/help Thanks in advance Ike __ Do you Yahoo!? New Yahoo! Photos - easier uploading and sharing. http://photos.yahoo.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php