[PHP] How much should this cost Or ...
If anyone responds to this thanks a lot because this is a lot to ask. I've never coded anything for a paying customer. I'll be using Apache, MySQL and php of course. Or... how about this application already exists somewhere?? Requirements/Design --- 1. Any page requiring authentication should be in a secure directory. The login for the directory will be issued behind the scenes once the user is authenticated. This prevents anyone from by passing the login. 2. Once you login once for a session all other pages requiring authentication become accessible to you (i.e record login in a cookie). 2. If you do not yet have a username/password then you can click on register, where you enter the following: Name * Title Company * Address * Tel Fax Email * LicenseId * Username * Password * Confirm Password * * = required Username must be unique. LicenseId must exist in a table of currently active licenses maintained by KINESYS. 3. If registration is successful then the account is stored in the database and the user continues to the originally requested page. 4. On the login page there should be a "Forgotten password?" link. When you click it you have to enter your email address and if it exists in the database, the username and password is emailed to you. 5. Each login with date and time should be recorded in the database linked to the Username. Ideally each download should also be recorded. 6. The pages requiring authentication should be in a secure directory. The login for the directory will be issued behind the scenes. This prevents anyone from by passing the login. 7. There must be an administration page in the secure directory that allows KINESYS to maintain the list of LicenseIds in the License table, and to view the user and event tables. Here is my take on the initial database schema. Table: License Primary Key: LicenseId Table: User Primary key: UserId (autoincrement) Required Unique Field: UserName Required Field: Password Required Field: Name Field: Title Required Field: Company Required Field: Address1 Required Field: Address2 Required Field: Address3 Required Field: Address4 Field: Tel Field: Fax Required Field: Email Required Foreign Key: LicenseId Table: Event Primary Key: EventId (autoincrement) Required Field: Timestamp Required Foreign Key: UserId Required Field: Description (e.g. "Login", "Downloaded ALPS LT 2.61.1") -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] How do I prevent remote loading of jpegs from my site
With Apache this goes in the block. # Turn on the rewrite engine RewriteEngine on # The next line means ignore lines without a referrer RewriteCond %{HTTP_REFERER} !^$ # Then ignore lines that the referrer was any host at "our_domain.com" (the good guys). RewriteCond %{HTTP_REFERER} !^http://.*our_domain.com/.*$ [NC] # Rewrite lines that had the request for *.jpg or *.jpeg or *.JPG or .JPEG or *.gif or .GIF and so on to a small warning gif file. # That says, "Don't steel our bandwidth. If you are receiving this in error contact [EMAIL PROTECTED]" RewriteRule .*[Jj][Pp][Ee][Gg]$|.*[Jj][Pp][Gg]$|.*[Gg][Ii][Ff]$ http://all-ghost.com/banners/bandwidth_stolen.gif Amazing isn't. -- 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] Where does mysql keep the records data
On my system the mysql and test databases are created in /var/db/mysql/ I created a database called publish and it likewise was stored in /var/db/mysql/publish. I needed to start over with the work on publish so I deleted the publish directory. #rm -R /var/db/mysql/publish. BUT after re-creating the tables all the records still existed, so the records weren't in /var/db/mysql/publish. Where is it? # rm -R /var/db/mysql/publish # mysqladmin create publish # mysql mysql> use publish mysql> CREATE TABLE eZAddress_AddressType ( ID int(11) NOT NULL, Name varchar(50), ListOrder int(11) DEFAULT '0' NOT NULL, Removed int(1) DEFAULT '0' NOT NULL, PRIMARY KEY (ID) ); mysql> INSERT INTO eZAddress_AddressType VALUES (1,'Home address',1,0); ERROR 1062: Duplicate entry '1' for key 1 Where dat data at? -- 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] Install on Darwin fix?
Apple broke the GCC on Mac OS X 10.0 Running make on PHP install produces this error: /usr/bin/ld: -undefined error must be used when -twolevel_namespace is in effect Here's the fix from Apple but it's over my head. http://developer.apple.com/techpubs/macosx/ReleaseNotes/TwoLevelNamespaces. html Tried the usual fix -- defining OTHER_LDFLAGS = -flat_namespace (or some variant on that theme, such as EXTRA_LDFLAGS) -- but has had no luck. -- 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] Profiling PHP App
Hi All, Is there any tool to profiling PHP app ? Regards, Feris
Re: [PHP] Assign variable to a block of html code
Hi Everyone, Thanks for pointing me to heredoc syntax. I've got it working out nicely now ;) Regards, Feris On 12/20/07, Daniel Brown <[EMAIL PROTECTED]> wrote: > > On Dec 19, 2007 10:38 PM, php mail <[EMAIL PROTECTED]> wrote: > > Hi All, > > > > Is it possible to assign variable to a block of html code ? > > > > Something like this : > > > > $myblokvar = " > > > > > > > [snp] > > > > > > > > "; > > > > Although example above is not working, what I want to achieve is > something > > like that. Is it possible how can I do that ? > > If you absolutely want to do it that way, then escape your quotes > in the HTML. When you're using quotes to encapsulate a variable, any > quotes contained within the value will cause a parse error. One > alternative is to use single-quotes for variable containment, and > double-quotes throughout, or vice-versa. These two methods will work: > > $variable = "This is how you \"escape\" quotes."; > $variable = 'Using single quotes gives you the "literal" value, > which means you can't do newlines and such.\n'; > > However, your best bet is going to be using HEREDOC: > > $html =<< > Always be sure to use the three left carats as shown in the line > above. You can call EOL anything you want in the world, as long as it > doesn't interfere with an existing part of your code within the same > scope. You can also use $variables within a HEREDOC, but things like > newlines WILL NOT work.\n > > Also note that, when using HEREDOC syntax, you don't end the > << block, be sure to end it as the first thing on the line. You can't > have any spaces, tabs, or other characters before it. And be sure to > place your semicolon after it, as well, like so: > EOL; > > -- > Daniel P. Brown > [Phone Numbers Go Here!] > [They're Hidden From View!] > > If at first you don't succeed, stick to what you know best so that you > can make enough money to pay someone else to do it for you. >
[PHP] Aspect Oriented framework
Hi All, Anyone ever use this tools ? If so, which one is more recommended ? - http://www.aophp.net/ - http://phpaspect.org/ Regards, Feris
[PHP] Rejecting File Upload
Hi All, How do I prior check file's size in server side before the upload process begin ? Regards, Feris
RE: [PHP] Help correcting a form mailer problem...
Sorry I should clarify... checkboxes don't send their values through they send their names and states... so if you have the array: Name="qmev[1]"... name="qmev[2]"... name="qmev[3]" And your array contains [1] => on : [3] => on 1 and 3 are selected -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would first start out by dumping the values of $_POST['gmev'] by using > > print_r($_POST['gmev']); > > Sounds to me like you're not getting the data that your expecting > from the form for some reason. Maybe $_POST['gmev'] is an array of > null values? > > -Good Luck > > On Aug 17, 2005, at 12:15 PM, zedleon wrote: > > > I previously built a sticky form with dynamic checkbox > > array's. > > The form works beautifully thanks to help from Jochem Mass and > > Kathleen > > Ballard. > > > > I now have a slightly different problem...I have built an email > > form to send > > the form data. > > I copied and used the following code which works great in the sticky > > form. > > > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > >foreach ($_POST['gmev'] as $gmev_day) { > > > >print "You have registered for the: $gmev_day Good > > Morning East > > Valley Event."; > > } > > > > } else { > > > >print 'You are not registered for any events!'; > > > > } > > > > The results is this: > >"You have registered for the: September 9th Good Morning > > East > > Valley Event." > > > > Now when I use the same code modified for the form mailer I am > > getting this > > result. > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > > foreach ($_POST['gmev'] as $gmev_day) { > > > > $msg .= "You have registered for the: $gmev_day Good Morning East > > Valley > > Event.\n"; > > } > > > > } else { > > > >$mgs .= "You are not registered for any events!"; > > } > > > > result is - "You have registered for the: on Good Morning > > East > > Valley Event." > > > > I am missing the value of the variable even though I am receiving > > all the > > instances of the variables from the checkboxes. When they are > > selected, they > > are present. > > > > I really don't know what to do about correcting the problem. Any > > guidance > > here would really be appreciatedand...go easy on me...I am new > > to PHP > > > > Thanks before hand... > > > > zedleon > > > > -- > > 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help correcting a form mailer problem...
Hi If the checkbox exists in the array it is selected... if it isn't there it's not selected That's my experience :) -Original Message- From: zedleon [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 21:30 To: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... thanks for the reply... after using the print_r($_POST['gmev']); and selecting all the checkboxes to send to the form the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So the values are missing. don't really know how to proceed at this point. any help is appreciated. "Joe Wollard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > I would first start out by dumping the values of $_POST['gmev'] by using > > print_r($_POST['gmev']); > > Sounds to me like you're not getting the data that your expecting > from the form for some reason. Maybe $_POST['gmev'] is an array of > null values? > > -Good Luck > > On Aug 17, 2005, at 12:15 PM, zedleon wrote: > > > I previously built a sticky form with dynamic checkbox > > array's. > > The form works beautifully thanks to help from Jochem Mass and > > Kathleen > > Ballard. > > > > I now have a slightly different problem...I have built an email > > form to send > > the form data. > > I copied and used the following code which works great in the sticky > > form. > > > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > >foreach ($_POST['gmev'] as $gmev_day) { > > > >print "You have registered for the: $gmev_day Good > > Morning East > > Valley Event."; > > } > > > > } else { > > > >print 'You are not registered for any events!'; > > > > } > > > > The results is this: > >"You have registered for the: September 9th Good Morning > > East > > Valley Event." > > > > Now when I use the same code modified for the form mailer I am > > getting this > > result. > > > > if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { > > > > foreach ($_POST['gmev'] as $gmev_day) { > > > > $msg .= "You have registered for the: $gmev_day Good Morning East > > Valley > > Event.\n"; > > } > > > > } else { > > > >$mgs .= "You are not registered for any events!"; > > } > > > > result is - "You have registered for the: on Good Morning > > East > > Valley Event." > > > > I am missing the value of the variable even though I am receiving > > all the > > instances of the variables from the checkboxes. When they are > > selected, they > > are present. > > > > I really don't know what to do about correcting the problem. Any > > guidance > > here would really be appreciatedand...go easy on me...I am new > > to PHP > > > > Thanks before hand... > > > > zedleon > > > > -- > > 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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help correcting a form mailer problem...
I do apologise... it's been one of those days and the form I was thinking of didn't actually have any values attached to the checkbox Ignore me :) -Original Message- From: Jordan Miller [mailto:[EMAIL PROTECTED] Sent: 17 August 2005 22:28 To: [EMAIL PROTECTED] Cc: php-general@lists.php.net Subject: Re: [PHP] Help correcting a form mailer problem... Sorry, I believe you are mistaken here... you *can* specify a value for each checkbox and have it come through. I have written scripts that do this, and here is another example: http://www.tizag.com/phpT/examples/formex.php/ all zedleon needs to do is add the correct value parameter to each checkbox. Jordan On Aug 17, 2005, at 3:57 PM, <[EMAIL PROTECTED]> wrote: > Sorry I should clarify... checkboxes don't send their values > through they > send their names and states... so if you have the array: > > Name="qmev[1]"... name="qmev[2]"... name="qmev[3]" > > And your array contains > > [1] => on : [3] => on > > 1 and 3 are selected > > -Original Message- > From: zedleon [mailto:[EMAIL PROTECTED] > Sent: 17 August 2005 21:30 > To: php-general@lists.php.net > Subject: Re: [PHP] Help correcting a form mailer problem... > > thanks for the reply... > after using the print_r($_POST['gmev']); and selecting all the > checkboxes to > send to the form > the return is Array ( [0] => on [1] => on [2] => on [3] => on ). So > the > values are missing. > don't really know how to proceed at this point. > any help is appreciated. > > > "Joe Wollard" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> I would first start out by dumping the values of $_POST['gmev'] by >> using >> >> print_r($_POST['gmev']); >> >> Sounds to me like you're not getting the data that your expecting >> from the form for some reason. Maybe $_POST['gmev'] is an array of >> null values? >> >> -Good Luck >> >> On Aug 17, 2005, at 12:15 PM, zedleon wrote: >> >> >>> I previously built a sticky form with dynamic checkbox >>> array's. >>> The form works beautifully thanks to help from Jochem Mass and >>> Kathleen >>> Ballard. >>> >>> I now have a slightly different problem...I have built an email >>> form to send >>> the form data. >>> I copied and used the following code which works great in the sticky >>> form. >>> >>> >>> if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { >>> >>>foreach ($_POST['gmev'] as $gmev_day) { >>> >>>print "You have registered for the: $gmev_day Good >>> Morning East >>> Valley Event."; >>> } >>> >>> } else { >>> >>>print 'You are not registered for any events!'; >>> >>> } >>> >>> The results is this: >>>"You have registered for the: September 9th Good Morning >>> East >>> Valley Event." >>> >>> Now when I use the same code modified for the form mailer I am >>> getting this >>> result. >>> >>> if (isset($_POST['gmev']) && is_array($_POST['gmev'])) { >>> >>> foreach ($_POST['gmev'] as $gmev_day) { >>> >>> $msg .= "You have registered for the: $gmev_day Good Morning East >>> Valley >>> Event.\n"; >>> } >>> >>> } else { >>> >>>$mgs .= "You are not registered for any events!"; >>> } >>> >>> result is - "You have registered for the: on Good Morning >>> East >>> Valley Event." >>> >>> I am missing the value of the variable even though I am receiving >>> all the >>> instances of the variables from the checkboxes. When they are >>> selected, they >>> are present. >>> >>> I really don't know what to do about correcting the problem. Any >>> guidance >>> here would really be appreciatedand...go easy on me...I am new >>> to PHP >>> >>> Thanks before hand... >>> >>> zedleon >>> >>> -- >>> 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 > > > > > __ NOD32 1.1196 (20050817) Information __ > > This message was checked by NOD32 antivirus system. > http://www.eset.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 __ NOD32 1.1196 (20050817) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Printing to a buffer
-Original Message- From: Jasper Bryant-Greene [mailto:[EMAIL PROTECTED] [snip] application/text isn't a MIME-Type, is it? Do you mean text/plain? [/snip] Or maybe text/html? Sent: 12 November 2005 22:46 To: Todd Cary Cc: php-general@lists.php.net Subject: Re: [PHP] Printing to a buffer Todd Cary wrote: > My client's new shared server does not allow printing to a file, so I > want my print statement to print to a buffer, then I'll send it to the > user via Headers. This does not work since "print" does no go to the > buffer, or at least appears not to: I get the errors from the header > statements; > >ob_start; You're missing some parentheses on the ob_start function. I think you meant to write: ob_start(); > print "This is a test"; You probably meant in that string too. > $buf = ob_get_contents(); > $len = strlen($buf); > ob_end_clean(); > header("Content-type: application/text"); application/text isn't a MIME-Type, is it? Do you mean text/plain? > header("Content-Length: $len"); > header("Content-Disposition: inline; filename=Sfyc.html"); > print($buf); > ?> > > Todd > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1284 (2005) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Help with regular expressions
I tested this with $t = "string string"; preg_replace('/\s/', '', $t); echo $t; And the replace left a space... so then I tried this $t = "string string"; $t = preg_replace('/\s/', '', $t); echo $t; And the output was spaceless (spaced out?)... maybe worth a try? HTH Dan -- -Original Message- From: Al [mailto:[EMAIL PROTECTED] Sent: 17 January 2006 22:45 To: php-general@lists.php.net Subject: Re: [PHP] Help with regular expressions John Nichel wrote: > Carl Furst wrote: > >> Ok I am so stumped.. I'm doing something stupid and I can't figure it >> out.. >> >> Here's the code: >> >> > >> $eml = '[EMAIL PROTECTED]ceo'; >> if (strpos($eml, ' ')) echo "yep, there are spaces\n"; //does strpos >> see the >> spaces? >> echo preg_replace('/\s/', '', $eml); //WTF? Preg_replace does not? >> echo "$eml\n"; >> >> >> ?> >> >> As you can see there are a bunch of spaces in that email address. I'm >> trying >> to use preg_replace to get rid of them. Strpos sees the spaces and the >> first >> echo statement is executed. The second echo prints nothing and the third >> prints the original $eml with nothing substituted. >> >> Can anyone see why the perl reg isn't seeing the spaces? >> >> Carl >> > > Working fine on my end (copy/pasted your code) > $eml= trim($eml); $pattern= "%\s%"; //I use % as delimiters, more obvious for me when debugging if(preg_match($pattern, $eml) echo "yep, there are spaces\n"; preg_replace($pattern, '', $eml); echo "works now\n"; -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1369 (20060117) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Sessions
Hi My site is running a custom session handler (into MySQL 3.28). all was well until I needed to test session in files. it was only a 5 minute test Now I can't get the DB sessions active. Absolutely nothing is registering in the DB PHP version is 4.3.10. Help please because I can't figure this out. I've tried everything I can think of TIA Dan
RE: [PHP] Sessions
Just tried an ini_set to make sure then rebooted the server (which is Apache on a VS running Redhat) Nothing doing... null across the board I will double check the ini tomorrow but I didn't alter it during the test... just another ini_set -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: 19 January 2006 23:30 To: PHP Mail Cc: php-general@lists.php.net Subject: Re: [PHP] Sessions You changed php.ini back to 'user' instead of 'file' for the session handling? You re-started the web-server? (Apache, IIS, whatever) If it's a Windows box, reboot for good measure. On Thu, January 19, 2006 3:29 pm, PHP Mail wrote: > Hi > > > > My site is running a custom session handler (into MySQL 3.28). all was > well > until I needed to test session in files. it was only a 5 minute test > > > > Now I can't get the DB sessions active. Absolutely nothing is > registering in > the DB > > > > PHP version is 4.3.10. Help please because I can't figure this out. > I've > tried everything I can think of > > > > TIA > > > > Dan > > > > > > > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1372 (20060119) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Sessions
Of all the weird things... it just started working... I can't explain it Thanks for your help Richard... If it makes any difference the registered save handlers are files and user in that order Could this make the session support flaky (having both registered)? I'm not great with server config but I'm getting there :) -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: 20 January 2006 00:33 To: php-mail Cc: [EMAIL PROTECTED]; php-general@lists.php.net Subject: RE: [PHP] Sessions On Thu, January 19, 2006 5:52 pm, php-mail wrote: > Just tried an ini_set to make sure then rebooted the server (which is > Apache > on a VS running Redhat) Does claim that you are using file-based sessions, or 'user'?... After you do the ini_set, of course. Toss in a phpinfo(); right after the ini_set() you added and surf to it. -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1372 (20060119) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Truncate words in multiple paragraphs
Would this work? This returns: This is my test string Isn't it nice? I quite like Of course, the return doesn't preserve line breaks :) HTH Dan http://chrome.me.uk -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: 03 February 2006 21:45 To: Verdon Vaillancourt Cc: [EMAIL PROTECTED]; John Meyer; PHP eMail List Subject: Re: [PHP] Truncate words in multiple paragraphs Just do this: $string = str_replace("\n", "", $string); $string = trim_text($string); $string = str_replace("", "\n", $string); Actually could be any sequence of non-whitespace characters unlikely to be in the text in the first place. On Fri, February 3, 2006 3:29 pm, Verdon Vaillancourt wrote: > Hi Richard, > > I quickly realized this and fooled with a few variations. Also have to > take into account that the or the get counted as 1 or 2 > words respectively, and so the trim can end up in the wrong place. > I've > tried fiddling with counting the number of br's in the string and > adding that to the truncation limit before the preg_split, but this is > still not ideal. > > I'm going to have a look at your other suggestion too. > > Thanks for your thoughts :) > verdon > > On 3-Feb-06, at 4:21 PM, Richard Lynch wrote: > >> >> >> This would work if you replace the with -- Otherwise, >> it's >> too likely to break up "" in the trim_text function and then >> you >> end up with: >> >> "start of string ... almost 255 words, blah blah blah> >> On Fri, February 3, 2006 11:25 am, John Meyer wrote: >>> -BEGIN PGP SIGNED MESSAGE- >>> Hash: SHA1 >>> >>> Verdon Vaillancourt wrote: Hi :) I am using the following function (that I found in the user comments on php.net manual) for trimming the number of words accepted via a form field // Truncation is by word limit, not character limit. So if you limit // to 255, then it will cut off a text item to 255 words, not 255 characters function trim_text ($string, $truncation=250) { $string = preg_split("/\s+/",$string,($truncation+1)); unset($string[(sizeof($string)-1)]); return implode(' ',$string); } >>> >>> >>> How about >>> $string = nl2br($string); >>> $string = trim_text($string); >>> $string = str_replace("","\n",$string); >>> -BEGIN PGP SIGNATURE- >>> Version: GnuPG v1.4.2 (GNU/Linux) >>> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org >>> >>> iD8DBQFD45Hzj60GAoLuoDkRAjSqAKCxvGlJmSCVHozWBDjjZnKMEZOfSwCfenVj >>> lRSChtsMRqRnOYdZpk5YQ0c= >>> =Dnly >>> -END PGP SIGNATURE- >>> >>> -- >>> PHP General Mailing List (http://www.php.net/) >>> To unsubscribe, visit: http://www.php.net/unsub.php >>> >>> >> >> >> -- >> Like Music? >> http://l-i-e.com/artists.htm >> >> >> >> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1393 (20060203) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Truncate words in multiple paragraphs
Nuts Missed the need to preserve line breaks Sorry Dan -Original Message- From: tedd [mailto:[EMAIL PROTECTED] Sent: 03 February 2006 23:06 To: php-general@lists.php.net Subject: Re: [PHP] Truncate words in multiple paragraphs >Hi :) > >I am using the following function (that I found in the user comments >on php.net manual) for trimming the number of words accepted via a >form field > >// Truncation is by word limit, not character limit. So if you limit >// to 255, then it will cut off a text item to 255 words, not 255 characters >function trim_text ($string, $truncation=250) { > $string = preg_split("/\s+/",$string,($truncation+1)); > unset($string[(sizeof($string)-1)]); > return implode(' ',$string); >} > >This works well, except it is also removing any line breaks. For instance... > >-snip- > >I'd like to (need to) retain the line breaks. Any suggestions? > >Thanks, >verdon verdon: I had the same problem and fixed it with this: // remove all linefeeds and replace with new paragraph $pattern = "\n"; $replace = ""; $des = eregi_replace($pattern, $replace, $des); Then in your html, use: Worked for me. tedd -- http://sperling.com/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1393 (20060203) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Regular expression
Ok I may actually have an answer here... Gives: hubble, bubble, toil and trouble Accepts spaces before and/or after commas or neither... preserves spaces Hope this one works (and that I've read the post right :-/) Dan -- -Original Message- From: Richard Lynch [mailto:[EMAIL PROTECTED] Sent: 03 February 2006 23:34 To: Barry Cc: php-general@lists.php.net Subject: Re: [PHP] Regular expression $last_comma = strrpos($string, ","); $string = substr($string, 0, $last_comma) . ' and ' . substr($string, $last_comma); I probably have a one-off error in there somewhere, or swapped the order of args in strrpos, but you get the idea. http://php.net/strrpos On Mon, January 30, 2006 8:09 am, Barry wrote: > Simple reg help please > > i want to match the last "," in "a,b,c,d" and replace it with " and " > > i tried ereg_replace(",([a-zA-z])*$"," and ",$string); > > but i forgot how to add the "d" which is also matched now back to the > " and " > > Can you give any good reg_exp sites where to learn it? > Its long ago since i used reg exp and i lost the hang of it... :( > > btw. any sites that have reg_exp that works witht PHP would be fine. > i know http://www.regular-expressions.info/tutorial.html > But that examples dont work with preg_match and ereg. > > Thanks ^_^ > > -- > Smileys rule (cX.x)C --o(^_^o) > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Like Music? http://l-i-e.com/artists.htm -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php __ NOD32 1.1393 (20060203) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] system('bell'); ?
Suppose someone had to :) -Original Message- From: Dan Harrington [mailto:[EMAIL PROTECTED] Sent: 04 February 2006 19:50 To: php-general@lists.php.net Subject: RE: [PHP] system('bell'); ? Ask not for whom the bell tolls, it tolls for thee! -Original Message- From: Gerry Danen [mailto:[EMAIL PROTECTED] Sent: Saturday, February 04, 2006 12:00 PM To: tedd Cc: php-general@lists.php.net Subject: Re: [PHP] system('bell'); ? bell is his C program... :) Outputs an ascii 7 (bell) at the machine where it runs. It basically outputs a character to stdout or stderr. He probably has that machine next to his cash drawer... Gerry On 2/4/06, tedd <[EMAIL PROTECTED]> wrote: > >I simple wrote a small C program that basically sent a bell, 0x07 and > >it opened my cash drawer. In php I just did system('bell'); and it > >worked fine. > > > >Kevin > > Hi: > > Interesting! The statement system('bell'); is new to me. > > If I'm writing code on a hosted domain, and using that statement, > who's bell am I ringing? > > tedd > > -- > -- > -- > http://sperling.com/ > > -- > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > > -- Gerry http://portal.danen.org/ -- 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 __ NOD32 1.1393 (20060203) Information __ This message was checked by NOD32 antivirus system. http://www.eset.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] form posting problem - $variables get padded with spaces
Can anyone help? Here is my problem, I am submitting a lot of hidden variables using a and they come over padded with a space on the left. I know that I can trim() them but in case I am working with that might be more trouble then its worth. This does not happin on another installation of PHP i have access to. my configuration is as follows REDHAT 7.0 PHP 4.0.4 Thanks in advance! TOM