| Subcribe via RSS

passing session between subdomains

December 19th, 2007 | No Comments | Posted in php, server by dreamluverz


Few months ago i’ve been looking for ways how to do this. I’ve tried some things though but I need a better solution. Tonight I came across these sites on how to do it. I haven’t tried it yet coz I really don’t have time right now, i’m still packing my stuffs but I’m so eager to try it, for sure when I come back next year coz I need this code on the sites I’m working on.

<blockquote>

PHP configuration to set “session.cookie_domain” to “.mysite.com” (note the leading period) so that the session cookies are applicable across the entire domain.

ini_set(’session.cookie_domain’, ‘.example.com’);

</blockquote>

sources:http://www.phpbuilder.com/board/archive/index.php/t-10345127.html, http://www.dnforum.com/f181/keeping-session-variables-across-subdomains-thread-152857.html , http://www.webmasterworld.com/forum88/13145.htm

UPDATED: January 3, 2008

I just got back from my vacation and back to work again. :P

I’ve been trying out this session.cookie_domain for hours but can’t make it work. You may also find it in other forums or blogs that you need to set the cookie path but I didn’t try it coz according to some who tried it, it still didn’t do the trick.

Ssome says to use php_value session.cookie_domain as an alternative on .htaccess but I got internal server error 500. I’m not sure if it conflicts when the mod_rewrite i had on .htaccess so I just stick to ini_set() and try to make it work. I still believe in prayers so I did pray.

I tried checking the values cookie_domain, phpsessid on phpinfo(), defined ini_set(’session.cookie_domain’, ‘.example.com’); before calling session_start(), and restarted the browsers(tested on ie & ff) and now it works. Thanks God :)

UPDATED:  jan 7 ‘08

The session.cookie_domain doesn’t work in firefox when accessing url without www e.i. (http://domain.com)  so I removed  the preceeding dot ‘.’ on the domain value and now it works both for ie and firefox.

Tags: , , , , , ,

merry christmas to all

December 19th, 2007 | No Comments | Posted in anything under the moonlight by dreamluverz



merry christmas to all

I wanted to share this photo with you taken during those nights when there was power outage. The only companion I had during those times.

Like this candle it brings light to us when darkness is all around us making us so lonely inside. But looking how bright it is and knowing that God is always there for us no matter how dark the world may seems to be, we started to smile and say God is good all the time :)

Wishing you a merry merry christmas as you celebrate it with your loved ones, families, and friends. Hope like this candle you’ll be able to bring light to others not only this holiday season. Be seeing you again next year with lots of things to share with you all from my hometown vacation. God Bless! :)

mod_rewrite and regular expressions

December 19th, 2007 | No Comments | Posted in apache, server by dreamluverz

I’ve been looking for this article and finally found it! Thanks to justin who posted this on some website.
Regular Expressions
I guess I should start by describing a regular expression. (They aren’t too scary once you get to know them.) A regular expression is basically a small piece of code that checks for patterns. The pattern can range from a single character that matches to absolutely everything. Regular Expression Pre-qualifier… these definitions are how regular expressions are generally used in .htaccess files and though most definitions will be applicable globally, there are some that may not. There are some predefined ‘terms’ in regular expressions to make your life easier. (At least, that are supposed to make your life easier.) Here is a short list, with what each does in the mod_rewrite setting.

[ ] enclose the expression or a portion of the expression. (Used for determining the characters, or range of characters to be matched.)

letter-letter (EG [a-z] matches any single lowercase alphabetical character in the range of a to z), so [c-e] will match any single character that is the lowercase letter c, d, or e.

LETTER-LETTER (EG [A-Z] matches any single capital alphabetical character in the range of A to Z), so [C-E] will match any single character that is the capital letter C, D, or E.

number-number (EG [0-9] matches any single number in the range of 0 to 9), so [4-6] would match any single number 4, 5, or 6.

character list (EG [dog123] matches any single character, either d, o, g, 1, 2, or 3.

^ has two purposes, when used inside of [ ] it designates ‘not’. (EG [^0-9] would match any character that is not 0 to 9 and [^abc] would match any character that is not a lowercase a, b, or c.) When used at the beginning of a pattern in mod_rewrite, it also designates the begining of a ‘line’.

It is very important to understand and remember [dog] does not match the word ‘dog’, it matches any individual lowercase letter d, o, or g anywhere in the comparison. in the same way, [^dog] does not exclude the word ‘dog’ from matching, it excludes the lowercase letter d, o, or g from matching individually.

To match a ‘word’ or a group of characters in order, you do not need to use [] so ^dog$ would match the word dog, and not d, o, or g as a single character.

. (a dot) matches any single character, except the ending of a line.

? matches 0 or 1 of the characters or set of characters in brackets or parentheses immediately before it. (EG a? would match the lowercase letter ‘a’ 0 or 1 time, (abc)? would match the phrase ‘abc’ 0 or 1 time, while [a-z]? would match any lowercase letter from ‘a to z’ 0 or 1 time.)

+ matches 1 or more of the characters or set of characters in brackets or parentheses immediately before it. (EG a+ would match the lowercase letter ‘a’ 1 or more times, (abc)+ would match the phrase ‘abc’ 1 or more times, while [a-z]+ would match 1 or more lowercase letters from ‘a to z’.)

* matches 0 or more of the characters or set of characters immediately before it. (EG a* would match the lowercase letter ‘a’ 0 or more times, (abc)* would match the phrase ‘abc’ 0 or more times, while [a-z]* would match 0 or more lowercase letters from ‘a to z’.)

These are the basic building blocks of regular expressions as used in .htaccess and associated with mod_rewrite. By themselves, they do little, but when you put them together, they become very powerful.

Along with regular expressions, mod_rewrite allows for the use of special characters. It’s a good thing to understand what these are before you begin writing rules. (Mainly because you need one or more of them in almost every rule.)

RewriteRule tells the server to interpret the following information as a rule.

RewriteCond tells the server to interpret the following information as a condtion of the rule(s) that are immediately after it.

^ defines the begining of a ‘line’ (starting anchor). Remember, ^ also designates ‘not’ in a regular expression, so please don’t get confused.

( ) creates a variable to be stored and possibly used later, and is also used to group text for use with the quantifiers ?, +, and * described above.

$ defines the ending of a ‘line’ (ending anchor), and when followed by a number from 1 to 9, also references a variable defined in the RewriteRule pattern (used for variables on the right side of the equation or to match a variable from the rule in a condition, see example below).

% references a variable defined in a preceding rewrite condition. (used for variables on the right side of the equation only, see example below)

*note* - The right side of the equation is everything that follows the $ in a RewriteRule.

Examples: All variables are given a number according to the order they appear; The following rule and condition each have two variables, defined by parenthesis, so to use them you would put them where you need them in the results:
(the ‘-’ is for spacing only to make the line more readable, and is not necessary to use variables.)

RewriteRule ^(var1)/no-var/(var2)$ /to-use-variables-type-$1-and-$2

The final result would look like this:
to-use-variables-type-var1-and-var2

RewriteCond %{CONDITION_STUFF} ^(var1)/no-var/(var2)
RewriteRule ^no-var/no-var/no-var$ /to-use-variables-type-%1-and-%2

The final result would look like this:
to-use-variables-type-var1-and-var2

To use a combination of the Condition and Rule Variables

RewriteCond %{CONDITION_STUFF} ^(var1)/no-var/(var2)
RewriteRule ^(var1)/no-var/(var2)$ /to-use-variables-type-$1-and-%2-$2

The final result would look like this:
to-use-variables-type-var1-and-var2-var2

The exception to the above examples is, you can also use the %{CONDITION_STUFF} server variables in the right side of a rule, but it must appear exactly as in the condition:
RewriteRule ^(var1)/no-var/(var2)$ /type-%{CONDITION_STUFF}

¦ (bar) stands for ‘or’, normally used with alternate text or expressions grouped with parenthesis (EG (with¦without) matches the string ‘with’ or the string ‘without’. Keep in mind that since these are inside parenthesis, the match is also stored as a variable.)

\ is called an escaping character, this removes the function from a ’special character’ (EG if you needed to match index.php?, which has both a . (dot) and a ?, you would have to ‘escape’ the special characters . (dot) and ? with a \ to remove their ’special’ value it looks like this: index\.php\?)

! is like the ^ in a grouped regular expression and stands for Not, but can only be used at the beginning of a rule or condition, not in the middle.

- on the right side of the equation stands for No Rewrite. (It is often used in conjunction with a condition to check and see if a file or directory exists.)

mod_rewrite Directives for URL Redirection

Flags, in mod_rewrite are what give you the control of the response sent by the server when a specific URL is requested. They are an integral part of the rule writing process, because they designate any special instructions that might be needed. (EG If I want to tell everyone a page is moved permanently, I can add R=301 to my rule and they will know.)

Flags follow the rule and the most often used, are enclosed with [ ] (Not all flags are covered here, but the main and widely used ones are.)

[R] stands for Redirect. The default is 302-Temporarily Moved. This can be set to any number between 300 and 400, by entering it as [R=301] or [R=YourNumberHere], but 301 (Permanently Moved) and 302 (Temporarily Moved) are the most common.

(If you just use [R] this will work, and defaults to 302-Temporarily Moved)

** Do not use this flag if you are trying to make a ’silent’ redirect.

[F] stands for Forbidden. Any URL or file that matches the rule (and condition(s) if present) will return a 403-Forbidden response to anyone who tries to access them. (Useful for files that you would like to keep private, or you do not want indexed prior to ‘going live’ with them.)

[G] stands for Gone. (Similar to 404-Not Found, but it indicates that a resource was intentionally removed.) Not recommended for use unless you test the HTTP protocol level used by the client and return 410-Gone only to HTTP/1.1 or enhanced HTTP/1.0 clients. Older true HTTP/1.0 clients will treat 410-Gone as 400-Bad Request.

[P] stands for Proxy. This creates a type of ’silent redirect’ for files or pages that are not actually part of your site and can be used to serve pages from a different host, as though they were part of your site. (DO NOT mess with copyrighted material, some of us get very upset.)

[nc] stands for No Case as applied to letters, so if you use this on a rule, MYsite.com, will match mysite.com… even though they are not the same case. (This can also be used with regular expressions, so instead of [a-zA-Z], you can use [a-z] and [nc] at the end of the rule for the same effect.)

[QSA] stands for Query String Append. This means the ‘query string’ (stuff after the?) should be passed from the original URL (the one we are rewriting) to the new URL.

[L] stands for Last rule. As soon as this flag is read, no other following rules are processed. (Every rule should contain this flag, until you know exactly what you are doing.)

in an attempt to put together regular expressions and mod_rewrite special characters here are some examples of what they do:

Goal: to match any lowercase words, or group of letters:
Possible Matches:
lfie, page, site, or information
Expression:
[a-z]+

Explanation: [a-z] matches any single letter. + matches 1 or more of the previous character or string of characters. When you put the two together you have a regular expression that matches any single letter from a to z over and over, until it runs into a character that is not a letter.

Goal: to match any words, or groups of letters, and store them in a variable:
Possible Matches:
lfie, Page, site, or inforMation
Expression:
([a-z]+) [nc]

Explanation: Same as above with the addition of () and [nc]. in mod_rewrite, () creates a single variable out of the regular expression, so the word matched is now in a variable. [nc] stands for ‘No Case’ (from mod_rewrite) specifying that the regular expression or regular text strings match both upper and lowercase letters. With this expression you can match any single word.

Goal: to match any word, or group of letters, then any single number, and store them in separate variables:
Possible Matches:
lfie1, Page2, site6, or inforMation9
Expression:
([a-z]+)([0-9]) [nc]

Explanation: Same as above, except notice there is no + in the number expression. This way, only a single number at the end will match. The letters are placed into one variable, and the number is placed into another.

Goal: to match any word, or group of letters, then any single number, and store them in the same variable:
Possible Matches:
lfie1, Page2, site6, or inforMation9
Expression:
([a-z]+[0-9]) [nc]

Explanation: Same as above, except notice the plus is immediately following (no space) the [a-z], but before the [0-9] (again no space), so the + affects the [a-z], but not the [0-9].

Goal: to match any word, or group of letters, then any group of numbers, and store them in the same variable:
Possible Matches:
lfie11, Page2, site642, or inforMation9987653
Expression:
([a-z]+[0-9]+) [nc]

Explanation: Same as above with the addition of a + immediately following to the numerical expression to match 1 or more numbers instead of only 1.

Goal: to match any word, or group of letters, any group of numbers, and any random letters and numbers, which might or might not be mixed together:
Possible Matches:
11, gPaE, s17ite642, or 2Createinfo4UisCool
Expression:
([a-z0-9]+) [nc]

Explanation: The change here is to the regular expression grouping. Putting a-z and 0-9 in the same grouping followed by [nc] matches any combination of letters and numbers.

Goal: to match any word, or group of letters, then a single /, then any group of numbers, and store only the numbers in a variable.
Possible Matches:
lfie/10, gPaE/1, site/642, or CreateinfoUisCool/2474890
Expression:
[a-z]+/([0-9]+) [nc]

Explanation: Using the [a-z]+ without () matches the letters as usual. By putting the / outside of any expression, the only thing that will match is the exact character of /. Then using the ([0-9]+) again, stores any group of numbers in a variable.
Goal: to match anything before the / and store it in a variable, then match anything after the / and store it in a separate variable:
Possible Matches: lfie/10.html, gP..aE/1page_two.file, si-te/642-your-site, or
Createinfo/245390.php
Expression:
([^/]+)/(.+)

Explanation: Using two new forms of regular expressions, this is actually easier than it may seem. Making use of the ^(not) character, matches anything that is not a / and the () again saves it in a variable. Then using the same form as above, the single, exact character of / is matched. Finally, the . (dot) character is used, because it matches any single character that is not the end of a line, and when combined with the + character, matches anything up to a line break. Once again, () are used to create the variable. *Also, notice the use of a ‘catch-alls’ eliminates the need for the [nc] ‘flag’ of mod_rewrite.

Justin

source: http://www.webmasterworld.com/forum92/4332.htm

Tags: ,

Palawan here I come

December 18th, 2007 | No Comments | Posted in anything under the moonlight by dreamluverz

I’ve been counting every single day before dec 19. You know why? coz that’s my flight going to palawan(my hometown). And few hours from now it would be that day i’ve been waiting for. Juz thinking of that day to come and those days i’ll be spending there makes me so excited. :) I’ve never been back home for almost 3 years.

Needless to say that since I graduated from highschool the only days I’ve been there is during christmas break for just a week. And just last sunday we had our hiskul get together after 10years. Imagine that how long i’ve been away. But this year I would be able to spend it a little longer, almost 2 weeks :wink: hehehe.

Anyway, I’m already grateful with that at least my boss allowed me to go home. It would also be a nice time to relax, not thinking about work(well i hope so.. hehehe) coz when I come back there are still huge task to be done. :cry:

Ok. I need to get ready now and prepare my things. I’ll be bringing back lots of pics and memories to share with you all :)

Tags: , ,

hiskul get together

December 17th, 2007 | No Comments | Posted in Food, Videos, anything under the moonlight by dreamluverz

Last month I dreamt about some hiskul reunion… Some people or names I can recall from that dream were glenise, dinana, allyn and I guess ana may…

Then few weeks ago, one of those usual nights somebody messaged me. The id is familiar coz it’s on my list. She asked me if I’ll be able to attend our reunion back home. I was surprised coz that id was on the wrong group list. It’s on my convergy’s groups(former officemates), I realized then that that person was my hiskul classmate. I asked for identification and found out that she’s ana may :) Oh sorry girl for placing you on the wrong groups :P

Anyway, we started talking and finally decided to have a reunion here in manila for those who cannot come home. So that’s how it started. Dec 15, 6pm. Greenbelt makati. So it was set!

Dec 15 came, and I’m really excited to see them. I haven’t seen most of my classmates since graduation. Then I remembered my dream last month. I’m not sure if that dream pertains to this reunion or the coming reunion at my hometown this coming weeks. But those names from my dream rang a bell on this dec15 get together coz they said those people will be coming too…

Around 5:45 pm I received a text message from ana may that she’s ready to go and just waiting for the time. I replied that i’m still getting dress. Anyways, the venue was just near at my place. 2nd sms said she’s on her way. That night it’s so hard getting taxi and the traffic was so heavy maybe becoz of the season and everybody was out there on the streets busy buying gifts and attending parties :P

She’s patiently waiting at the hall in front of mark&spencer.I almost didn’t recognize her, after a decade of not seeing her :P She looked much slimmer now. While waiting for them we decided to look for bag in landmark, it’s cheaper there :P. Remember my previous post about this bag? :P I already scouted for bag that night but still the following day it took me 5 hours to decide and in the end changed my mind of not buying it. Crazy! :P

We met jack at rea and went ahead to cascada for most of us were already hungry :P

Cascada, greenbelt is a nice place to have dinner for 2 or groups. Friendly, approachable and courteous waiters. The resto is clean, comfy chairs, and cool environment. And of course the delicious food they serve. Looking at the food reminds me of “top chef”. One of my fave reality shows :) I love food and cooking obviously :)

Checking the menu:

Some of our foods: Check my picasa account for bigger size :)

I forgot what it’s called. If i’m not mistaken maki? Well I don’t eat this coz it contains crabs :)

garlic cheese pizza.

mushroom soup

fish & fries

drinks

of course the attendees :cool:

poor me I’m always behind the scene :P But I love taking pics and let them model for me. hahaha :lol: After having dinner we decided to go to music21.

Ayala xmas lights. We just walked from greenbelt to jupiter. Most of them were complaining already, hahaha. But i’m sure they would hardly feel tired ‘coz they have lots of stories to tell with each other after a decade of not seeing some of them.

See! :lol: See the evidence. They love walking plus it’s an exercise. :P Sorry Mitz you’ve always been blocked. hehehe. Did you notice something on this pic? girls on the front row and girls and the back? What’s the difference? hahah. :evil: But it’s not too obvious here coz we can’t see their full body at the back. :mrgreen:

Music21, jupiter makati. It’s more affordable than redbox. Filipinos love to sing very much and videoke is one way of expressing it. They have different packages that’s consumable with different sets to choose from. They have big list of songs divided into categories of artists, singers, languages, etc.

rock it jack rock it! :evil:

This is what they call crispy pata. One of the included fuds for package B set3 I guess. They said it’s delicious but never tasted it coz I don’t eat pork :P

last glimpse of the attendees :) Ana may, jack, joyce, carissa, mitz, rea and me(behind the camera :mrgreen: )

The video to follow. I’m still uploading it :)

At last it’s done… phew! I’m having net prob awhile ago.

Tags: , , , , , ,

crazy bag or me? :)

December 17th, 2007 | No Comments | Posted in anything under the moonlight by dreamluverz

I almost spent 5 hours deciding on what bag am I going to buy. Back and forth I checked every rows, styles, brands, and prices and not yet contented I did it not only once, not only twice… well… you can imagine it :P

After 5 hours of looking I was able to pick one bag :) and that’s first on my list :P. When I was already looking for the remaining items, I started to have headache and………….. ended up not buying the bag! What!?!?! After I’ve wasted lots of time and energy looking for that bag and then I suddenly changed my mind… :cry:

I can still feel the headache until now and wanted to sleep…

Tags: , ,

Nurses at Risk Due to Chemical Exposure In Hospitals

December 14th, 2007 | No Comments | Posted in Health by dreamluverz

Nurses may face health risks because of their unwitting exposure to typical hospital chemicals such as disinfectants, medication and radiation, an environmental group revealed Tuesday.

Hospitals may be clean and sterile but that is not to say that hospital employees are safe from health risks. A survey conducted by the Environmental Working Group (EWG) suggests there is a link between hospital nurses’ exposure to chemicals, pharmaceuticals and radiation and serious health problems such as cancer, asthma, miscarriages and children with birth defects, the public watchdog said in a press release Tuesday.

The group worked in collaboration with the American Nurses Association, Health Care Without Harm and the Environmental Health Education Center at the University of Maryland School of Nursing, and says this survey is the first of its kind.

Although extremely detailed, its authors note that the survey was not a controlled, statistically designed study.

Substances such as residues from medications, anesthetic gases, sterilizing and disinfecting chemicals, latex, cleaning chemicals, hand and skin disinfection products, and even mercury escaping from broken medical equipment are all potential culprits, the EWG says.

source: more >>

Tags: , , ,

People who eat a lot of red and processed meats have a higher risk of developing several types of cancer

December 14th, 2007 | No Comments | Posted in Health by dreamluverz

People who eat a lot of red and processed meats have a higher risk of developing several types of cancer, including lung cancer and colorectal cancer, according to a new study from the National Cancer Institute.

For the study, researchers examined data from a large U.S. diet and health study, which began in 1995 and involved 500,000 men and women ages 50-71.

The research was conducted by Amanda Cross and colleagues at the National Cancer Institute and is published in the latest issue of PLoS Medicine.

Click here to read the published article

This is what the study found.

People who ate the most red were 25 percent more likely to be diagnosed with bowel, liver, lung and esophageal cancer during the eight-year study, compared to those who consumed small amounts of this type of meat.

The researchers also found that people who ate the most processed meats, including bacon, ham and lunch meat, had a 20 percent higher risk of colorectal cancer and a 16 percent higher risk of lung cancer.

source: more>>

Tags: ,

Face-Transplant Patient ‘Satisfied’

December 14th, 2007 | No Comments | Posted in Health by dreamluverz

face transplant before and after A French woman who two years ago became the first person to receive a face transplant has recovered with remarkably good aesthetic results and has gradually regained normal skin sensation and control of her facial muscles, doctors reported yesterday in the first detailed account of her progress.

Isabelle Dinoire, who at age 38 lost her lips, cheeks, chin and most of her nose when she was mauled by her dog, now blends into crowds and attends parties comfortably with the face she got from a 46-year-old brain-dead donor. Surgeons attached the face like a mask in a landmark 15-hour surgery.

source: more >>

Google: Don’t give up on OpenSocial

December 14th, 2007 | No Comments | Posted in anything under the moonlight by dreamluverz

When Google unveiled its OpenSocial developer initiative at the end of October, observers hailed it as the future of the social Web. But is the search king already too late to the party?

It’s been over six weeks, and OpenSocial–which uses open-source code to allow any participating social media site to implement a common set of application program interfaces (APIs) and create “universal” applications–isn’t finished, though developers believe it will be ready early in 2008. In the meantime, a number of partners have launched independent developer platform strategies, and Facebook has announced that other social networks will be able to use its own applications, rivaling what Google can offer.
More »

Tags: ,