[PHP] Re: Returning Rows Question
here's one way, set a variable and switch it on and off $tr_properties = 'style="background-color: grey;"'; while( $ect = etc ) { if($tr_properties){ print ""; $tr_properties = false; } else { print ""; $tr_properties = 'style="background-color: grey;"'; } } you sould refine the code and simplify it but that is basic principle. joshua Christopher J. Crane wrote: > How do you alternate colors of the rows in a table inside a while statement > when dealing with the output of data from a DB. I am sure it's something > simple but I keep getting into some really long math thing... > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Fw: [PHP] FORUM CODE
Kevin Stone wrote: > $myformtxt = '[i]Hello[/i] [B]world[/B]'; // pretend this came from a form. 1. I understand what you're doing, and how. But what I don't understand is why? If a user is going to have to type [B]bold[/B], why not just get them to type bold. [bold] and [italic] maybe? 2, I think regular expressions are a safer way to go. That way you don't end up inserting eroneous html into peoples text if an unmatched tag is encountered. Square brackets will not throw a browser off track but an unclosed or tag could ruin a page's appearance. i suggest using preg_replace, maybe like this: $pair = array( 'bold' => 'strong', 'italics' => 'em', 'heading1' => 'h1', 'heading2' => 'h2', 'heading3' => 'h3', 'heading4' => 'h4'); $pattern = array(); $replace = array(); foreach($pair as $key => $val) { $pattern[] = '/(\[)(' . $key . ')(\])([^]].*)(\[\/)(' . $key . ')(\])/i'; $replace[] = "<$val>" . '$4' . ""; } $new_body= preg_replace ($pattern, $replace, $body_text); -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: whitespace...
the php parser does not return any whitespace between the tags unless youn use print or echo. i wouldn't use: > You should use $content = str_replace(" ","",$content); > I assume that works, there is probably something better than it too but > thats all I see at this hour. as that would remove all your normal single spaces as well. if this is really a an issue use regular expressions to replace 2 or more spaces with single spaces. see preg_replace() josh Matt Zur wrote: > If you have a file includes IE: > > include ("data.inc"); > > and have arrays n such with multiple php tags in that file, it will > produce alot of white space on the final output. > > -Matt > > Philip Hallstrom wrote: > >> I'm not sure I fully understand your question, but given the following >> PHP >> file: >> >> >print("hello"); >> >> >>#assume there are hundreds of blank lines just above this one. >> ?> >> >> >> all the browse will see is this (minus the dashed lines). >> >> -- >> hello >> -- >> >> On Wed, 4 Sep 2002, Matt Zur wrote: >> >> >>> How do I remove the whitespace from a document? I consulted the manual >>> and it said to use the trim function. But in a large PHP document, with >>> lots of fuctions etc in PHP... is there a simple way to compress the >>> whitespace of the entire document? Rather than going through each var >>> and using the trim? Like add a header at the top: >> compresswhitespace() ?> >>> >>> >>> If you have a 300k php document, won't the source code reveal (after the >>> browser displays the page) a bunch of whitespace. Doesn't this add to >>> dl time and if so, how do I get rid of it. >>> >>> TIA, >>> >>> -Matt >>> >>> >>> >>> >>> -- >>> Matt Zur >>> [EMAIL PROTECTED] >>> http://www.zurnet.com >>> >>> Need a Web Site??? - Visit... www.zurnet.com >>> >>> 1997 - 2002 - 5th Anniversary!!! >>> >>> >>> -- >>> 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] Upload Progress
> A bunch of inpatient stupid users whom > are click happy when they get impatient. > impatient, not very technical, people. People who kept canceling and > canceling, despite our directions, because they thought it was stuck or > frozen or taking too long. the simplest and most elegant work around i've seen is to use javascript to disable the submit button after it has been clicked. a second click creates a javascript alert that says 'be patient, your request is being handled'. josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: LDAP (NDS) authentication example...
Hi Richard If you're using Apache I'd recommend using .htaccess files that way there is no php needed. AuthName "Your Directory Service - Authentication" AuthType basic AuthLDAP on AuthLDAPServer ldap://ldap.yourdomain.com/ AuthLDAPBase "ou=Your Division, ou=Staff, o=Your Company, c=US" require valid-user If on the other hand you actually want to retrieve data from your LDAP system then i suggest reading the manual. it's not actually a lot harder that connecting to RDBMS. I managed to get a working script straight off the manual page. http://www.php.net/manual/en/ref.ldap.php Joshua Richard Whittaker wrote: > Greetings: > > We've got a Netware 6.0 server setup, and this is our network's primary means of >authentication of users, and I would like to use NDS (eDirectory) to authenticate >various web pages of ours that are written in PHP. I know that NDS interfaces with >LDAP, and was wondering if I could use this for my authentication... Does anyone have >any practical examples of authentication using LDAP/NDS?... > > Any help would be appreciated! > > Thanks, > Richard W. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: LDAP (NDS) authentication example...
i'm not sure if i follow you. i have never used ldap to write authentication scripts as i've only used the .htaccess method. to retrieve data you need to bind using a username/password combination that is valid. i guess you could test your user's username/password by using it to attempt a bind. the following is copied verbatim from the manual's user notes: # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # [EMAIL PROTECTED] (03-Jan-2002 11:46) It took quite a while to figure out how to do LDAP authentication as there wasn't a complete example ... just some cryptic notes about passwords. So, here's what I came up with that works for me: // $inp_uid contains the user id to be authenticated // $inp_passwd contains the plain text password to be authenticated $ds=ldap_connect("ldap.someserver.com"); //substitute the real host name in the previous statement if ($ds) { $r=@ldap_bind($ds); // this is an anonymous bind $st_search="uid=$res_uid"; // need to set the right root search information in next statement. // Your requirement may be different $sr=ldap_search($ds,"ou=mycompany.com,o=My Company", "$st_search"); $info = ldap_get_entries($ds, $sr); for ($i=0; $i<$info["count"]; $i++) { $dn=$info[$i]["dn"]; } // I now know the dn needed to authenticate // now bind to see if the uid and password work // the password is still plain text $r=@ldap_bind($ds, $dn, $inp_passwd); if ($r) { $str_passok="Yes"; // ldap_bind will return TRUE if everything matches } else { $str_passok="No"; // otherwise ldap_bind will return FALSE } ldap_close($ds); } else { $error_string="Error -- unable to connect to ldap.someserver.com"; } I'm sure that there's more error checking that needs to be done, but this provides the basic skeleton # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # Joshua Richard Whittaker wrote: >>If on the other hand you actually want to retrieve data from your LDAP >>system then i suggest reading the manual. it's not actually a lot harder >>that connecting to RDBMS. >> >>I managed to get a working script straight off the manual page. >>http://www.php.net/manual/en/ref.ldap.php > > > Unfortunately, what I know about LDAP would fit on the head of a very small > object (I.E. a pin), so I'm still getting used to the whole idea of LDAP... > > So, with NDS, I would just do an ldp_bind to the proper tree, with a > username and password, and testing for that would tell me if the > Username/Password combination is valid, or would there be something further > I'd have to do? > > Thanks! > Richard W. > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Regular Expression
Hi all, I'm trying to change the string, for example, $string = "11.abcd.32.efgh.53.ijk"; to 11.abcd. 32.efgh. 53.ijk. with ereg_replace. Like ereg_replace("\.[0-9]","",$string); How can I recover the original characters after replacing them with in ereg_replace? ereg_replace("\.[0-9]","\\0",$string) gives me the wrong result like: 11.abcd. 32.efgh. 53.ijk. thank you in advance. Joshua -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Regular Expression
Thank you!! It worked!! The wrong sample was 'dot'11'dot'abcd, but the first dot was not shown properly... And, now I have another problem: In fact, the input strings are lines from a webpage, and they sometimes have line-feed as in: 11.abcd.32.efgh.54.ij <--here kh.41.lmno. <--here 63.pqrs And, with ereg_replace("(\.)([0-9])","\\1\\2",$string), the result I expect is: 11.abcd. 32.efgh. 54.ijkh. 41.lmno. 63.pqrs. But, the actual result is: 11.abcd. 32.efgh. 54.ij <-- problem kh. 41.lmno. 63.pqrs. <-- problem I tried some more regular expressions to solve this, but they don work yet. So, please help me~~ Thank you in advance. Joshua - Original Message - From: "Kelly Hallman" <[EMAIL PROTECTED]> To: "Joshua" <[EMAIL PROTECTED]> Cc: "PHP General list" <[EMAIL PROTECTED]> Sent: Saturday, December 27, 2003 1:27 PM Subject: Re: [PHP] Regular Expression > On Sat, 27 Dec 2003, Joshua wrote: > > I'm trying to change the string, for example, > > > > $string = "11.abcd.32.efgh.53.ijk"; > > to > > > > 11.abcd. > > 32.efgh. > > 53.ijk. > > > > with ereg_replace. Like > > ereg_replace("\.[0-9]","",$string); > > How can I recover the original characters after replacing them with > > in ereg_replace? > > > > ereg_replace("\.[0-9]","\\0",$string) gives me the > > wrong result like: > > > > 11.abcd. > > 32.efgh. > > 53.ijk. > > Since the output you want and the output you didn't want are identical in > your post, it was hard to tell what you were trying to do, but... > > I think this is what you want.. > ereg_replace("(\.)([0-9])","\\1\\2",$string); > (minus the last decimal point, missing from your original string) > > -- > Kelly Hallman > // Ultrafancy > > -- > 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] stay logged in for session
hey guys, i am trying to set up a session so that when a user logs in, they will stay logged in until they close their browser. i have the session set up, however i keep getting an error saying: The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete. -- this is my code, any help plz. -- checklogin.php: Error performing query: " . mysql_error() . ""); exit(); } //if user does not exist if (mysql_num_rows($ResSql)==0) { echo 'Incorrect username or password have been specified.'; echo 'Click here to Log In'; exit; } else { header("Location:" . $nextpage . "?ob=" . $_REQUEST['ob'] . "&uname=" . $_REQUEST['txtSurname'] . "&pword=" . $_REQUEST['txtPassword']); } ?> verify.php: --- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] SSL, PHP, & MySQL
Hi all, I was wondering if anyone could direct me to some good tutorials on how to utilize PHP to access a MySQL database behind SSL. I have been searching PHPBuilder.com, PHPClasses.org, and hotscripts.com, and I can't seem to find any good tutorials for a beginner when it comes to SSL. I do have a fairly good working knowledge of PHP and MySQL so I'm not necessarily looking for a guide on that, I just need to know how to pass encrypted data back and forth. Here is the scenario: My client has a website in which a customer will be purchasing gift certificates online. They don't need a comprehensive e-commerce package, just simple information passed across a secure connection, such as: user names, passwords, credit cards and mailing addresses. We already have a MySQL db set up with the gift certificate "package" information. I just need to be able to store the customer information for retrieval later by the owners of the site. Joshua Minnie [EMAIL PROTECTED] Independent Web Consultant / Developer Wild Web Technology www.wildwebtech.com -- Server Information: + PHP v. 4.2.3 + Apache 1.3.26 + MySQL 3.23.53 -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL, PHP, & MySQL
What about utilizing an encrypted text file then. Would there be anything wrong with doing it that way? I really don't have too much of an option as far as the server specs go because I didn't set up the web hosting. -Josh Brad Bonkoski wrote: > I think you may need to read: > http://www.php.net/manual/en/function.mysql-connect.php > > It appears that the SSL client flag for connecting to MYSQL is not available > until 4.3.0, but you can pick up the 4.3.0RC3 version now, and test it out! I > _think_ this is what you are looking for. > HTH > -Brad > > Joshua Minnie wrote: > > > Hi all, > > I was wondering if anyone could direct me to some good tutorials on how > > to utilize PHP to access a MySQL database behind SSL. I have been searching > > PHPBuilder.com, PHPClasses.org, and hotscripts.com, and I can't seem to find > > any good tutorials for a beginner when it comes to SSL. I do have a fairly > > good working knowledge of PHP and MySQL so I'm not necessarily looking for a > > guide on that, I just need to know how to pass encrypted data back and > > forth. Here is the scenario: > > > > My client has a website in which a customer will be purchasing gift > > certificates online. They don't need a comprehensive e-commerce package, > > just simple information passed across a secure connection, such as: user > > names, passwords, credit cards and mailing addresses. We already have a > > MySQL db set up with the gift certificate "package" information. I just > > need to be able to store the customer information for retrieval later by the > > owners of the site. > > > > Joshua Minnie > > [EMAIL PROTECTED] > > Independent Web Consultant / Developer > > Wild Web Technology > > www.wildwebtech.com > > > > -- > > Server Information: > > + PHP v. 4.2.3 > > + Apache 1.3.26 > > + MySQL 3.23.53 > > -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] SSL, PHP, & MySQL
I will try on the PHP-DB newsgroup as well, but I wanted to let you know about a link I found which shows the integration of SSL with MySQL and PHP. Here is the link: http://www.devshed.com/Server_Side/PHP/SoothinglySeamless/page1.html. Thanks for the help. -Josh "Brad Bonkoski" <[EMAIL PROTECTED]> wrote: > I would say it really all depends on your network configuration. I am assuming > that your Web server running PHP is running on one machine (SERVER A)and the > MYSQL server running on another (SERVER B)outside of a common firewall? Is this > accurate? > > If this is true, then I would presume that PHP on SERVER A could encrypt a > datafile with MYSQL instructions and send it securely to SERVER B, but then who > would un-encrypt it and feed it to MYSQL? > > You might want to look into other alternative like tunneling with SSH or > 'stunnel'. I remember hearing some about it, but have not real experience with > it. do a search on some MYSQL mailing lists for some insight. Or ask on the > PHP-DB mailing list and you may be able to target a better qualified audience. > > -Brad > > Joshua Minnie wrote: > > > What about utilizing an encrypted text file then. Would there be anything > > wrong with doing it that way? I really don't have too much of an option as > > far as the server specs go because I didn't set up the web hosting. > > > > -Josh > > > > Brad Bonkoski wrote: > > > I think you may need to read: > > > http://www.php.net/manual/en/function.mysql-connect.php > > > > > > It appears that the SSL client flag for connecting to MYSQL is not > > available > > > until 4.3.0, but you can pick up the 4.3.0RC3 version now, and test it > > out! I > > > _think_ this is what you are looking for. > > > HTH > > > -Brad > > > > > > Joshua Minnie wrote: > > > > > > > Hi all, > > > > I was wondering if anyone could direct me to some good tutorials on > > how > > > > to utilize PHP to access a MySQL database behind SSL. I have been > > searching > > > > PHPBuilder.com, PHPClasses.org, and hotscripts.com, and I can't seem to > > find > > > > any good tutorials for a beginner when it comes to SSL. I do have a > > fairly > > > > good working knowledge of PHP and MySQL so I'm not necessarily looking > > for a > > > > guide on that, I just need to know how to pass encrypted data back and > > > > forth. Here is the scenario: > > > > > > > > My client has a website in which a customer will be purchasing gift > > > > certificates online. They don't need a comprehensive e-commerce > > package, > > > > just simple information passed across a secure connection, such as: user > > > > names, passwords, credit cards and mailing addresses. We already have a > > > > MySQL db set up with the gift certificate "package" information. I just > > > > need to be able to store the customer information for retrieval later by > > the > > > > owners of the site. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] i want to send 2 variables????
On Thu, Jan 09, 2003 at 09:14:21AM -0500, Ysrael Guzm?n wrote: > > i like send two variables using: > > href="mi page.php? http://blah.com/page.php?var1=contents&var2=contents That should do it for you. Cheers, Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] mail client?
> Does anyone know any reliable php/mysql mail-clients with support for pop3? IMP perhaps ? Have a look over at http://www.horde.org/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Changing page orientaion for printing
On Fri, Jan 17, 2003 at 05:07:30PM +1100, Stanislav Skrypnik wrote: > Hi everybody, > Is it possible using PHP change page orientation in browser so that when > user clicks > on "Print" button page automatically rotated to "landscape" orientation. > I've heard that it is possible to do with ActiveX but due to security reason > ActiveX might be disabled. > Thanks for any help in advance, > Stas. I am fairly sure this can be done with cascading style sheets (CSS) automatically. Have a look here:- http://www.w3.org/TR/REC-CSS2/media.html Cheers, Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] problems with cookies and PHP
This is driving me nuts... it won't set or reset the cookie no errors no nothing... I've learned quite a bit about cookies and PHP thus far but something important must still be eluding me. I've read the manual entry on it, is there any other tutorial out there that's better? what am I doing wrong?
[PHP] process HTML as PHP?
This may be a really elementary question but is it a good idea to add the extension .html to be processed as php? If so then it would save me quite a bit of relinking with flash... Thanks!
[PHP] non-blocking sockets + newbie compile question
1) socket_set_blocking()... what the devil's up with this? *I* get socket_set_blocking(): supplied resource is not a valid stream resource, which is obviously a lie, since I can connect to the server program and socket_recv and socket_send both work. I'm using PHP 4.3.1 (cgi) 2) I figured I'd compile the latest CVS snapshot, too, to see if maybe my non-blocking socket will work with that. I've done configure and make, but not make install. What do I do to get my nice new php without replacing the old one? -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Intermittent CGI Errors
My app works very well until you start to hit it hard. Then I get CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: The output of my script is a header() redirect so it must be returning a header right? Joshua Groboski -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Intermittent CGI Errors
No avail. Here are the last few lines of the script. I can hit it 17 times in a row with no problems. Then I might hit it three times and get the CGI Error. I think it may be IIS not PHP that is the root of this problem. We have C++ app that had the same sort of problem on IIS until we moved to Apache. Ideally we'd go to Linux or FreeBSD, but I haven't been able to convice the powers that be. "Tom Rogers" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > Friday, March 14, 2003, 7:03:09 AM, you wrote: > JG> My app works very well until you start to hit it hard. Then I get > JG> CGI Error > JG> The specified CGI application misbehaved by not returning a complete set of > JG> HTTP headers. The headers it did return are: > > JG> The output of my script is a header() redirect so it must be returning a > JG> header right? > > JG> Joshua Groboski > > > You may need to add an empty line after the header. > > -- > regards, > Tom > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP hosting with remote MySQL access allowed
I am in the process of developing a client side application that needs to speak to our remote databases. Does anybody know of a hosting solution that would allow me to have remote access to a MySQL database? I done some googling and found a quite a few hosting companies, but none of them that I have check have the information posted on their websites, so I had to submit an email question to them. Thanks Josh Minnie [EMAIL PROTECTED] There are 3 kinds of people in the worlds; those who can count and those who can't. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Zend Studio - HTTP_POST_FILES
I know this is a little off topic, but I'm hoping to find someone who uses Zend Studio who can point me in the right direction. I have just got a copy and I'm trying to run the debugger. The only problem is at the beginning of the script I am checking for a file upload. I cannot figure out how to simulate this. Any help is greatly appreciated. Joshua Groboski SAVVIS Communications Inc. http://www.savvis.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Get previous folder
You could also explode() on "/" and have all your directories in an array. Joshua Groboski SAVVIS Communications http://www.savvis.net "David Nicholson" <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... Hello, This is a reply to an e-mail that you wrote on Thu, 10 Jul 2003 at 13:04, lines prefixed by '>' were originally written by you. > Anyone know how I can stip off the end of a folder location, so that > it will be a folder in the next level up? I want to turn something > like this: > /path/to/folder/MyFolder/ > into somthing like this: > /path/to/folder/ > I just need to strip off the last folder and that is it. Can anyone > help me out? I appreciate it. Thanks. > Matt Try $folder = "/path/to/folder/MyFolder/"; $upOneLevel = dirname($folder); // $folder now contains "/path/to/folder/" For more info look at: http://uk2.php.net/manual/en/function.dirname.php HTH David. -- phpmachine :: The quick and easy to use service providing you with professionally developed PHP scripts :: http://www.phpmachine.com/ Professional Web Development by David Nicholson http://www.djnicholson.com/ QuizSender.com - How well do your friends actually know you? http://www.quizsender.com/ (developed entirely in PHP) -- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: mail()
Why don't you send it to [EMAIL PROTECTED] I think as long as the $to address doesn't fail, you'll be alright. Josh "Javier" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, I need to send a reminder to all the users in my website. > To minimize bandwidth I would like to send just an email to a domain and > then all the remaining users in the BCC. > > What would be the $to field in mail() since I send all the destinations in > $headers? > > Thanks. > > -- > *** s2r - public key: (http://leeloo.mine.nu/s2r-gmx.sig) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: references
It is perfectly legal to pass the variable by reference from one function to another. You'll see that $tmp is 2 at the end of this script. Ofcourse, if you leave off the reference operators you'll end up with 0. "Carl Furst" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Ok lets see I have the following two functions one calls the other > > Function a (&$myref) { > > ..something... then calls function b > > b($myref); > > } > > function b (&$myref) { > > something > > } > > a($myref); > > is the reference by passing in function b legal??? > > > > Carl Furst > Chief Technical Officer > Vote.com > 50 Water St. > South Norwalk, CT. 06854 > 203-854-9912 x.231 > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: changing the name of a variable by another variable.
Why don't you use an array? $variable[$i++]; -- Joshua Groboski Programmer Analyst SAVVIS Communications Inc. http://www.savvis.net "Tony Crockford" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I really am having a difficult day. > > I want to do an incrementing while loop that will echo out the values of > $variable1 , $variable2, $variable3 which exist previously. > > so how do I get the incrementing number onto the word variable? to make > a new variable that matches thename of the existing ones.. > > I tried echo $variable$increment ; but $variable doesn't exist alone so > all I get is $increment. > > I'm not sure what I should be looking for in the manual - google's not > much help either. > > anyone give me a clue? > > TIA > > Tony > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Class extension problem
Ok, I have a parent class (CMS) and a child class (WebSite extends CMS). There is some important stuff going on in the constructor for CMS that I think should be happening when I instantiate a new WebSite. Look at the following example: prop1 = "A"; } } class WebSite extends CMS{ var $prop2 = "b"; function WebSite(){ } function setProp2(){ $this->prop2 = $this->prop1; } } $ws = new WebSite(); echo "Before: " . $ws->prop2 . " : " . $ws->prop1 . "\n"; $ws->setProp2(); echo "After: " . $ws->prop2 . " : " . $ws->prop1 . "\n"; ?> If you run this, you'll notice the constructor for CMS is never called. Is this a by-design functionality, am I wrong about what I think should happen, or am I just totally off my rocker? -- Joshua Groboski Programmer Analyst SAVVIS Communications Inc. http://www.savvis.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Help with Mod mathematical function
http://us4.php.net/math The operator you want is % Eg: 5%3 = 2 <[EMAIL PROTECTED]> wrote in message news:<[EMAIL PROTECTED]>... > > > if you turn on --enable-bcmath, you can use de bcmod function > equivalen to Mod operator from visual basic > > > Un saludo, Danny > > > > Dean Baldwin > <[EMAIL PROTECTED]> Para: <[EMAIL PROTECTED]> >cc: > 06/08/2003 12:19 Asunto: [PHP] Help with Mod mathematical function > > > > > > > Hi, > > I am porting a vb application across to php but have come up against a > small problem. The code uses the Mod calculation however I cannot find > any Mod in php. The line of code that uses it looks like: > > Data = (index Mod 16) > > Anybody have any ideas how I recreate this in php? Both data and index > are integers. > > Regards, > Dean > > > -- > 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] Recursive Object Troubles
I am building a recursive Menu object. Inside each menu item there is an array which should allow me to add submenu items and so on. I am having trouble, though, with getting the submenus to stay. They are disappearing as I go along. Here is the menu class: (part of it anyway) class Menu { var $iMenuId; var $iParentId; var $iMasterId; var $sMenuName; var $sMenuType; var $bStatus; var $vecMenu; // <- This is the array of submenus which //will each have their own submenus function Menu ($iMI, $iPI, $iMstI, $sMN, $sMT, $bS){ $this->iMenuId = $iMI; $this->iParentId = $iPI; $this->iMasterId = $iMstI; $this->sMenuName = $sMN; $this->sMenuType = $sMT; $this->bStatus = $bS; $this->vecMenu = array(); // Used as static variable since PHP4 doesn't support them. global $menuCount; $menuCount++; } function bIsMaster(){ return ($this->iMasterId == $this->iMenuId); } function bIsParent(){ return ($this->iParentId == $this->iMenuId); } function bAddMenu(&$m) { if ($m->bIsParent() && $m->bIsMaster()) return false; if ($this->iMenuId == $m->iParentId){ $this->vecMenu[] = &$m; // <- This is a guess. // Added into vector by reference? return true; } for ($i=0; $i < count($this->vecMenu); $i++){ $tmpMenu = $this->vecMenu[$i]; if ($tmpMenu->bAddMenu (&$m)) return true; } return false; } } //END Menu Class Should this work? Am I just doing something completely wrong? I know someone out there knows, please let me know if you have any ideas. I really appreciate any help I can get. Thanks in advance. -- Joshua Groboski Programmer Analyst SAVVIS Communications Inc. http://www.savvis.net
[PHP] Anyone connect to a FileMaker DB?
I know, FileMaker is not a real database. I have taken over some legacy systems and while I am redesigning the system, I need to be able to connect to a FileMaker DB. If you've done it, or know how I can do it, please let me know. Joshua Groboski Programmer Analyst / Webmaster SAVVIS Communications http://www.savvis.net -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] dtd validation?
Is there anyway to do dtd validation of an xml file? I realize the expat implementation doesn't inherently support it. Is there anything that I could use from php to validate against the dtd? Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] PHP processing for .html files
I was wondering if there was a way to stick PHP code into html docs and have it processed only in certain web folders. I'm running a Windows 2000 server... IIS with the CGI version of PHP 4.3. not very server savvy so I'm not really sure how to make it work.
[PHP] Cookies and Macs
I wrote a script that used cookies to track users (the cookie contains the user's ID#). However, there was a problem when it came to the Mac users, the cookie that was assigned to them never stuck so every time they hit a page the script generated a new ID for them, made it very difficult to track them. Do Macs just handle cookies differently than PCs? What can I do to get a cookie to stick on a Mac so I can pull the data from it later? Thanks in advance! - Joshua Chapman webmaster of faxonautolit.com
[PHP] Curl request works on command line but not in script
Hi folks, I'm trying to send an XML request to a server to get its response back... I can get it to work on the command line (with passthru) but not with libcurl. I'm using libcurl 7.9.2 which may actually be different from the curl on the command line... the latter came with OS X, the former came from entropy.ch with the PHP package I installed. Of course my host is using 7.9.4 and the script doesn't work there either. I've tried it with both GET and POST... here are some setup variables. $testrequest = "$server?API=Rate&XML=EXPRESS2077020852100NoneREGULAR"; $post['API']="Rate\n"; $post['XML']= "'EXPRESS2077020852100NoneREGULAR'\n"; # (I've tried it with the 's and without, with the \n's and without) $d1 = "API=Rate"; $d2 = "XML='EXPRESS2077020852100NoneREGULAR'"; $ch = curl_init(); # doesn't work, returns Error 400 curl_setopt($ch, CURLOPT_URL, $testrequest); # also doesn't work, returns BAD REQUEST curl_setopt($ch, CURLOPT_URL, $server); curl_setopt($ch,CURLOPT_POSTFIELDS,$post); # what DOES work passthru("curl -d " . $d1 . " -d " . $d2 . " $server"); Any ideas? -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Looking for some help on web header coding.
I have been working to try and have flash MX use PHP to access a database but have been having issues with retrieving the post values in php. http://127.43.1.1/learning/checkpassword.php?password=somepassword&username= MyUserName --- Initiative is what separates a genius from the rest of the pack... --- This Quote has been brought to you in part by the Letter C. For C is for cookie. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Looking for some help on web header coding.
Thank you for your help it seems that Macromedia in there support document is a little confused about php or I need a new brain. (points to option number 2) the Macromedia document can be found at http://www.macromedia.com/desdev/mx/flash/articles/flashmx_php02.html --- Anger is only one letter short of danger. --- This Quote has been brought to you in part by the Letter C. For C is for cookie. - Original Message - From: "Peter J. Schoenster" <[EMAIL PROTECTED]> To: "'PHP'" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 11:31 AM Subject: Re: [PHP] Looking for some help on web header coding. > On 26 Sep 2002 at 10:35, Joshua Patterson wrote: > > > I have been working to try and have flash MX use PHP to access a > > database but have been having issues with retrieving the post values in > > php. > > > http://127.43.1.1/learning/checkpassword.php?password=somepassword&usern > > am e= MyUserName > > > //store header values to internal defined values. > > $username = $HTTP_POST_VARS['username']; > > $password = $HTTP_POST_VARS['password']; > > //db_connect has been removed for security purposes. > > You are using a GET, not a POST. I've never worried about this stuff. I > started with Perl and using the CGI.pm library I just was given the > input in a hash .. left details up to CGI.pm and I got the input no > matter how it was given. I use the following in PHP > > function &ProcessFormData(&$GLOBAL_INPUT) { > $FormVariables = array(); > $input = $GLOBAL_INPUT['HTTP_GET_VARS'] ? > $GLOBAL_INPUT['HTTP_GET_VARS'] : $GLOBAL_INPUT['HTTP_POST_VARS']; > foreach($input as $Key=>$Value) { > if(is_array($Value)) { > foreach($Value as $SubKey=>$SubValue) { > $FormVariables[$Key][$SubKey] = > htmlspecialchars($SubValue); > } > }else { > $FormVariables[$Key] = htmlspecialchars($Value); > } > } > return $FormVariables; > > } # End ProcessFormData > > > You might not want to use htmlspecialchars. > > Also, when I do use globals (and I hate to do that) I stick them in a > global array that gets passed around. I don't use global Yaddda > (only very rarely). Have you ever worked on someone else's code > which has over 50 scattered files and no documentation and you need to > find out where in the heck a variable is intialiazed and modified (can > be anywhere)? Is there an easy way to handle this? Drives me nuts :) > Maybe I've just not recognized the nutcracker. > > Peter > > -- > 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] Looking for some help on web header coding.
I did. That is how I came a crossed the $HTTP_POST_VARS['username']; in my code. ( The tutorial for Flash MX to php can be found at http://www.macromedia.com/desdev/mx/flash/articles/flashmx_php02.html ). If you look at my code and their code sample you will see that I have not made many changes from their sample and the only one truly is storing the vars to a internal variable instead of using it directly in the sql script. I have gotten it working by changing POST to GET as is used in Peter's sample but I have to wonder if I am still missing something as I am unable to find any documentation on this at http://php.org I came here. --- Women and cats will do as they please and men and dogs should relax and just get used to the idea. --- This Quote has been brought to you in part by the Letter C. For C is for cookie. - Original Message - From: "David Buerer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 10:42 AM Subject: RE: [PHP] Looking for some help on web header coding. > go look at the tutorial for using php with flash to retrieve variables from > a database. it's pretty self explanatory and clear in how/what to do. > > -Original Message- > From: Joshua Patterson [mailto:[EMAIL PROTECTED]] > Sent: Thursday, September 26, 2002 10:35 AM > To: 'PHP' > Subject: [PHP] Looking for some help on web header coding. > > > I have been working to try and have flash MX use PHP to access a database > but have been having issues with retrieving the post values in php. > > http://127.43.1.1/learning/checkpassword.php?password=somepassword&username= > MyUserName > > > > > > > > //store header values to internal defined values. > $username = $HTTP_POST_VARS['username']; > $password = $HTTP_POST_VARS['password']; > //db_connect has been removed for security purposes. > > mysql_select_db("test",$db); > > $result = mysql_query("SELECT * FROM users WHERE username = > $username",$db); > $myrow = mysql_fetch_array($result); > > if( md5($password) == $myrow['user_password'] ) >echo "1"; > else > echo "0"; > > //Trying to get some visibility on what is actually retrieved. > echo $password; > echo "\n\n\n"; > echo $username; > echo "\n\n\n"; > echo "end of the line"; > > > ?> > > > > > > > > > > --- > Initiative is what separates a genius from the rest of the pack... > --- > This Quote has been brought to you in part by the Letter C. > For C is for cookie. > > > > > -- > 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] Displaying full array contents
You could always use a for loop enbeded in a while loop to walk through a linked list. You could expand the list out as long as you have memory and this function would walk through it until it found the end. But the true questions is why would you want to when you can already dynamically change the size of arrays in php. --- IRS: Income Removal Service --- This Quote has been brought to you in part by the Letter C. For C is for cookie. - Original Message - From: "debbie_dyer" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 1:23 PM Subject: Re: [PHP] Displaying full array contents Easier yes and ok for debug but it doesnt look very nice on a web page does it nor does it help if you want to do something with the array elements. Debbie - Original Message - From: "Martin W Jørgensen" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, September 26, 2002 9:17 PM Subject: Re: [PHP] Displaying full array contents > print_r($array); simply print out the entire array.. > It cant be easier. > > "Debbie_dyer" <[EMAIL PROTECTED]> wrote in message > 01bf01c26598$1d84ec00$0100a8c0@homepc">news:01bf01c26598$1d84ec00$0100a8c0@homepc... > > Use a static variable in the function? A static var retains its value > > between function calls > > > > function printArray($arr) { > > static $depth = 0; > > for ($i =0; $i < count($arr); $i++) { > > if (!is_array($arr[$i])) { > > echo "$depth $arr[$i]"; > > } > > else { > > $depth++; > > printArray($arr[$i]); > > $depth--; > > } > > } > > } > > > > $arr = array("Orange", "Peach", "Apple"); > > $arr2 = array("Banana", $arr, "Pear"); > > $arr3 = array($arr, $arr2); > > > > printArray($arr3); > > > > Debbie > > > > - Original Message - > > From: "Brad Harriger" <[EMAIL PROTECTED]> > > To: <[EMAIL PROTECTED]> > > Sent: Thursday, September 26, 2002 8:46 PM > > Subject: Re: [PHP] Displaying full array contents > > > > > > > Debbie, > > > > > > Yes. I could use recursion, but what's really hanging me up is keeping > > > track of how deep into an array I am. It should be fairly simple, but I > > > seem to be having a brain freeze. > > > > > > Brad > > > > > > > > > > > > Debbie_dyer wrote: > > > > > > > You could use recursion example:- > > > > > > > > function printArray($arr) { > > > > for ($i =0; $i < count($arr); $i++) { > > > > if (!is_array($arr[$i])) { > > > > echo $arr[$i]; > > > > } > > > > else { > > > > printArray($arr[$i]); > > > > } > > > > } > > > > } > > > > > > > > $arr = array("Orange", "Peach", "Apple"); > > > > $arr2 = array("Banana", $arr, "Pear"); > > > > $arr3 = array($arr, $arr2); > > > > > > > > printArray($arr3); > > > > > > > > Debbie > > > > > > > > - Original Message - > > > > From: "Brad Harriger" <[EMAIL PROTECTED]> > > > > To: <[EMAIL PROTECTED]> > > > > Sent: Thursday, September 26, 2002 6:50 PM > > > > Subject: [PHP] Displaying full array contents > > > > > > > > > > > > > > > >>I'm trying to write a function that will display the full contents of > an > > > >>array. If one of the keys contains a value that is an array, the full > > > >>array (all indices) should be shown. > > > >> > > > >>As an example, given the following definitions: > > > >> > > > >>$Arr1[1] = "Apple"; > > > >>$Arr1[2] = "Banana"; > > > >>$Arr1[3] = $Arr2[]; > > > >>$Arr2[1] = "Carrot"; > > > >>$Arr2[2] = $Arr3[]; > > > >>$Arr3[1] = "Orange"; > > > >>$Arr3[2] = "Peach"; > > > >> > > > >> > > > >>the output should be: > > > >> > > > >>Arr1:1:Apple > > > >>Arr1:2:Banana > > > >>Arr1:3:Arr2[] > > > >>Arr1:3:Arr2:1:Carrot > > > >>Arr1:3:Arr2:2:Arr3[] > > > >>Arr1:3:Arr2:2:Arr3:1:Orange > > > >>Arr1:3:Arr2:2:Arr3:2:Peach > > > >> > > > >>The closest I've come is: > > > >> > > > >> while (current($myArr)) > > > >> { > > > >> if(is_array(current($myArr))) > > > >> { > > > >> $arrKey = key(current($myArr)); > > > >> echo "Array "; > > > >> echo " = "; > > > >> $baseArray = key($myArr); > > > >> echo key($myArr); > > > >> echo "\n"; > > > >> walkArray(current($myArr)); > > > >> } > > > >> else > > > >> { > > > >> $arrKey = key($myArr); > > > >> if ($baseArray != "") > > > >> { > > > >> echo $baseArray; > > > >> echo ":"; > > > >> } > > > >> echo $arrKey; > > > >> echo " = "; > > > >> echo current($myArr); > > > >> echo "\n"; > > > >> } > > > >> next($myArr); > > > >> } > > > >> > > > >>This code only echoes one dimension of a multi-dimension array. I > can't > > > >>find a way to reliably store more than that. Any suggestions? > > > >> > > > >>Thanks in advance, > > > >> > > > >>Brad > > > >> > > > >> > > > >>-- > > > >>PHP General
Re: [PHP] CC Processing Merchants
We use an Authorize.net reseller, merchantexpress.com. While the sign up process can be a hassle, I'm pretty happy with Authorize.net. Since we use the ADC Direct method, we don't lose control at all. When the customer submits their credit card info, our PHP script uses Curl to securely request authorization from Authorize.net and then decides what page to show the customer based on the response it gets (i.e., card declined, card accepted, etc) -Josh >A few months ago I setup a client with Authorize.net. I always hated >using them as I lose control for a click but it worked out well. I save >all the data before I send them off and then update their record when >Authorize.net sends them back to the url that I gave them. It has >worked well. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP & XML
>To me this is a lot of work and processing for limited benefits, a simple db >abstraction layer provides you with a divide between you db queries and the >presentation of your site, what benefits do you see in doing this? I have to agree with Simon. I am at a loss when it comes to seeing any benefit to XML that doesn't involve data exchange between at least two parties. I've spent the last two years building database-backed websites, so I'm constantly trying to improve how I build them in order to make design and maintenance easier... I used to rely heavily on SSI for this, and now I rely more on PHP... if XML would make things easier, believe me, I would LOVE to know how... but I just don't see it. -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Re: PHP & XML
I still wouldn't use XML for this. I mean, all the articles are in the database, and I'm already using PHP to pull them out and format them into html, right? I can just as easily use PHP to put them into all those other formats. So again, why waste time with XML unless I need to feed these articles to others, like in a newsfeed situation? >But if I were ever I would definitely invest the effort that is required, >but until then I will save myself from the extra work. >Let's imagine you create a website of an online magazine, this magazine >publishes in HTML, PDF, TXT, PS, etc, etc, etc. How would you do it? > >I would use XML to write the articles and then stylesheets to transform the >articles to the formats I want. Write once, publish anywhare ;-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] what kind of weird problem is this?
I just installed the php 4.2.1 from entropy.ch and when running this script: I get this error: Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /Library/WebServer/Documents/west.php on line 3 Anyone know what *that* is about? -Josh
Re: [PHP] what kind of weird problem is this?
Thanks, I didn't know about od 000< ? p h p \n \n $ t e s t 312 = 312 " 020j u s t a b o u t a n y t h 040i n g " ; \n \n e c h o " t h i 060s w a s j u s t a t e s t 100" ; \n \n ? > 106 That is REALLY weird. I use BBEdit. I've always used BBEdit. -Josh >Are you using a broken editor of some sort? All I can think of here is >that your spaces aren't really spaces. Try an od -c on that file from >your prompt. > >-Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] what kind of weird problem is this?
Opening the file in vi shows that BBEdit is, for some reason, using \xca where the spaces should be. Off to BareBones.com I go... >Well, 312 is not a space. Please use a text editor that knows what a >space is. The other lines look fine, but your $test<312>=<312> stuff >there is bogus. > >-Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] OSX + Apache + PHP + MySQL
You don't need OS X server. OS X includes Apache and Perl.. you can get MySQL and PHP4 from http://www.entropy.ch -Josh At 6:06 PM +1000 6/21/02, Justin French wrote: >Do I need OSX SERVER to run everything I'd need for a development >environment, or will the base version of OSX have the capabilities I need >(running a test server of Apache/PHP4/MySQL/Perl/etc? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gradients in PHP & GD
"It seems pretty straightforward to me." is more responsible than "It's pretty straightforward." Nice time to be changing your story ;) >Anyway, thank you for your input on this thread. THAT was really helpful. It didn't seem straightforward to the original writer, or else why the question... I think a more helpful response at that point is to ask questions, rather than suggest that the person simply "write it". There seems to be some hostility and impatience here toward new users who aren't as familiar with how to ask for help. If this exchange prompts anyone to examine themselves and respond (or ask) in more gentle ways, I think my input will have definitely been helpful. -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Web Printing
>Don't tempt them, people _do_ come up with the most oblique of reasons why >their question is related to php. According to the Discordian Law of Fives, their questions share with PHP (and everything else) a relation to 5. So you always have that. -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: Drop connection, keep running?
This sounds like the right track to me... the script has to finish for the page to stop loading, yes? So exec("your_other_script &"); and be done with it, yes? >I have never heard of someone wanting to do this, but you might want >to look into methods of executing shell commands in the background, >which seems like it should be possible. Basically, you're wanting to -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gradients in PHP & GD
>Well, I'm deeply moved by your concern - I don't think I was either >hostile or impatient however - I was just stating the obvious and >implying a question (why isn't it straightforward). That was my problem with your post--why imply the question, and leave it open to interpretation? Why not just ask? Who would mistake a direct request for more info as hostile or impatient? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gradients in PHP & GD
By this point, I am trying to speak generally. Not trying to pick on Bogdan specifically, since communication can always be improved. >Please tell me what would be a question which would leave all these >answer opportunities open while also being brief and obviously not >being hostile? Hmm... not sure... how about, "I don't have enough info from your post to help... please tell us more about what exactly you are having problems with?" How does that sound? That's fairly general, based on a post I saw here recently. Of course it could be augmented with questions like "Are you new to PHP?" and, in the specific case we've been discussing, "Are you trying to create a basic gradient or something unusual?", etc. -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Editing Word Documents
It sounds like a job for WebDAV to me... -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] shtml & php in the same file?
I'm working on this site that is all shtml files... in order to add some dynamic content, it just includes php scripts in different places. However, sessions don't work unless you start it before outputting anything to the server and that's what's needed now... I don't want to change all the links to end in .php and do the includes in php just so I can put at the beginning of all the pages. So I was trying to get the server to treat shtml files as both server-parsed and as php scripts. Not working too well. ;) Anyone have any ideas? -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] shtml & php in the same file?
There are people who don't use Apache??? ;) >ending in .php and add the same thing for .shtml. Then, both will be >parsed by PHP first. But then will it be parsed by SSI second, as we would like? Doesn't seem to... -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] cache control with javascript
Does anybody know how I can make force a javascript file (written in PHP) to be cached if the user agent allows it? Here is the situation: I am creating a dropdown menu system that contains a customer list, loaded from a database. This list is written to the javascript file for the menu. The menu can be quite large as the data grows. What I would like to do, is force it to be cached (unless of course the user agent doesn't allow it) so that it doesn't have to make the call to generate the file each time. I have searched through the php.net website and even through the HTTP/1.1 protocols. I am continuing to look, but have not found a definite answer as to whether or not what I am trying to do is possible. -- Joshua Minnie Lead Web Application Developer Advantage Computer Services, LLC www.advantagecomputerservices.com [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] cache control with javascript
The "it" that you were asking about was the server. The javascript file is actually a PHP file that produces the JavaScript that I need. I only have one access to a database and a while loop to generate the code. Here is the code pieces: [code] // already connected to the db $sql = "SELECT * FROM Customers ORDER BY LastName ASC, FirstName ASC"; $result = mysql_query($sql) or die(mysql_error()); while($row = mysql_fetch_assoc($result)) { // generate the javascript } [/code] The customer database can get potentially large so that this file could take a while to generate. Currently there are only 300 records but I anticipate many more. Does anyone have any recommendations that might speed this up? Josh "- Edwin -" <[EMAIL PROTECTED]> wrote: > > Does anybody know how I can make force a javascript file (written in > > PHP) to be cached if the user agent allows it? > > > > Here is the situation: > > I am creating a dropdown menu system that contains a customer list, > > loaded from a database. This list is written to the javascript file > > for the menu. The menu can be quite large as the data grows. What I > > would like to do, is force it to be cached (unless of course the > > user agent doesn't allow it) so that it doesn't have to make the > > call to generate the file each time. > > What is the second "it" in the last sentence above? A browser wouldn't > make the call to "generate" the javascript file each time. > > > I have searched through the php.net website and even through the > > HTTP/1.1 protocols. I am continuing to look, but have not found a > > definite answer as to whether or not what I am trying to do is > > possible. > > Just make sure that the javascript is on a separate file (i.e. > whatever.js) and that it's NOT being generated by your (php) script > each time. Then, "call" that file from inside your html/php page. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] cache control with javascript
That really helped, I didn't think about generating the file that way. I have done other things like that, but sometimes it just helps when you get another set of eyes on the project at hand. Thanks for the refresher. Josh -Original Message- From: - Edwin - [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 21, 2003 11:56 AM To: Joshua Minnie Cc: [EMAIL PROTECTED] Subject: Re: [PHP] cache control with javascript On 2003.10.21, at 22:28 Asia/Tokyo, Joshua Minnie wrote: > The "it" that you were asking about was the server. The javascript > file is > actually a PHP file that produces the JavaScript that I need. I only > have > one access to a database and a while loop to generate the code. Here > is the > code pieces: ...[snipped_code]... > The customer database can get potentially large so that this file > could take > a while to generate. Currently there are only 300 records but I > anticipate > many more. Does anyone have any recommendations that might speed this > up? Hmm... I think you missed the point earlier. Here's the basic idea. Create/generate a separate file ("whatever.js") [1] and make sure that this file is ONLY *updated* when necessary (e.g. updated database)[2]. Call this file inside your HTML tags. [3] This way, the "whatever.js" will be "cached" whenever possible. - E - [1] Check the file functions in the manual (if you're not familiar with it already). (http://www.php.net/manual/en/ref.filesystem.php) [2] Tip: Have a separate php script that generates the "whatever.js". Use/run this script ONLY after you made an update to your database. [3] Something like this: __ Do You Yahoo!? Yahoo! BB is Broadband by Yahoo! http://bb.yahoo.co.jp/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] file download using header
I am having some trouble making it possible to download a file using the header function. The problems are: (1) I get the dialog box to download the file, but for some reason the type of file isn't getting passed to the box, and (2) when I download a 4MB file it only seems to be getting 16.6KB. I haven't used header for this purpose before this, so maybe I am missing something. I Googled around and found the content-disposition type I thought I needed, I actually tried 3 different types (the file is a compressed zip file). I Googled around for tutorials on downloading files and still haven't found the answer to correcting my problem. Here is the code I am using, maybe a couple more trained eyes looking at this could help me out. http://www.usa-financial.com'.urldecode( $_GET['link'] ); $type = urldecode( $_GET['type'] ); $size = filesize( '/home2/www/usa-financial'.urldecode( $_GET['link'] ) ); header("Content-type: $type"); header("Content-Disposition: attachment; filename=$download;"); header("Accept-Ranges: bytes"); header("Content-Length: $size"); echo "\n"; ?> Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file download using header
Okay, I found a solution to part one of my questions by changing my headers, but for some reason I am still getting a fractional download of the file. Most commonly it's about 16.6KB of a 4MB file. The kicker is it says that it completed successfully. Here is the modified code: > I am having some trouble making it possible to download a file using the > header function. The problems are: (1) I get the dialog box to download the > file, but for some reason the type of file isn't getting passed to the box, > and (2) when I download a 4MB file it only seems to be getting 16.6KB. > > I haven't used header for this purpose before this, so maybe I am missing > something. I Googled around and found the content-disposition type I > thought I needed, I actually tried 3 different types (the file is a > compressed zip file). I Googled around for tutorials on downloading files > and still haven't found the answer to correcting my problem. Here is the > code I am using, maybe a couple more trained eyes looking at this could help > me out. > > $download = 'http://www.usa-financial.com'.urldecode( $_GET['link'] ); > $type = urldecode( $_GET['type'] ); > $size = filesize( '/home2/www/usa-financial'.urldecode( > $_GET['link'] ) ); > header("Content-type: $type"); > header("Content-Disposition: attachment; filename=$download;"); > header("Accept-Ranges: bytes"); > header("Content-Length: $size"); > > echo "\n"; > ?> > > Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: file download using header (SOLVED)
I found the solution, I ended up instead of using readfile, use fopen and fpassthru. Here is the code that solved the problem > Okay, I found a solution to part one of my questions by changing my headers, > but for some reason I am still getting a fractional download of the file. > Most commonly it's about 16.6KB of a 4MB file. The kicker is it says that it > completed successfully. > > Here is the modified code: > $download = 'url/path/to/file'.urldecode( $_GET['link'] ); > $type = urldecode( $_GET['type'] ); > $size = filesize( '/abs/path/to/file'.urldecode( $_GET['link'] ) ); > header("Pragma: public"); > header("Expires: 0"); // set expiration time > header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); > // browser must download file from server instead of cache > // force download dialog > header("Content-Type: application/force-download"); > header("Content-Type: application/octet-stream"); > header("Content-Type: application/download"); > // use the Content-Disposition header to supply a recommended filename > and > // force the browser to display the save dialog. > header("Content-Disposition: attachment; > filename=".basename($download).";"); > /* > The Content-transfer-encoding header should be binary, since the file > will be read > directly from the disk and the raw bytes passed to the downloading > computer. > The Content-length header is useful to set for downloads. The browser > will be able to > show a progress meter as a file downloads. The content-lenght can be > determines by > filesize function returns the size of a file. > */ > header("Content-Transfer-Encoding: binary"); > header("Content-Length: ".(string)($size)); > readfile("$download"); > ?> > > > I am having some trouble making it possible to download a file using the > > header function. The problems are: (1) I get the dialog box to download > the > > file, but for some reason the type of file isn't getting passed to the > box, > > and (2) when I download a 4MB file it only seems to be getting 16.6KB. > > > > I haven't used header for this purpose before this, so maybe I am missing > > something. I Googled around and found the content-disposition type I > > thought I needed, I actually tried 3 different types (the file is a > > compressed zip file). I Googled around for tutorials on downloading files > > and still haven't found the answer to correcting my problem. Here is the > > code I am using, maybe a couple more trained eyes looking at this could > help > > me out. > > > > > $download = 'http://www.usa-financial.com'.urldecode( $_GET['link'] ); > > $type = urldecode( $_GET['type'] ); > > $size = filesize( '/home2/www/usa-financial'.urldecode( > > $_GET['link'] ) ); > > header("Content-type: $type"); > > header("Content-Disposition: attachment; filename=$download;"); > > header("Accept-Ranges: bytes"); > > header("Content-Length: $size"); > > > > echo "\n"; > > ?> > > > > Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] The ASP "application" object in PHP?
One way to simulate an application object is to use the php.ini "auto_prepend_file" option. Set the file with your application variables to be the file you want to prepend to every file in your application. Now, the only part that you don't have is an easy way to add/update/delete these variables. I suppose you could write a fairly simple class that allowed you to manipulate the file line by line, which would essentially give you access to all the variables for add/update/delete functionality. I use "auto_prepend_file" quite a bit for my applications and it acts just like an application object. I haven't found a time where I need/want to manipulate the variables "on the fly" within code. Most of the variables being set are simply configuration settings for the application, not variables needing to change and be shared across the application. Hope that helps some, Joshua Hoover > > For those of you not familiar with ASP, the lowdown is this: The > > application object acts like a global session. You assign it variables > > and values like you would a session, but those variables are available > > to all instances and sessions. It is for example very useful to track > > different users at the same time, or to send messages from one session > > to another, or the likes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Passing to an Applet
All right I've seen in done in jsp and asp, but I'd like to know if I can do it in PHP as well. I've got an applet, which is in the page replay.php, with these parameters that I need to fill from a URL. I need to pass 2 parameter in the URL from another page to this one, those parameters are FILEPREFIX and MAXINDEX. I've set my link to read as The question is how to I, if I can, use PHP to take those variables from the URL string and use them for the values on that page. I know most people want to just say RTFM or look it up, but at this point if anyone could just tell me what this would be under or where exactly this info is, if it's possible in php. Thanks Anti-Blank Site Designer/Unix Admin
[PHP] 4.1.2 binary for Windows?
I went to get the PHP 4.1.2 binary for Windows in order to address the security issues that were most recently announced. Unfortunately, I don't believe php.net or zend.com has PHP 4.1.2 binaries for Windows available for download, is this correct? Can someone point me to a place to download 4.1.2 for Windows or give an update on when the update may be made available in binary form? Thank you, Joshua Hoover -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem with MSSQL
Check your "php.ini" file in your C:\WINNT directory. Make sure that you have php_mssql.dll extension uncommented in your php.ini file. Then check to see where the php.ini is looking for the extensions. If you installed PHP in C:\PHP, then the line for extension_dir in your php.ini file would be: extension_dir = C:/PHP/extensions Once you have all that checked, then I would go to a command prompt and get into the PHP directory. From the PHP directory, run the command: php -i and see if any error dialog boxes appear. If you get errors, then it's most likely telling you that it can't find the appropriate dll files used to connect to SQL Server. To remedy this you can add the following to your Windows PATH variable: C:\PHP\dlls; This, again, is assuming you have PHP installed on C:\ Hope that gets you pointed in the right direction. Joshua Hoover - Original Message - From: "pong-TC" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, March 08, 2002 5:17 PM Subject: [PHP] Problem with MSSQL > Hello All > > I just reinstalled PHP 4.1.1 on IIS5 (win2000) over the old version by > using the installer. I installed as a cgi. Then, I got problems with > mssql_connect function. It doesn't work as it did before. Here is the > error message: > > Fatal error: Call to undefined function: mssql_connect() in > d:\inetpub\wwwroot\cgi-bin\Submitted.php on line 25 > > It is my mistake that I reinstalled without realization. So, I got a > trouble. Anyone, please help. > > Thank you. > Pong > > > -- > 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: Version Contol for PHP site
John is right. Use something like WinCVS. Then you can either setup virtual hosts for each developer to have as their "sandbox" on the development server or you can allow the developer to run php on his/her own box and check in to the development server when they check into CVS. There are pros and cons to each approach. You have more central control with having the sandboxes on the dev server, but you might have an admin nightmare on your hands if configurations keep having to change, etc. Letting the developer run PHP on his/her own box is very flexible, but may not mimic the production environment well enough. Hope that helps... Joshua Hoover > Hi Jeff > > There is a Windows version of WinCVS (see http://wincvs.org/ ). > > John > > Jeff Bearer <[EMAIL PROTECTED]> wrote in message > 1006195598.1407.7.camel@jbearer">news:1006195598.1407.7.camel@jbearer... >> Hello, >> I'm trying to come up with a workable solution to implement version >> control for our site. I have developers that use windows, and don't >> know too much about the unix command line, so I'd prefer to use a >> windows client to work on the site if possible. >> >> I'm looking into CVS for the version control and I've found some >> directions on how to use it with websites. But it only talks about >> static HTML development, it doesn't say how developers would debug PHP, >> CGI, etc. This solution would not give them any ability to debug their >> code before checking it back in. >> >> I suppose if I could get them all comfortable with the UNIX command >> line, they could work on the development server, checking out the files >> to a working directory that is also a virtual host. >> >> A new idea that I just came up with would be to have the developers use >> VNC viewer to connect to an X server on the development box. The >> deveopers could use a X GUI for CVS to check it out, and edit files >> etc. >> and keep the working directory a virtual host like above. >> >> Is anybody doing something like this with their PHP development? Any >> direction from a working implementation would be great. And what do you >> think about the VNC idea that I just came up with? >> >> -- >> Jeff Bearer, RHCE >> Webmaster >> PittsburghLIVE.com >> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: A tricky one?
If you only want to show the ones variables that have values input by the user, you could do this with the while loop: while (list($var, $val) = each($HTTP_POST_VARS)) { if ((strlen($val) > 0) && ($var !="email") && ($var !="SUBMIT") && (isset($var)) { $message .= "$val $var were ordered \n"; } } This will make sure that the string length of $val (the value of the form element) is greater than 0; if not, it won't add it to the message. Joshua Hoover > It works after modifying it a little. BUT... :) It lists all the > variables > even if they aren't given any value. Is it possible to only get the > defined > ones? > > Regards Raymond > > > "Matthew Luchak" <[EMAIL PROTECTED]> wrote in message > [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > > how about... > > > $message=""; > $header="From: $email"; > $to="[EMAIL PROTECTED]"; > $subject="burger me"; > > while(list($var, $val) = each($HTTP_POST_VARS)) > { > if(($var !="email")&&($var !="SUBMIT")&&(isset($var)){$message > .="$val $var were ordered \n";} > } > > MAIL( > "$to", > "$subject", > "$message", > "$header" > ); > ?> > > Matthew Luchak > Webmaster > Kaydara Inc. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] How do I convert from perl to php?
Try something like this: while (list($name, $value) = each($HTTP_POST_VARS)) { if ((strlen($value) < 1) && ($name == "name" || $name == "address" || $name == "phone")) { $error .= "You left $name empty "; } } if ($error) { echo $error; } That's one way to do it. Joshua Hoover > I am a perl user trying to convert to php > > how would i turn this perl into php? > > use CGI; > > $name = param(name); > $address = param(address); > $phone = param(phone); > > @required = qw( name address phone ); > > foreach $key($required) > { > if (!$$key) { &out("You left one empty."); } > } > > ?? > > > - > This message was sent using OlyPen's WebMail. > http://www.olypen.com > > > The original message was received at Tue, 20 Nov 2001 14:05:28 -0800 > from mail.olypen.com [208.200.248.2] > >- The following addresses had permanent fatal errors - > <[EMAIL PROTECTED]> > (reason: 550 Host unknown) > >- Transcript of session follows - > 550 5.1.2 <[EMAIL PROTECTED]>... Host unknown (Name server: > lists.php.ne: host not found) > Reporting-MTA: dns; relay1.olypen.com > Received-From-MTA: DNS; mail.olypen.com > Arrival-Date: Tue, 20 Nov 2001 14:05:28 -0800 > > Final-Recipient: RFC822; [EMAIL PROTECTED] > Action: failed > Status: 5.1.2 > Remote-MTA: DNS; lists.php.ne > Diagnostic-Code: SMTP; 550 Host unknown > Last-Attempt-Date: Tue, 20 Nov 2001 14:05:28 -0800 > > From: [EMAIL PROTECTED] > Date: Tue Nov 20, 2001 05:08:17 PM US/Eastern > To: [EMAIL PROTECTED] > Subject: Converting from being a perl user > > > how would i turn this perl into php? > > use CGI; > > $name = param(name); > $address = param(address); > $phone = param(phone); > > @required = qw( name address phone ); > > foreach $key($required) > { > if (!$$key) { &out("You left one empty."); } > } > > ?? > > - > This message was sent using OlyPen's WebMail. > http://www.olypen.com > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Re: Re: How do I convert from perl to php?
BUT, that code doesn't take into account that you may have other form parameters that you DON'T want to require. With that code below, you're requiring EVERY form element to be filled out. That's not what the original post requested. He asked for a way to require specific fields according to the way his Perl code reads. Joshua Hoover > Now this looks like what I would want... > > brandon > > - Original Message - > From: "Philip Hallstrom" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Sent: Tuesday, November 20, 2001 2:22 PM > Subject: [PHP] Re: Re: How do I convert from perl to php? > > > You could do something like this... there are lots of ways to validate > your data... > > while( list($key, $value) = each($HTTP_POST_VARS) ) { > if( empty($value) ) { > print("Sorry, you left $key empty."); > } > } > > This is assuming the form method is POST. If it's GET, switch POST with > GET above. > > -philip -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Problems.Sessions id on urls
This is actually a feature that PHP offers when compiled with the --enable-trans-sid option. If a browser does not support cookies or has security settings that place restrictions on cookies that won't allow PHP to have access to the cookie, then PHP will append the session id to the URL. I believe you can get rid of this (but may not having working sessions for some clients) by changing the following: session.use_trans_sid = 1 to session.use_trans_sid = 0 Save the php.ini file and restart your web server if you have PHP installed as a module/plug-in. That should do it for you. For more info on sessions and the trans-sid stuff, check out: http://www.php.net/manual/en/ref.session.php Hope that helps. Joshua Hoover > Some browser (konqueror) show the session id in the url. Does anoyone > know > how to aviod that. Netscape does not show the session id. > > Thanks in advance > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Validating mailing addresses
Hi list, I've been looking at a variety of software packages which allow you to validate U.S. mailing addresses against the USPS's database. Unfortunately, all of the products I've been able to find so far are Windows based and only support interfacing via COM. I want to be able to validate and clean up addresses via my PHP application so going with a product with only a COM interface is not going to be sufficient since we're running Linux servers. (Or, is there a trick to calling COM objects from Linux?) Does anyone have any recommendations? The main objective here is to be able to validate mailing addresses and clean them up (if necessary) in order to be able to ship out packages optimally with as few errors as possible. Thanks in advance! Joshua Hoover -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Logo proposal
How about a Beaver? They're small, fast, and efficient. Joshua Hoover > How about a porpoise. They're fast, intelligent, and as Lewis Carol said, > "you shouldn't go anywhere without a porpoise." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] include, require, require_once
Hi, On Sat, Jul 21, 2001 at 12:18:38AM -0300, Thiago Locatelli da Silva wrote: > what is the diference beetwen this functions? I believe the include/require_once() functions check to see if that particular include was previously included in the script and if it was it ignores it, at least that is the way I understand it. require() differrs from include() because it will always read the targetted file even if the line of code it is sitting on is never actually executed. Hope that describes it for you. Regards, Josh -- First post to list :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] PHP and OLE objects
Hi all, I am having a problem with a PHP script, in which I am using a self-written OLE object to provide data to the script. I have two other OLE DLLs that I also use in PHP scripts which work fine. I wrote all of the DLLs in Borland Delphi, btw. (I am running PHP 4.0.6 and Apache 1.3.20 on Windows 2000 Pro) For some reason, whenever I try to access one of the Char/String variables (in only this DLL) from PHP, it returns a warning: "Error in php_OLECHAR_to_char()". I have been trying to fix this problem for some time now, and am having no luck finding a source. I have had this message before, but it was easily fixed by setting a default value for the strings (in the DLLs) to a single ascii-32, so that the return would not be blank. The only difference between this object and the others is that the low-level delphi code uses pointer variables to set up the data access, whereas the others do not. I have used this object in other non-PHP projects (and tests :) and it works as it is intended to. Also, all other types of variables in the object are intact. Can anyone suggest a source of this problem? On what conditions does php_OLECHAR_to_char() error out? Thanks in advance, Joshua Ecklund - mProwler -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
[PHP] Problem querying postgres
Hi, I am new to postgres using PHP. I have gotten PHP POSTGRES and PHPADMIN installed and have a database setup using PHPADMIN. The problem that I am having is that when I connect to postgres outside of PHPADMIN and try use pg_query() to do a select such as "SELECT PersonID FROM person" the string that is sent is "select personid from person". Now this is a problem because in the data base the field PersonID is not the same case as in the select that is sent and I get the error Warning: pg_query(): Query failed: ERROR: column "personid" does not exist in /Users/jcapy2/Sites/Jesper/SyncPosgresToMbrMaxData.php on line 70 If I change the field to all lower case in the database this does not happen. Also I can isue this select within PHPADMIN and it does work! Can anyone tell me where the setting(s)are that are controling how php is sending strings? Thanx Joshua -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Problem connecting to Postgres
Hi, I am a newby having a configuration problem. I am using PHP 4.3.6 and postgres 7.4.3 The problem is when I try to execute my php scripts that connect to postgres from the command line I get error like this: Fatal error: Call to undefined function: pg_connect() in /Users/jcapy2/Sites/Jesper/SyncPosgresToMbrMaxData .php on line 28 But it works fine from a browser using apache. I have tried various user logins and have checked the environmental paths and all seems ok so it must be some configure problem but with what PHP or Postgres? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Problem connecting to Postgres
Thanks On Aug 23, 2004, at 12:04 PM, Jay Blanchard wrote: [snip] Fatal error: Call to undefined function: pg_connect() in /Users/jcapy2/Sites/Jesper/SyncPosgresToMbrMaxData .php on line 28 [/snip] http://www.php.net/manual/en/features.commandline.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] Problem connecting to Postgres
Yes I have found that I am running v 4.3.2 on the command line and 4.3.6 under apache Is it possible to run the same version both on the command line and running on apache? On Aug 23, 2004, at 12:23 PM, Michal Migurski wrote: I am a newby having a configuration problem. I am using PHP 4.3.6 and postgres 7.4.3 The problem is when I try to execute my php scripts that connect to postgres from the command line I get error like this: Fatal error: Call to undefined function: pg_connect() in /Users/jcapy2/Sites/Jesper/SyncPosgresToMbrMaxData .php on line 28 But it works fine from a browser using apache. The version of PHP used by Apache may not necessarily have been configured the same way as the one you're using on the command line. Try phpinfo() to determine what's there, and recompile/reinstall if you're lacking PG support. Or, try to find the command line instance that corresponds to the apache module you're using. - michal migurski- contact info and pgp key: sf/cahttp://mike.teczno.com/contact.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] Problem connecting to Postgres
Ok next stupid question At the command line how to I force the execution of the 4.3.6 apache version or change the default to it. On Aug 23, 2004, at 2:39 PM, Jay Blanchard wrote: [snip] Yes I have found that I am running v 4.3.2 on the command line and 4.3.6 under apache Is it possible to run the same version both on the command line and running on apache? [/snip] Yes. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: Re[2]: [PHP] Do you have some standard for defined the variable in program language?
Tedd- Java has classes listed with an Uppercase. It could be JS you're thinking of but I'm not sure. Functions (except constructors) and variables have the lowerUpperCamelCase notation. Regards, -Josh On Jul 27, 2010, at 12:55 PM, tedd wrote: > At 1:38 PM +0300 7/27/10, Andre Polykanine wrote: >> Hello viraj, >> >> As for classes, it's suggested to start a class name with a capital: >> class MyBestClass { >> ... >> } > > In some languages (I can't remember if it is Java, or Javascript, or both) > the first letter should be lowercase, such as: > > myBestClass > > Cheers, > > tedd > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.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] the state of the PHP community
On Jul 29, 2010, at 3:32 AM, Nathan Rixham wrote: > Hi Josh, > > Thanks for taking the time - comments in-line from here :) > > Josh Kehn wrote: >> Java, JS (in the form of Node and MongoDB, +raw client / jQuery stuff) and >> PHP get used regularly. Python / Ruby infrequently. > > With true confirmation bias - great to see you mentioning node.js, have a > universal language / syntax for programming is critical moving forwards. I've > been 'playing' with node for a while now myself, added an upgrade to handle > client side ssl certificates properly and expose needed values recently, and > currently working on making tabulator's rdflib work on both client and server > (i.e., porting it to node amongst other things). I haven't gone that far with Node yet, someone is writing an email server though. I hated JS for many (I believe good) reasons for a long time. I felt it was a client side showy gimmick. I do server side development. Why should I know the eight or nine different DOM structures? Leave that to designers I said! Once you get past the syntax it is an incredibly powerful language. There are faults (come on, it fails silently!) but proper understanding negates these for the most part. Another thing to note is how incredibly flexible it is. Node / Mongo both make use of JS syntax (albeit with their own unique "flavor") but it all boils down to a very simple, elegant, system. > > MongoDB I managed to bypass somewhere, I quickly migrated past NoSQL and on > to triple/quad store(s) - again for universality reasons, on the path to a > full embrace of N3. This said, I should probably give some more weight to > MongoDB, certainly with it's json friendly-ness I can see how it could fit in > to my preferred tech stack. MongoDB is a bit unique. I've only been working with it for a few months now but it really is something to keep an eye out for. If you prefer traditional "SQL" also take a look at VoltDB. > >> Started with QBasic and realized it was crap. Moved on to Java, realized >> object rock but J2EE doesn't. Moved to PHP / Java. > > QBasic was crap lol, that was my first language after playing with .bat files! I'm not sure if I did bat files first, but I do remember playing with Win95 assembler. It's a miracle I'm not scarred for life. > >> http://www.mongodb.org/ >> http://nodejs.org/ >> See http://joshuakehn.com/blog/index.php/blog/view/28/MongoDB-Node-js/ > > Nice blog, subscribed - used to do my braces the same as you then reverted > back to putting them EOL, will comment on your blog with reasons why. If the comments don't work let me know. That's a basic blogging engine I wrote with CI, it's in desperate need of some help. > > Also, golf-code! that had escaped my radar somehow, looks like I can waste a > few hours with that one - love it. > >>> >> I haven't gotten flashed on any PHP meetups, but I wouldn't shy away from >> them. > > Here in Scotland I read that as "I haven't had anybody flash their genitals > at me on any PHP meetups, but I wouldn't shy away from them" - thus, lol! LOL would be the correct reaction to that! > >>> Are you a member or any other web tech communities, opensource efforts, or >>> standardization bodies - again, if so which? >> None that I recall. >>> Are there any efforts, projects or initiatives which are floating your boat >>> right now and that your watching eagerly (or getting involved with)? >> Node, Mongo. I'm also watching a couple git repos, memcached and scribe to >> name two. Some stuff I just can't be involved in (C / C++ dev is tricky when >> you work with Java / PHP). > > another +1 for git, makes life easier, will hunt you down and see what you're > all following (other than memcached and scribe). If you go to my root site I believe I have a link. > > on the c/c++ side, I thought the same thing (being Java/PHP for the past > while pretty solidly) but as mentioned earlier, recently hacked out some c++ > for node and it was easier than I thought once I 'just did it', I guess I'm > saying don't let that feeling phase you, if you want to do it - just do it, > you're a programmer not a specific languager. :) > >>> ps: please *do not* flame anybodies answers, that really wouldn't be fair. >>> >>> Best & Regards, >>> >>> Nathan >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >> Regards, >> -Josh > > Likewise, > > Nathan Regards, -Josh
Re: [PHP] Trapping for PDF Type and file size in a UPLOAD form...
On Jul 29, 2010, at 12:50 PM, Don Wieland wrote: > I am trying to create an UPLOAD form and need to figure a way to only allow > PDF files to be selected. Something like: > > > > >accept="application/pdf" /> > Choose a file to upload: type="file" /> > > > > > > It is documented online that I can pass a parameter ACCEPT="applaction/pdf", > BUT it is not recognized in most browsers. > > It was suggested by someone that I could trap for this using a JAVASCRIPT. > Can someone assist with a snippet of javascript code to trap for this for me? > This is the end result I need: > > If the user selects a file that IS NOT a PDF file, display an javascript > alert "You can only upload PDF files. Please try again." > > If the user selects a PDF file greater than 1MB, display an javascript alert > "File uploads may not exceed 1M in file size. Please try again." > > I appreciate any help that can be offered. Thanks in advanced! > > Don Wieland > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Don- Remember that anything submitted by the client can be spoofed or faked. Ensure that your PHP script accounts for Javascript being disabled. Past that, I'm sure you can get results from somewhere like Stackoverflow.com instead of a PHP mailing list. Thanks, -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array help.
On Jul 30, 2010, at 2:36 PM, Paul Halliday wrote: > I have a query that may not always return a result for a value, I need > to reflect this with a "0". I am trying to overcome this by doing this > (the keys are ID's): > > while ($row = mysql_fetch_row($statusQuery)) { > >$cat = > array(0=>0,1=>0,11=>0,12=>0,13=>0,14=>0,15=>0,16=>0,17=>0,19=>0); > >switch ($row[1]) { >case 0: $cat[0] = $row[0]; break; >case 1: $cat[1] = $row[0]; break; >case 11: $cat[11] = $row[0]; break; >case 12: $cat[12] = $row[0]; break; >case 13: $cat[13] = $row[0]; break; >case 14: $cat[14] = $row[0]; break; >case 15: $cat[15] = $row[0]; break; >case 16: $cat[16] = $row[0]; break; >case 17: $cat[17] = $row[0]; break; >case 19: $cat[19] = $row[0]; break; >} > >print_r($cat); >} > > Which gives me this: > > Array ( [0] => 15547 [1] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 > [15] => 0 [16] => 0 [17] => 0 [19] => 0 ) > Array ( [0] => 0 [1] => 0 [11] => 0 [12] => 0 [13] => 0 [14] => 0 [15]s > => 30 [16] => 0 [17] => 0 [19] => 0 ) > > The query only return 2 rows: > > 15 | 30 > 0 | 15547 > > What am I doing wrong? Is there a more elegant way to achieve what I want? > > Thanks. > > -- > Paul Halliday > Ideation | Individualization | Learner | Achiever | Analytical > http://www.pintumbler.org > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Paul- Why not say: $cat = array(); if(isset($row[1]) { $cat[$row[1]] = $row[0]; } print_r($cat); Regards, -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Array help.
On Jul 30, 2010, at 3:03 PM, Paul Halliday wrote: >> >> Paul- >> >> Why are those values not defaulted to 0 in the database? >> >> Regards, >> >> -Josh >> >> > > They are defaulted, the query is grouping: > > select count(status) as count, status from table group by status order > by status desc; Paul- Correct, so stuff with a status of 0 will still show up unless I'm missing something. Regards, -Josh -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Protecting PHP scripts called via AJAX from evil
On Aug 6, 2010, at 9:41 AM, Marc Guay wrote: > Hi folks, > > I'm looking for a straightforward way to protect PHP files which are > called via AJAX from being called from outside my application. > Currently, someone could forseeably open the console and watch the > javascript post variables to a public file (actions/delete_thing.php) > and then use this knowledge to trash the place. I found this thread > at stackoverflow which seems to cover the issue I'm looking at, but > it's pretty intense and I figure there's an easier way but I'm not > sure how. > > http://stackoverflow.com/questions/2486327/jquery-post-and-php-prevent-the-ability-to-use-script-outside-of-main-website > > It seems unlikely that this is the method everyone uses, but maybe > not. Advice is nice. > Marc > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Marc- The best way (and what I currently use) is to add a nonce style value to the form with a random name and then also add that to the session. $nonce = sha1(microtime(true)); $name = sha1(rand(0,10)); $_SESSION['nonce'] = array($name => $nonce); ?>http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP The Anthem
On Aug 6, 2010, at 7:27 AM, tedd wrote: > At 4:57 PM -0700 8/5/10, Daevid Vincent wrote: >> http://www.youtube.com/watch?v=S8zhmiS-1kw >> >> http://shiflett.org/blog/2010/aug/php-anthem >> >> ...some people have way too much time. ;-) > > I agree. I don't have time to do nonsense and don't understand how people who > are successful can waste time like this. Besides IMO, this is another example > of hip-flop. > > Cheers, > > tedd > > -- > --- > http://sperling.com http://ancientstones.com http://earthstones.com > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > There is something wrong with having a little fun? Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] PHP The Anthem
On Aug 6, 2010, at 11:12 AM, tedd wrote: > At 10:30 AM -0400 8/6/10, Joshua Kehn wrote: >> On Aug 6, 2010, at 7:27 AM, tedd wrote: >> >> >> There is something wrong with having a little fun? >> >> Regards, >> >> -Josh > > Yes, it's a waste of time -- humbug! > > Cheers, > > tedd > > -- > --- > http://sperling.com/ Tedd- I guess that quarters game was a complete waste of time as well? :) Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Storing Social Security Number WAS: Encryption/Decryption Question
On Aug 12, 2010, at 11:32 AM, tedd wrote: > At 10:56 AM -0400 8/12/10, Bastien Koert wrote: >> However, the data must be stored in an encrypted format and it must be >> transmitted via SSL. We do it that way (taking both a hash for >> searching for the ssn and the encrypted form) and haven't had any >> issues as yet. > > The data will be encrypted and only accessible behind an SSL via an > authorization process -- that's given. > > I have given some thought about searching the database for encrypted SS#'s > and have been perplexed as how to do that. > > For searching standard fields, it's a piece of cake to use %LIKE%. For > example, let's say the investigator has a piece of paper that has the number > "393" on it and want's to search the database for all phone numbers that > contain "393" -- he could use %LIKE% and that would produce 517-393-, > 393-123-4567, 818-122-4393 and so on. That's neat! > > However, if the field is encrypted, then how do you preform a partial search > on that? You can't encrypt the search string and use that because you need > the entire string. So, how do you solve that problem? > > If you hash the number of store the hash, then you can create a hashed search > string and use that. But again it doesn't work for partial %LIKE% searches. > For example, I couldn't search for "393" in a SS# -- I would have to search > for the complete SS#. > > So, how do you solve the %LIKE% problem with encryption and hashes? > >> The other thing to consider is that more and more states are looking to >> encrypt PII data >> (name, dob, ssn etc) for more security. > > I'm considering that as well, but that also raises more searching problems as > described above. > >> You could consider storing just the encrypted ssn and link data in a >> separate database, that would require a different logon to access when >> the data is required. > > Interesting -- I might also hash the foreign link. But I have to think about > that. > > Cheers, > > tedd > -- > --- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Would one option be to have a table of unencrypted SSN's with an encrypted id for the user. So you could search the SSN's and then connect them, however if the table was dumped you wouldn't be able to link it directly to the person (as it would just have a SSN and an id). Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
Re: [PHP] Storing Social Security Number WAS: Encryption/Decryption Question
On Aug 12, 2010, at 11:55 AM, tedd wrote: > At 11:39 AM -0400 8/12/10, Joshua Kehn wrote: >> Would one option be to have a table of unencrypted SSN's with an encrypted >> id for the user. So you could search the SSN's and then connect them, >> however if the table was dumped you wouldn't be able to link it directly to >> the person (as it would just have a SSN and an id). >> >> Regards, >> >> -Josh > > No, the problem here is to keep the database from containing any raw SS#. It > is absolutely necessary to encrypt the data. > > The question is: > > 1. Is it legal? > > 2. How to do it? > > Cheers, > > tedd > -- > --- > http://sperling.com/ Tedd- In my mind if you have a table of raw SSN's it's fine as long as they can't be readily linked to a person without decrypting the id. Again, I don't know the legalities of it so I defer. If you have to encrypt them then I'm not sure how you would run any %LIKE% query unless you went through and decrypted them OTF when running the query. This (I don't believe) can be done in MySQL (or any other RDB) so it would have to be done in memory. Depending on the table size that gets annoyingly slow. If the SSN's must be encrypted, and you aren't encrypting the parts separately ( enc - enc - enc) I don't think you will be able to run a %LIKE% query simply. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a quick question about array keys
Quickest way I can think of would be to do something like $tmp = array(); foreach($old_array as $key => $value) { $tmp[$value] = $key; } But knowing PHP there is probably some array_reverse_keys() function. Regards, -Josh ____ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Aug 31, 2010, at 11:43 AM, Tontonq Tontonq wrote: > a quick question > lets say i have an array like that > > > Array > ( > [300] => 300 > [301] => 301 > [302] => 302 > [303] => 303 > [304] => 304 > [305] => 305 > [306] => 306 > [307] => 307 > [308] => 308 > ... > how can i change keys to 0,1,2,3,.. by faster way > (it should like that) > > Array > ( > [0] => 300 > [1] => 301 > [2] => 302 > [3] => 303 > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] a quick question about array keys
On Aug 31, 2010, at 11:46 AM, Ashley Sheridan wrote: > On Tue, 2010-08-31 at 11:46 -0400, Joshua Kehn wrote: >> >> Quickest way I can think of would be to do something like >> >> $tmp = array(); >> >> foreach($old_array as $key => $value) >> { >> $tmp[$value] = $key; >> } >> >> But knowing PHP there is probably some array_reverse_keys() function. >> >> Regards, >> >> -Josh >> >> Joshua Kehn | josh.k...@gmail.com >> http://joshuakehn.com >> >> On Aug 31, 2010, at 11:43 AM, Tontonq Tontonq wrote: >> >> > a quick question >> > lets say i have an array like that >> > >> > >> > Array >> > ( >> > [300] => 300 >> > [301] => 301 >> > [302] => 302 >> > [303] => 303 >> > [304] => 304 >> > [305] => 305 >> > [306] => 306 >> > [307] => 307 >> > [308] => 308 >> > ... >> > how can i change keys to 0,1,2,3,.. by faster way >> > (it should like that) > >> > Array >> > ( >> > [0] => 300 >> > [1] => 301 >> > [2] => 302 >> > [3] => 303 >> > >> >> > > That doesn't actually answer the question, it just changes the key/value > pairs around. There is a built-in function for this in PHP, but it's not what > the OP asked for. > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > I misread the question as flipping array keys, my mistake. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com
[PHP] Question about translating assoc. arrays to C
I'm working on creating a compiled extension for some code I've written. Mostly it's manipulating a very large multi-demensional array of values. This is some pseudo code for the array. // Imagine this but much much bigger $big_ass_array = array('5' => array('0' => 4, '3' => 6, '8' => 7), '10' => array('4' => 3, '5' => 10')); Currently I'm traversing this with foreach($array as $key1 => $value) { foreach($value as $key2 => $value) { // Use $key1, $key2, and $value here } } My question is how does this translate into the C code I will have to write? If anyone has a decent extension building tutorial that would be great too. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Question about translating assoc. arrays to C
Jim- Yes, that was a typo. The issues was I didn't cut / paste and instead retyped it. Should be foreach($array as $key1 => $list) { foreach($list as $key2 => $value) I will check those links out, I had the first one not the second. Regards, -Josh ____ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 5, 2010, at 12:32 AM, Jim Lucas wrote: > Joshua Kehn wrote: >> I'm working on creating a compiled extension for some code I've written. >> Mostly it's manipulating a very large multi-demensional array of values. >> This is some pseudo code for the array. >> // Imagine this but much much bigger >> $big_ass_array = array('5' => array('0' => 4, '3' => 6, '8' => 7), '10' => >> array('4' => 3, '5' => 10')); Currently I'm traversing this with >> foreach($array as $key1 => $value) >> { >> foreach($value as $key2 => $value) >> { > > Well, I hope you are not using it this way. > > The above will overwrite your $value variable set by the first foreach > > Maybe you had a cut/paste error with the $value1 $value2 portion... > >> // Use $key1, $key2, and $value here >> } >> } >> My question is how does this translate into the C code I will have to write? > > My suggestion would be to download the source code and find a comparable > array function and see how they do it. > >> If anyone has a decent extension building tutorial that would be great too. > > First google result for "php extension tutorial" > > http://devzone.zend.com/article/1021 > http://www.talkphp.com/vbarticles.php?do=article&articleid=49&title=creating-custom-php-extensions > http://www.php.net/~wez/extending-php.pdf > > Just to list a few... > > Jim > >> Regards, >> -Josh >> >> Joshua Kehn | josh.k...@gmail.com >> http://joshuakehn.com >
Re: [PHP] Zend framework
Chris- While I find Zend to be more of a wonderful set of libraries then a framework, it does do both and is a good introduction. I do most of my framework coding on CodeIgniter though. Regards, -JOsh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 9, 2010, at 9:33 PM, chris h wrote: > Hello all, > > I'm starting a new project and I'm thinking about building it on Zend > framework and possibly Zend server. I've only used the framework slightly > and I've never really used Zend server. That being said I hear that the > framework is pretty decent to work with. I want something that is strict > and uses OOP & MVC well, and I hear it does; though I also have the > impression that it's slow and bloated... > > Anyways, I was curious if any of you have some general advice / good things > / horror stories on the Zend framework? > > > Thanks, > Chris. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about code
Adam- That is a function call. In Java: class Code { public static void function do_command(){ } } Code.do_command(); Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 10, 2010, at 2:27 PM, Adam Williams wrote: > I'm looking at someone's code to learn and I'm relatively new to programming. > In the code I see commands like: > > $code->do_command(); > > I'm not really sure what that means. How would that look in procedural style > programming? do_command($code); or something else? > > > -- > 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] newbie question about code
Bob- Yes, yes I did. And note that my Java code is incorrect, that should simply be public static void, no function. This is what I get for taking a week to code everything in Node.js. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 10, 2010, at 2:32 PM, Bob McConnell wrote: > Did you mean to say "That is a method call."? > > Bob McConnell > > ----- > From: Joshua Kehn > > That is a function call. In Java: > > class Code > { >public static void function do_command(){ } > } > > Code.do_command(); > > Regards, > > -Josh > > Joshua Kehn | josh.k...@gmail.com > http://joshuakehn.com > > On Sep 10, 2010, at 2:27 PM, Adam Williams wrote: > >> I'm looking at someone's code to learn and I'm relatively new to > programming. In the code I see commands like: >> >> $code->do_command(); >> >> I'm not really sure what that means. How would that look in > procedural style programming? do_command($code); or something else? >> -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] newbie question about code
Ash- Correct, hence my typo and nomenclature slip. ;) Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 10, 2010, at 2:48 PM, a...@ashleysheridan.co.uk wrote: > Node.js, wouldn't that be javascript rather than java? :P > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > - Reply message - > From: "Joshua Kehn" > Date: Fri, Sep 10, 2010 19:32 > Subject: [PHP] newbie question about code > To: "Bob McConnell" > Cc: "Adam Williams" , "PHP General list" > > > > Bob- > > Yes, yes I did. > > And note that my Java code is incorrect, that should simply be public static > void, no function. > > This is what I get for taking a week to code everything in Node.js. > > Regards, > > -Josh > > Joshua Kehn | josh.k...@gmail.com > http://joshuakehn.com > > On Sep 10, 2010, at 2:32 PM, Bob McConnell wrote: > > > Did you mean to say "That is a method call."? > > > > Bob McConnell > > > > - > > From: Joshua Kehn > > > > That is a function call. In Java: > > > > class Code > > { > >public static void function do_command(){ } > > } > > > > Code.do_command(); > > > > Regards, > > > > -Josh > > > > Joshua Kehn | josh.k...@gmail.com > > http://joshuakehn.com > > > > On Sep 10, 2010, at 2:27 PM, Adam Williams wrote: > > > >> I'm looking at someone's code to learn and I'm relatively new to > > programming. In the code I see commands like: > >> > >> $code->do_command(); > >> > >> I'm not really sure what that means. How would that look in > > procedural style programming? do_command($code); or something else? > >> > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > >
Re: [PHP] newbie question about code
Adam- It is unique. I'm writing code that really can't be done any other way. How it handles events, sockets, etc is exceptional. The best part is everything now is JavaScript. The server (Node.js) is written in JavaScript. MongoDB is JavaScript. The frontend used to manage the WebSocket is entirely JavaScript. I have essentially replaced J2EE as the backend with Node and I couldn't be happier. Of course standard JavaScript woes apply. Debugging is a royal pain in the ass. Your code can and will suddenly fail due to odd strange errors. There are stability concerns with Node, it is version 0.2 after all. It won't replace PHP or Java as an enterprise level solution, but it does fill in the gaps very nicely. Regards, -Josh ____ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 10, 2010, at 2:53 PM, Adam Richardson wrote: >> >> >> >> This is what I get for taking a week to code everything in Node.js. >> >> > > It is a Friday, so I'll let my curiosity get the best of me and ask a > follow-up on something non-PHP. What insights/impressions do you have > regarding Node.js after a week of working with it? > > Thanks, > > Adam > > -- > Nephtali: PHP web framework that functions beautifully > http://nephtaliproject.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] 1984 (Big Brother)
Tedd- Would he consider access to another database? I.e. a separate, say memcached db which stores the "boss" status? An issue with the temporary file would also be session length, if the session expires without the user explicitly logging off, the file wouldn't be removed. A way to bypass this would be to add some sort of session expiration header to the file and update that. And couldn't you make a simple check if the boss is logged in or not by the ability to access the database? Regards, -Josh ____ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Sep 12, 2010, at 12:32 PM, tedd wrote: > Hi gang: > > I have a client who wants his employees' access to their online business > database restricted to only times when he is logged on. (Don't ask why) > > In other words, when the boss is not logged on, then his employees cannot > access the business database in any fashion whatsoever including checking to > see if the boss is logged on, or not. No access whatsoever! > > Normally, I would just set up a field in the database and have that set to > "yes" or "no" as to if the employees could access the database, or not. But > in this case, the boss does not want even that type of access to the database > permitted. Repeat -- No access whatsoever! > > I was thinking of the boss' script writing to a file that accomplished the > "yes" or "no" thing, but if the boss did not log off properly then the file > would remain in the "yes" state allowing employees undesired access. That > would not be acceptable. > > So, what methods would you suggest? > > Cheers, > > tedd > > -- > --- > http://sperling.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] Standalone WebServer for PHP
On Sep 12, 2010, at 1:33 PM, tedd wrote: > At 5:57 PM +0100 9/12/10, Ashley Sheridan wrote: >> On Sun, 2010-09-12 at 12:55 -0400, tedd wrote: >> >>> Can a business have a server connected to the Internet but limit >>> access to just their employees? I don't mean a password protected >>> scheme, but rather the server being totally closed to the outside >>> world other than to their internal employees? Or is this something >>> that can only be provided by a LAN with no Internet connection? >>> >> >> Not entirely sure what you're asking, but could you maybe achieve something >> like this with a WAN using a VPN? >> >> Thanks, >> Ash > > Ash: > > I'm sure this is an obvious question for many on this list, but I'm not above > showing my ignorance. > > I guess what I am asking -- if a client wanted an application written (in web > languages) so that their employees could link all their different computers > together and share/use information using browsers, is that possible using a > server that is not connected to the Internet? > > Look, I know that I can solve my clients problems by finding a host and > writing scripts to do what they want -- that's not a problem. But everything > I do is open to the world. Sure I can provide some level of security, but > nothing like the security that can be provided behind closed and locked doors. > > So, can I do what I do (i.e., programming) without having a host? Can I > install a local server at my clients location and interface all their > computers to use the server without them ever being connected to the Internet? > > Maybe I should ask my grandson. :-) > > Cheers, > > tedd > > -- > --- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > Tedd- What do you mean "without ever being connected to the internet?" That statement throws me a bit because if it isn't connected to the public net the only alternative would be to run hard lines between hosts. Regards, -Josh Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] tedd's Friday Post ($ per line)
I'm not sure this is even worth answering. The question isn't how many lines of code were written but percentage of the project completed. If he estimated 8 months, worked for 4 months, and was 50% done, he should get half his estimate. Hourly rates wouldn't come into it unless the client thought it would be cheaper to simply pay him for his time rather then the bid. Subject the following to my poor legal knowledge: I would also guess that if he was under contract with a company to provide a product for a set dollar amount then wouldn't the company be forced to complete it's half so to speak? Regards, -Josh ____ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Oct 7, 2010, at 1:20 PM, tedd wrote: > Hi gang: > > Several years ago I was involved in a court case where a programmers work was > being evaluated to establish a dollar amount for the work done. > > The case was a dispute where the client wanted money back from a programmer > for a discontinued project. The programmer simply wanted to be paid for the > work he had done. This wasn't a case where anyone had done anything wrong, > but rather a circumstance where two parties were trying to figure out who was > due what. > > You see, the original client had been taken over by another company who put a > halt to the project the programmer was working on. The new company claimed > that because the project wasn't finished, then the programmer should pay back > all the money he was paid up-front to start the project. However, while the > project had not been finished, the programmer had indeed worked on the > project for several months. > > The programmer stated he wanted to paid his hourly rate. But the new client > stated that the up-front money paid had been based upon a bid and not an > hourly rate. So, they were at odds as to what to do. > > The solution in this case was to place a dollar amount on the actual "lines > of code" the programmer wrote. In other words, they took all of programmers > code and actually counted the lines of code he wrote and then agreed to a > specific dollar amount to each line. In this case, the programmer had written > over 25,000 lines of code. What do you think he was paid? > > And with all of that said, what dollar amount would you place on your "line > of code"? > > Cheers, > > tedd > > -- > --- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >
Re: [PHP] tedd's Friday Post ($ per line)
In the case payment does come down to lines of code written I'm already covered. if( count > 5) { /* Bracing Style } Regards, -Josh ____ Joshua Kehn | josh.k...@gmail.com http://joshuakehn.com On Oct 7, 2010, at 1:50 PM, a...@ashleysheridan.co.uk wrote: > Surely it would have been a bit more sensible to work out the time the > programmer had spent on the project and then calculate it as a percentage of > the total time that programmer would spend on it to complete it (which might > not be the whole duration of the project) > > Also, counting code lines seems unfair. I know it used to be this way, but > its a bit like paying firemen based on the number of fires they put out; > don't be surprised if arson figures go up! > > I would guess though that this fellow likely had to pay some of that initial > outlay of cash back though, and would further assume the total price > attributed to each line was no more than 3 or 4 cents (damb English androids > don't have the cent character) > > Thanks, > Ash > http://www.ashleysheridan.co.uk > > - Reply message - > From: "tedd" > Date: Thu, Oct 7, 2010 18:20 > Subject: [PHP] tedd's Friday Post ($ per line) > To: > > Hi gang: > > Several years ago I was involved in a court case where a programmers > work was being evaluated to establish a dollar amount for the work > done. > > The case was a dispute where the client wanted money back from a > programmer for a discontinued project. The programmer simply wanted > to be paid for the work he had done. This wasn't a case where anyone > had done anything wrong, but rather a circumstance where two parties > were trying to figure out who was due what. > > You see, the original client had been taken over by another company > who put a halt to the project the programmer was working on. The new > company claimed that because the project wasn't finished, then the > programmer should pay back all the money he was paid up-front to > start the project. However, while the project had not been finished, > the programmer had indeed worked on the project for several months. > > The programmer stated he wanted to paid his hourly rate. But the new > client stated that the up-front money paid had been based upon a bid > and not an hourly rate. So, they were at odds as to what to do. > > The solution in this case was to place a dollar amount on the actual > "lines of code" the programmer wrote. In other words, they took all > of programmers code and actually counted the lines of code he wrote > and then agreed to a specific dollar amount to each line. In this > case, the programmer had written over 25,000 lines of code. What do > you think he was paid? > > And with all of that said, what dollar amount would you place on your > "line of code"? > > Cheers, > > tedd > > -- > --- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php >