Re: [PHP] Passing an undetermined amount of arguments by reference
Shawn McKenzie wrote: Jay Moore wrote: Jim Lucas wrote: Jay Moore wrote: Greetings list. Say I have a function that escapes a string before being passed to MySQL like so: function escape($id, &$string) { $string } Use an array as an alternate method of sending/returning data to the second argument. function escape($id, &$data) { if ( is_array($data) ) { foreach ( $data AS $k => $v ) { escape($id, $v); $data[$k] = $v; } } else { $data = mysql_real_escape_string($data, $id); } } This would handle any number of nested arrays/datasets. Hope it helps. Will that work properly? $a = "'hello'"; $b = "sup"; $c = "\\hola'"; $d = array($a, $b, $c); escape($id, $d); Jay I would try: $d = compact('a', 'b', 'c'); What is the difference? Please excuse my naivety. :) Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing an undetermined amount of arguments by reference
Jim Lucas wrote: Jay Moore wrote: Greetings list. Say I have a function that escapes a string before being passed to MySQL like so: function escape($id, &$string) { $string } Use an array as an alternate method of sending/returning data to the second argument. function escape($id, &$data) { if ( is_array($data) ) { foreach ( $data AS $k => $v ) { escape($id, $v); $data[$k] = $v; } } else { $data = mysql_real_escape_string($data, $id); } } This would handle any number of nested arrays/datasets. Hope it helps. Will that work properly? $a = "'hello'"; $b = "sup"; $c = "\\hola'"; $d = array($a, $b, $c); escape($id, $d); Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Passing an undetermined amount of arguments by reference
Ashley Sheridan wrote: On Wed, 2009-02-04 at 14:02 -0600, Jay Moore wrote: Greetings list. Say I have a function that escapes a string before being passed to MySQL like so: function escape($id, &$string) { $string = mysql_real_escape_string($string, $id); } I'm passing $string as a reference so I don't have to reassign it like so: $foo = escape($id, $foo); Simply calling escape($id, $foo); works just fine. How can I do this if I have a variable number of arguments? I know I can use func_get_args(), func_num_args() and so forth to get the arguments but can I still pass by reference? It'd be so much easier to do escape($id, $a, $b, $c, $d); Than $a = escape($id, a); and so forth. Does this make sense? Is it possible to do? Thanks in advance, Jay What about something like (untested): list($id, $a, $b, $c, $d) = escape($id, $a, $b, $c, $d); And then instead of altering the actual values in your function by using pass-by-reference, you can just return an array of elements instead. Ash www.ashleysheridan.co.uk Yeah, I had considered doing it that way as well. I just wanted to remove the need to type each variable twice. It gets to be a pain when you have longer variable names. Thanks for the suggestion. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing an undetermined amount of arguments by reference
Greetings list. Say I have a function that escapes a string before being passed to MySQL like so: function escape($id, &$string) { $string = mysql_real_escape_string($string, $id); } I'm passing $string as a reference so I don't have to reassign it like so: $foo = escape($id, $foo); Simply calling escape($id, $foo); works just fine. How can I do this if I have a variable number of arguments? I know I can use func_get_args(), func_num_args() and so forth to get the arguments but can I still pass by reference? It'd be so much easier to do escape($id, $a, $b, $c, $d); Than $a = escape($id, a); and so forth. Does this make sense? Is it possible to do? Thanks in advance, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Global Changes With Loop To Allow Nulls In A Table...
revDAVE wrote: Hi Folks, Newbie question I have a mysql table with 100 fields, currently all do not allow nulls. Rather than hand typing in phpMyAdmin, I would like a way to loop through all fields and update them to allow nulls First I would DESCRIBE the table so you get a list of column names and attributes. Then I would go thru each column and CHANGE it so it has the same attributes, adding the NULL flag if necessary. There may be an easier way however. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL class. Thoughts?
I know it's very OO-y to use exceptions, but I hate them. They're like setjmp/longjmp calls in C, and they're a really headache to deal with. If you don't use default or predone handlers, you have to put all kinds of try/catch blocks around everything. They make for non-linear execution, and I prefer my code to execute in a linear fashion. Paul My thoughts exactly. What do I gain by using a try/catch that I lose by using if/else or similar? J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] MySQL class. Thoughts?
Good ideas guys. The input is much appreciated. Jochem (and anyone else, I guess), as I am not 100% versed with Exceptions, the php5 version you suggested, are those Exceptions able to be handled outside the class? Do I need my try block to be within the class block, or can I have the try block be in my normal code where I actually instantiate the class? This: class blah { try { stuff } catch (exception) { more stuff } } $i = new blah() or can I do this: class blah { do some stuff (no try/catch blocks here) throw an exception } try { $i = new blah(); more stuff } catch (exception) { even more stuff } Thanks, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] MySQL class. Thoughts?
This is a MySQL class I use and I wanted to get everyone's thoughts on how/if I can improve it. This is for MySQL only. I don't need to make it compatible with other databases. I'm curious what you all think. Thanks, Jay Class: -- do_mysql(); } // Destructor function __destruct() { //$this->close(); } function do_mysql() { $this->login = ''; $this->pass = ''; $this->link = @mysql_connect('localhost', $this->login, $this->pass) or die('Could not connect to the database.'); } // End do_mysql // Functions function close() { if ($this->link) { mysql_close($this->link); unset($this->link); } } // End close function fetch_array() { return mysql_fetch_array($this->result); } // End fetch_array function last_id() { return mysql_insert_id($this->link); } // End last_id function num_rows() { return mysql_num_rows($this->result); } // End num_rows function process($database = '') { if (is_null($this->query)) { die('Error: Query string empty. Cannot proceed.'); } $this->db = @mysql_select_db($database, $this->link) or die("Database Error: Couldn't select $database " . mysql_error()); $this->result = @mysql_query($this->query, $this->link) or die('Database Error: Couldn\'t query. ' . mysql_error() . "/> $this->query"); } // End process function sanitize(&$ref) { $ref = mysql_real_escape_string($ref); } // End sanitize } // End do_mysql ?> Sample usage: $value = 'value'; $sql = new do_mysql(); $sql->sanitize($value); $sql->query = "SELECT * FROM `wherever` WHERE `field` = '$value'"; $sql->process('dbname'); $sql->close(); if ($sql->num_rows()) { while ($row = $sql->fetch_array()) { do stuff; } } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Been staring at the code for too long...
Jason Pruim wrote: Okay... So I know this is a stupid question... But I've been staring at my code for far too long and now it's still not working so I thought I would show it to all of you and see if you can tell me where I'm being stupid :) this is dbmysqliconnect.php: function dbmysqliconnect($server, $username, $password, $database, $link) { $link = mysqli_init(); mysqli_real_connect($link, $server, $username, $password, $database) or die('could not connect: '.mysqli_connect_error()); if (mysqli_connect_errno($link)) { printf("Connect failed: %s\n", mysqli_connect_error($link)); exit(); } return $link; } ?> this is a snipet of my index.php file: $link = dbmysqliconnect($server, $username, $password, $database, $link); //Do NOT insert or update sales rep database through this method... Only included to be supplied to the notify_email function. JP $salesRepID = $_POST['salesRepID']; $stmt = mysqli_stmt_init($link); //Create the statement mysqli_stmt_prepare($stmt, "UPDATE database.table ( FName, LName, email, phone, url, record, subscribed, date, IPAddress, Business, Address1, City, State, Zip, Coffee, Meeting, areaPlans) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); // Error checking. JP echo "Print of post:"; print_R($_POST); echo "dump of the statement:"; var_dump($stmt); mysqli_stmt_bind_param($stmt, 's', $_POST['txtFName'], $_POST['txtLName'], _POST['txtEmail'], $_POST['txtPhone'], $_POST['txturl'], $_POST['record'], $_POST['subscribed'], $date, $_SERVER['REMOTE_ADDR'], $_POST['txtBusiness'], $_POST['txtAddress1'], $_POST['txtCity'], $_POST['txtState'], _POST['txtZip'], $_POST['rdoCoffee'], $_POST['rdoTime'], $_POST['areaPlans']) or die(mysqli_error($link));The error that I am getting is: Warning: mysqli_stmt_bind_param() [function.mysqli-stmt-bind-param]: invalid object or resource mysqli_stmt in /public_html/purl/purlprocess.php on line 67 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '( FName, LName, email, phone, url, recor' at line 1 Am I just going crazy or is there something really wrong? Okay.. I'm done... First stupid question of the year... Only 3,349,587 more to go for the year! :P -- Jason Pruim japr...@raoset.com 616.399.2355 Maybe try enclosing your field names in backticks? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: hello
Ashley Sheridan wrote: On Thu, 2009-01-08 at 16:40 -0500, Robert Cummings wrote: On Thu, 2009-01-08 at 19:46 +, Nathan Rixham wrote: Robert Cummings wrote: On Thu, 2009-01-08 at 19:18 +, Nathan Rixham wrote: Daniel Brown wrote: On Thu, Jan 8, 2009 at 13:34, Robert Cummings wrote: He didn't say it had no insecurities... he said it's hard to believe it's "JUST AS insecure". Please provide factual sources to indicate the validity of your statement. Counter: please provide factual sources that it's not, whilst keeping in mind the statements made elsewhere in this thread. if it's a computer thats on, with an os, a keyboard and a network card connected to the internet it's insecure. We're not debating whether it is or is not insecure... we're debating comparitive insecurity in relation to that of Windows. Cheers, Rob. that's my point, all OS's are equally insecure, the only thing debatable is which os has more people trying to exploit those insecurities (and the answer is obviously windows) Equally? Have you looked in a dictionary to see what the word "equal" means? Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP He just forgot to add "for variable meanings of the word equal" ;) Ash www.ashleysheridan.co.uk while (= != =) { define(=, !=) } (That hurts just to look at.) Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP book?
Daniel Brown wrote: On Tue, Dec 16, 2008 at 17:04, Jay Moore wrote: Floppies hold 1.4 megs now? Mine don't and they're even dual-sided. :( Jay, Throw out your 62K and 5.25" floppies and get with the 1980's, brother. It's all about the 3.5" "hard" disks now. They're radical! Ok. Let me back them up to these reel-to-reel tapes quick, just in case. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP book?
Robert Cummings wrote: On Tue, 2008-12-16 at 13:50 -0600, Jay Moore wrote: Ps. That was a lame attempt at humour... I extract and distill knowledge from the Internet and save myself from having to buy books. I hear they have that on computers now. I should check it out one of these days. Maybe I'll buy a book. Yeah, I got a good deal on the Internet compressed to 1.4 megs so I could carry it on a floppy disk. Cheers, Rob. Floppies hold 1.4 megs now? Mine don't and they're even dual-sided. :( -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP book?
Ps. That was a lame attempt at humour... I extract and distill knowledge from the Internet and save myself from having to buy books. I hear they have that on computers now. I should check it out one of these days. Maybe I'll buy a book. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Good PHP book?
Richard Heyes wrote: I learned from PHP For Dummies. The title of that book isn't doing itself any favours... :-) You'd be surprised. The "For Dummies" series is one of the best-selling franchises in mainstream publishing history. Still, calling your audience dumb is generally regarded as being "a bad thing". But then, I am pap at business... :-) Sounds like you need "Self Esteem for Dummies." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: header modify errors
Terion Miller wrote: I am working from home today and getting this error with my copy of my project: *Warning*: Cannot modify header information - headers already sent by (output started at C:\Inetpub\Xampp\htdocs\SNLeader\WOSystem\Welcome.php:31) in *C:\Inetpub\Xampp\htdocs\SNLeader\WOSystem\inc\dbconn_openTest.php* on line *3* *Warning*: Cannot modify header information - headers already sent by (output started at C:\Inetpub\Xampp\htdocs\SNLeader\WOSystem\Welcome.php:31) in *C:\Inetpub\Xampp\htdocs\SNLeader\WOSystem\inc\dbconn_openTest.php* on line *4* Could not connect to the database. I have set my php.ini file output_buffering to ON it was off (read in a past post that will fix this error--but it did not) I also set session.cache_limiter = to nothing it was set to nocache Any other things I'm missing? Thanks Terion What's on/around line 31 in Welcome.php? J -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE8 and HTML5
Bastien Koert wrote: On Thu, Dec 4, 2008 at 11:57 AM, Jay Moore <[EMAIL PROTECTED]> wrote: I am running IE8 beta and its a PoS. Constantly crashing and flaky as shit. It's a beta. What do you expect? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php How about not throwing a js error on opening a new tab? Kinda basic, even MS should be able to handle that or so I would have hoped. I have less issues with Chrome and its beta At least have the decency to wait till it's out of beta to complain about all the issues that should have been fixed in the beta. Don't worry. They'll still be there. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] IE8 and HTML5
I am running IE8 beta and its a PoS. Constantly crashing and flaky as shit. It's a beta. What do you expect? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] take me off the list
Daniel P. Brown wrote: On Mon, Nov 3, 2008 at 11:10 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: Give a man some fish, he'll be back later for more! Tell a man about your shortbread and he'll stay on your ass until he gets the recipe, too. Funny how it all works out, eh? So, about that recipe... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Remote Developer Wanted
Michelle Konzack wrote: Am 2008-10-21 18:21:19, schrieb Jochem Maas: Daniel Brown schreef: On Tue, Oct 21, 2008 at 12:03 PM, Jochem Maas <[EMAIL PROTECTED]> wrote: and rob myself of the sport? your no fun since your married Shirley ;-) Coincidentally, that's exactly what my wife says. your wife calls you Shirley? your definitely doing *something* wrong ... maybe take off the dress. :-P And if he/she is hermaphrodite like me, then you will have a problem explaining... :-D Thanks, Greetings and nice Day/Evening Michelle Konzack Systemadministrator 24V Electronic Engineer Tamay Dogan Network Debian GNU/Linux Consultant o_O -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: E_STUPID
[EMAIL PROTECTED] wrote: I think we need a new error reporting constant E_STUPID. This should catch stupid things I do like trying to embed an array into a string such as: $foo = array('a', 'b', 'c'); $query = "select * from foo where foo in ('$foo')"; It's been one of those days... Yeah but being stupid, we'd probably just forget to set it. Then we'd need a E_STUPID_ACTIVE flag that alerts us if E_STUPID isn't set. But we'd probably just forget to set *that*, so we'd need a E_STUPID_ACTIVE_ACTIVE flag, too, and to be honest, that's too many underscores for me. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: -help
Yeti wrote: -help: invalid argument I like the way you handle input errors in your php-general subroutines David. I don't. It says nothing about what a valid argument is. Horrible newsgroup coding, imo. I wouldn't be surprised if he has register_globals on. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote Developer Wanted
Jay Moore wrote: Daniel Brown wrote: On Tue, Oct 21, 2008 at 11:31 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: You must be new around here... Shirley! Yes, brand new. This is only my second post --- and only the third email I've ever sent in my life. How do you PHP? ;-P Standing up. *stang* (look it up) Actually, moron, it's called a "sting"; not a "stang". http://www.nationmaster.com/encyclopedia/Sting-%28percussion%29 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote Developer Wanted
Daniel Brown wrote: On Tue, Oct 21, 2008 at 11:31 AM, Robert Cummings <[EMAIL PROTECTED]> wrote: You must be new around here... Shirley! Yes, brand new. This is only my second post --- and only the third email I've ever sent in my life. How do you PHP? ;-P Standing up. *stang* (look it up) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Remote Developer Wanted
Daniel Brown wrote: On Tue, Oct 21, 2008 at 4:26 AM, Brennon Bortz <[EMAIL PROTECTED]> wrote: Actually, speaking as someone now living in the UK, your low end is LESS than minimum wage here. Rather insulting, if you ask me... Simple advice then: delete the message and don't reply. Surely you can't be serious. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Securing AJAX requests with PHP?
Yeti wrote: Ok, but how safe are tokens? Thinking of man in the middle attacks they do not make much sense, do they? That's what I was thinking too. If I'm deleting an entry from a database with AJAX, I don't want someone looking at my Javascript and saying, "Hmm, all I need to do is pass this info to this URL and I can delete at will." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Securing AJAX requests with PHP?
I realize this isn't really about PHP, but I was hoping maybe someone had a way to make AJAX a little bit more secure using PHP. I was thinking of making my AJAX calls also pass the current session id, and have my PHP script check to make sure it's a valid id, but I'm open to other ideas. Do you guys use PHP to make AJAX calls a little bit more secure? What /do/ you use? I hope this isn't too off-topic. Thanks, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Binary file copy
in the response you'll be getting the raw http response (including headers); so you're saving them as well thus not a valid image file. can't see why: $image = file_get_contents('http://10.10.10.3/record/current.jpg'); wouldn't work for you.. regardless though if you are using sockets, be sure to trim of that raw http response - oh and look out for chunked or encoded file transfer as well as you'll need to decode etc etc.. (large can of worms - use an http transport class) file_get_contents worked beautifully. Thanks for the suggestion! Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Binary file copy
Greetings list! Say I want to copy a jpg from a remote server onto mine, using PHP. Right now, my script opens a socket to the remote server, and opens the image file. It copies its contents into a dummy variable, opens a new file on my server, and dumps the contents of the dummy variable into the new file. For reasons I cannot figure out, it is not working the way I want. Rather than display the image, I get an nothing when opening it in an image viewer. Code follows: -- - I have trimmed the code some, and omitted the part where I remove the HTTP headers and other information I do not need. Why isn't this working for me? Thanks in advance, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Microsoft China to Punish private windows users
Stut wrote: On 15 Oct 2008, at 14:53, Shelley wrote: It will punish private Windows XP and Office 2003, Office 2007 users. This is extremely off-topic. Please don't abuse this list in an attempt to drive traffic to your blog. -Stut It *is* powered by PHP, Stut. :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: utf8/quoted printable based mail renders raw html
Eric Butera wrote: Has anyone ever had reports of problems with Outlook 2003 using utf-8 and quoted printable? I've recently started getting complains from our clients that some of their subscribers are having problems with the message coming through as raw html. The email client is always Outlook 2003 on XP of various flavors. I set up a copy of Outlook 2003 and 2007 to test and I see the messages just fine. Unfortunately this makes it quite hard to troubleshoot. Should I just bite the bullet and iconv from utf8 to latin1? Any other thoughts? What would really be great is if I could reproduce the problem to try different approaches. Check php.ini ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Output text status on a long class
Stut wrote: On 14 Oct 2008, at 15:56, Chrome wrote: I have a class that takes a while to run and am wanting to push some output to the browser while it's doing its stuff. Is that possible? Here's what I'd like: Connecting to server... Done! Retrieving categories... Done! ... All I can get it to do is output all of the text at the end of the script A voice in my head says that outputting all of the text at the end of the script is the only way to do it. Then another voice says but there must be a way! :) I did try a quick test of buffering the text then explicitly flushing the buffer but it didn't seem to work I know this seems pointless but I'm anticipating that the users will be confused (which would be a surprise ) and attempt to abort/bugger off somewhere else Put this line at the top of your script... while (@ob_end_clean()); That will remove any output buffers and your script should then output stuff as it happens. -Stut Or you could add flush(); after your output, which will flush the output buffer and force it to display. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems [SOLVED]
Stut wrote: I see your confusion. This is a *mailing list* with a newsgroup gateway. If you're using it as a newsgroup then you have to accept that you're not using it the way it was meant to be used, and that almost always has side-effects. That being the case, I apologize for my assumptions and retract my statements. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems [SOLVED]
Stut wrote: It's also worth noting that since subscriptions is not required to post to these lists there's no guarantee that the OP will get your reply if you don't include their address. IOW you're asking us to deprive a number of developers seeking assistance of our replies because you can't get your own $%*£ in order. How does that make you feel? Why is it that it's not ok to top post, but it's perfectly fine to not subscribe to the list? It's extremely rude and arrogant to post to the list and expect people to respond to you personally. In fact, people get all up in arms if someone requests it. I don't reply-all. If I have an answer that will help someone, I post it to the list. If they can't be bothered to subscribe to see my reply, tough cookies. The question went to the list; the response went to the list. (I feel just fine about this, btw. Thank you for your concern.) I do not believe either my email client or my email server are improperly configured. When you reply all, you are posting to a newsgroup and to an email address -- two completely separate entities. I don't think it's out of the ordinary to expect that I would get multiple copies of the same message in that instance. All that said, it's a matter of group etiquette to do things one way over another (ex: top-posting). Maybe the reply-all etiquette should be re-addressed? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SESSION array problems [SOLVED]
Now, someone show me where that is documented? http://us3.php.net/register_globals Also, for the love of glaven, people. If you're going to post to the list, you don't have to include the original sender as well. There's a pretty good chance if they originally posted to the list, they'll see your reply. No need to give them the message twice. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SESSION array problems UPDATE
Jay Moore wrote: tedd wrote: At 11:10 PM +0100 10/1/08, Nathan Rixham wrote: [tested - works] -snip- ?> regards! nathan :) I need to re-address this.. tedd your original code works fine over here; as does the code I sent you, and the code jay submitted first.. do us a favour, copy and paste exactly what I just handed through and run it; are the results correct? To all: The code provided by nathan works for me as well. However, the problem is not easily explained, but I can demonstrate it -- try this: http://www.webbytedd.com/zzz/index.php * A complete listing of the code follows the demo. When the code is first loaded, the session variables are defined and populated. Proof of this is shown in the top left corner of the page, which reports: Cable Diane Ron Big Dirt Joe Now click the "Continue" button and you will be presented with the next step which shows a list of the SESSION variables in both the top left corner AND immediately below "Step 2". Everything is righteous to there. However, the next portion of the code is the foreach loop where the first SESSION pair is output correctly, but the rest aren't. This is followed by another listing of the SESSION variables and this time is shows that they have completely disappeared. Okay gang -- what's up with that? Cut and paste the code and see for yourself. Cheers, tedd Much as it pains me to ask this, you don't have REGISTER_GLOBALS on, do you? Jay Try these options (separately): 1) Change your first and third entries (so Joe Dirt is 0 and Cable Diane is 2). See if your 2nd output is now '1 o i'. 2) Change your storage variables ($first_name and $last_name) to something other than the key values of your session array (ex: $fname and $lname). See if that works. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: SESSION array problems UPDATE
tedd wrote: At 11:10 PM +0100 10/1/08, Nathan Rixham wrote: [tested - works] -snip- ?> regards! nathan :) I need to re-address this.. tedd your original code works fine over here; as does the code I sent you, and the code jay submitted first.. do us a favour, copy and paste exactly what I just handed through and run it; are the results correct? To all: The code provided by nathan works for me as well. However, the problem is not easily explained, but I can demonstrate it -- try this: http://www.webbytedd.com/zzz/index.php * A complete listing of the code follows the demo. When the code is first loaded, the session variables are defined and populated. Proof of this is shown in the top left corner of the page, which reports: Cable Diane Ron Big Dirt Joe Now click the "Continue" button and you will be presented with the next step which shows a list of the SESSION variables in both the top left corner AND immediately below "Step 2". Everything is righteous to there. However, the next portion of the code is the foreach loop where the first SESSION pair is output correctly, but the rest aren't. This is followed by another listing of the SESSION variables and this time is shows that they have completely disappeared. Okay gang -- what's up with that? Cut and paste the code and see for yourself. Cheers, tedd Much as it pains me to ask this, you don't have REGISTER_GLOBALS on, do you? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Mailing List fun
Robert Cummings wrote: On Wed, 2008-10-01 at 19:48 +0100, Ashley Sheridan wrote: On Wed, 2008-10-01 at 14:12 -0400, Robert Cummings wrote: I believe jpg is lossless if you choose 100% quality. Cheers, Rob. -- http://www.interjinn.com Application and Templating Framework for PHP Unless it's a JPEG 2000 (which isn't web-safe) then it's lossy I've never heard the term "web-safe" applied to images. What do you mean by that? Lack of browser support? Breaks the web-safe 216 colour palette? Cheers, Rob. I'd guess it means the filesize is ridiculously huge. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: SESSION array problems
tedd wrote: Hi gang: Apparently, there's something going on here that I don't understand -- this happens far too often these days. Here's a print_r($_SESSION); of the session arrays I'm using: [user_id] => Array ( [0] => 6156 [1] => 7030 [2] => 656 ) [first_name] => Array ( [0] => Diane [1] => Fred [2] => Helen ) [last_name] => Array ( [0] => Cable [1] => Cago [2] => Cahalan The following is how I tried to access the data contained in the $_SESSION arrays: $num_users = count($_SESSION['user_id']); for ($i = 0; $i < $num_users; $i++) { $last_name = $_SESSION['last_name'][$i]; $first_name = $_SESSION['first_name'][$i]; echo("$last_name, $first_name"); } The only thing that came out correct was the first echo. The remaining echos had no values for $first_name or $last_name. What's happening here? Cheers, tedd PS: I'm open to other suggestions as to how to do this. What about: foreach ($_SESSION['user_id'] as $key => $value) { $last = $_SESSION['last_name'][$key]; $first = $_SESSION['first_name'][$key]; echo "$last, $first"; } Disclaimer: have not tested this, but it seemed logical in my head. Disclaimer Disclaimer: logic must fight with random other thoughts and often loses. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Wanted PHP Developers LogicManse
looks like spam/scam to me Thanks for quoting the whole message then! :P Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tedd's back from vacation
Probably not totally work safe ;) Ah the perks of controlling the company network. I determine what is NSFW (nothing). Jay PS - If you guys are gonna gripe about top posting, you really need to learn to prune messages better. :P -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] php image and javascript include
Dreamweaver? Eclipse? Pah, it's all about using a text editor! Kate (on KDE) is my preference ;) Heathen! Dreamweaver is awesome. Not for their WYSIWYG editor, but for their code-only view and its auto-complete. Never have I typed so little to get so... little. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
That'll teach you to use Google Chrome. ;) Pshaw. IE5 4 lyfe, yo. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
:) Sorry bout that. However, malformed URL bugs that cause your system to crash can't really be attributed to me ;) Cheers, Rob. The prompt that showed before my computer self-destructed referenced you specifically. Expect the invoice for my new quantum computer to come in the mail shortly. I trust you will remit payment promptly. I'd hate to have to get the internet police involved. I hear they're itchin' to taze you, bro. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Robert Cummings wrote: On Fri, 2008-09-05 at 21:07 +0100, Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html Yeah, that's it lol :) Cheers, Rob. FYI - Typing this response on my old 286 because Rob's original suggestion made my 37.612-core Core2Duo box (used for notepad and newsgroups only) explode. Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Wolf wrote: Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? In one word... CURL A couple of people have responded (to me; not the list) with that very same response. I've heard of it, but never used it before. Care to give me the 30 second rundown [I can read the site, sure, but it's probably easier if you explained it :) ]? Is it like a glorified socket connection or something? Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Sending username/password
Stut wrote: On 5 Sep 2008, at 21:05, Robert Cummings wrote: On Fri, 2008-09-05 at 15:01 -0500, Jay Moore wrote: Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. If you mean http auth style login information then you do the following: http://www.somedomain.com:[EMAIL PROTECTED]/the/path/to/resource.html I think he meant http://user:[EMAIL PROTECTED]/the/path/to/resource.html. Jay: How does the device ask for the username and password? Is it a form on the web page, a window from the browser, or what? -Stut Stut - Standard browser prompt. I'm usually pretty good with PHP stuff and I've bypassed normal forms many times before, but I've never tried to bypass the browser popup (.htaccess or similar, I presume?). Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sending username/password
Greetings list! Is it possible (and if so, how) to send username and password information to a website with PHP? I would like to submit some information to some network devices we have, but they require login credentials to proceed. I would like to bypass the traditional username/password prompt so I can automate the procedure. I hope this makes sense. Thanks, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Google Chrome
Jochem Maas wrote: Bastien Koert schreef: On Thu, Sep 4, 2008 at 4:31 PM, Dan Shirah <[EMAIL PROTECTED]> wrote: Yippie, Chrome already exploited for DoS attacks? http://blogs.zdnet.com/security/?p=1847&tag=nl.e539 Its not a DoS, its just a browser crash so forcing a browser to crash is not 'Denial of Service'? I think your confused with DDoS It depends on what site he planned to visit. Google - DoS Zombo.com - Not DoS. ;) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] RE: Sale 79% OFF !!!
I never cease to be amazed at the continuing stupidity of the human race. Agreed. A person is smart; people are stupid. Besides, 79% off! How could I go wrong? Jay "I only pay 21%" Moore -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: Passing variable to a page in a frameset
Jody Cleveland wrote: Hello, I've got a website here: http://beta.menashalibrary.org/about On every page, i've got a search box at the top. This search box searches the library's web catalog. The problem is, when someone searches, it takes them away from the site. What I'd like to do is take what a person searches for, and load it into the bottom frame of this page: http://beta.menashalibrary.org/sites/beta.menashalibrary.org/themes/salamander/searchframe.html Is there a way, with php, to take what someone puts in the search box and put the results into the bottom frame of a frameset when the originating page does not contain frames? - jody Frames?! As a fellow Wisconsinite and a web developer, I'm going to have to ask you to leave the state. Minnesota can have you. :P Jay PS - No, but seriously, frames?!?! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP's mail(): proper way to send a 'From' header
**Apologies if this posts twice. I got some crazy response from the server after sending this the first time.** I have a site I set up for a client that has a form their clients can fill out to submit some data. When the form is submitted, I have PHP gather the data and create the body of an email which is then sent to both the owners of the site and back to the person who submitted the data. Because the server hosts multiple sites, I am sending an additional 'From' header so the email doesn't appear to come from the hostname of the server itself ([EMAIL PROTECTED]). As per PHP's documentation of the mail() function, I am sending the header like so: "From: [EMAIL PROTECTED]" I am getting bounce emails from certain ISPs (AOL, Roadrunner, some local ISPs) saying the sender's domain does not exist. It seems that either mails are coming from my hostname ([EMAIL PROTECTED]), or those ISPs are reading the additional headers incorrectly. Unfortunately, this is not acceptable. People aren't getting their emails, and the hammer is coming down on me. Because I did not have a DNS entry for my hostname, the 'domain does not exist' error I'm seeing in the bounce emails is correct. I do not wish to keep a DNS entry for it (I have added one as a temporary fix), as that doesn't fix the 'From' header issue to begin with, so I would appreciate it if you did not make that suggestion. As far as I know (based on the lack of bounce emails), this worked fine on PHP4, but with our new webserver (running PHP5), I'm experiencing problems. Far as I can tell, the mail() function has not changed between versions. I'm stumped here and need to get this fixed asap. I've tried 'From' and 'FROM', tried a 'Name Here <[EMAIL PROTECTED]>' format, and tried terminating with double newlines with and without the carriage return. Nothing seems to work. I've even gone so far as to edit php.ini with a default from address, but that doesn't appear to have fixed anything either. Please help. Thanks in advance, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP's mail(): proper way to send a 'From' header
Greetings folks. I seem to be having a problem with PHP's mail() function and sending 'From' headers properly. Here's my setup: I have a site I set up for a client that has a form their clients can fill out to submit some data. When the form is submitted, I have PHP gather the data and create the body of an email which is then sent to both the owners of the site and back to the person who submitted the data. Because the server hosts multiple sites, I am sending an additional 'From' header so the email doesn't appear to come from the hostname of the server itself ([EMAIL PROTECTED]). Because I did not have a DNS entry for my hostname, the 'domain does not exist' error I'm seeing in the bounce emails is correct. I do not wish to keep a DNS entry for it (I have added one as a temporary fix), as that doesn't fix the 'From' header issue to begin with, so I would appreciate it if you did not make that suggestion. As per PHP's documentation of the mail() function, I am sending the header like so: "From: [EMAIL PROTECTED]" I am getting bounce emails from certain ISPs (AOL, Roadrunner, some local ISPs) saying the sender's domain does not exist. It seems that either mails are coming from my hostname ([EMAIL PROTECTED]), or those ISPs are reading the additional headers incorrectly. Unfortunately, this is not acceptable. People aren't getting their emails, and the hammer is coming down on me. As far as I know (based on the lack of bounce emails), this worked fine on PHP4, but with our new webserver (running PHP5), I'm experiencing problems. Far as I can tell, the mail() function has not changed between versions. I'm stumped here and need to get this fixed asap. I've tried 'From' and 'FROM', tried a 'Name Here <[EMAIL PROTECTED]>' format, and tried terminating with double newlines with and without the carriage return. Nothing seems to work. I've even gone so far as to edit php.ini with a default from address, but that doesn't appear to have fixed anything either. Please help. Thanks in advance, Jay -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php