I have a situation where I need to push visitors back to a welcoming page if they've not visited the site previously. I have implemented it in the drupal index.php page, however it doesn't seem to be reliably working so I wanted to post this for review, comments and suggestions as to the proper way to control this. Perhaps there is even a module that I'm missing that would be better suited so please advise as you see fit:
index.php: *** BEGIN PASTE *** <?php //... First Drupal Comments ... // BEGIN OUR FUNCTIONS // if they're new, send them back to the welcome page, else, check if they come from signup and set has_visited
$referring_url = $_SERVER['HTTP_REFERER']; // get the referring URL, looking for http://www.mydomain.com/welcome/ $position_result = strpos($referring_url, "welcome");
if ( ($position_result > 0) || isset( $_COOKIE['has_visited'] ) ) { setcookie("has_visited", true, time()+7776000); } else { header('Location:/welcome/index_main_site_entry.php'); }
// END OUR FUNCTIONS
echo $_SESSION['HTTP_REFERER']; //... rest of index.php ... *** END PASTE ***
ALSO, in the index_main_site_entry.php file I would like to test to see if has_visited has been set so that I can pass them on into the site, but I've not been able to make that one work reliably at all.
Thanks in advance for your input!
-George
I hate to pester, but I'm very hopeful that someone could have some helpful input with regards to this issue since I've received no responses on it thus far and it is a pretty time sensitive issue:
On Mar 16, 2006, at 10:07 AM, lists@southernohio.net wrote:
I have a situation where I need to push visitors back to a welcoming page if they've not visited the site previously. I have implemented it in the drupal index.php page, however it doesn't seem to be reliably working so I wanted to post this for review, comments and suggestions as to the proper way to control this. Perhaps there is even a module that I'm missing that would be better suited so please advise as you see fit:
index.php: *** BEGIN PASTE *** <?php //... First Drupal Comments ... // BEGIN OUR FUNCTIONS // if they're new, send them back to the welcome page, else, check if they come from signup and set has_visited
$referring_url = $_SERVER['HTTP_REFERER']; // get the referring URL, looking for http://www.mydomain.com/welcome/ $position_result = strpos($referring_url, "welcome");
if ( ($position_result > 0) || isset( $_COOKIE['has_visited'] ) ) { setcookie("has_visited", true, time()+7776000); } else { header('Location:/welcome/index_main_site_entry.php'); }
// END OUR FUNCTIONS
echo $_SESSION['HTTP_REFERER']; //... rest of index.php ... *** END PASTE ***
ALSO, in the index_main_site_entry.php file I would like to test to see if has_visited has been set so that I can pass them on into the site, but I've not been able to make that one work reliably at all.
Thanks in advance for your input!
-George
George....
Well, I'm not going to debug your php (I have enough trouble finding my own bugs!), but one thing I notice:
header('Location:/welcome/index_main_site_entry.php');
seems suspect.
The php docs say:
header("Location: http://www.example.com/"); /* Redirect browser */
and further note:
Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:
Maybe it's only working some of the time, depending on the clients?
brew
Hey, thanks for that note brew. I'm not sure, that very well may be true as it appears that Firefox is not having any issues. I'm not sure about IE yet, but it is with Safari that I'm struggling, even though, as I said, it will work indefinitely after I've gone through the welcome area that browsing session.
** If anyone does have any further experiences, or even better, if there is a module that handles what I'm wanting to do more efficiently, please advise.
Thanks!
-George
On Mar 17, 2006, at 2:07 AM, brew@theMode.com wrote:
George....
Well, I'm not going to debug your php (I have enough trouble finding my own bugs!), but one thing I notice:
header('Location:/welcome/index_main_site_entry.php');
seems suspect.
The php docs say:
header("Location: http://www.example.com/"); /* Redirect browser */
and further note:
Note: HTTP/1.1 requires an absolute URI as argument to Location: including the scheme, hostname and absolute path, but some clients accept relative URIs. You can usually use $_SERVER['HTTP_HOST'], $_SERVER['PHP_SELF'] and dirname() to make an absolute URI from a relative one yourself:
Maybe it's only working some of the time, depending on the clients?
brew
George.......
** If anyone does have any further experiences, or even better, if there is a module that handles what I'm wanting to do more efficiently, please advise.
Here is the function that I use for redirection in PHP. The part you probably need is just the call to the header function, but I don't think it would hurt to use it as is. The first part is for session variables when passed in the URL and the session_write_close might be neccessary if any session variables were changed before the redirect. There are also some notes from people on php.net that say exit shouldn't be called after the redirect, you should just make sure no other code executes afterward.
For instance:
if (some condition) { $page = 'webpage.php'; relative_redirect($page); } else { # a bunch of other code }
# and then the main part of the code just ends with no exit.
Anyway, here's the function:
function relative_redirect ($relative_url) { # if SID exists add it to the url if (SID) { if ( strstr( $relative_url, '?')) { # then add it to existing get string $relative_url .= '&'; } else { # else start a new get string $relative_url .= '?'; } $relative_url .= strip_tags(SID); } session_write_close(); header("Location: http://%22.$_SERVER%5B%27HTTP_HOST'] .dirname($_SERVER['PHP_SELF']) .$relative_url); }
brew
========================================================================== Strange Brew (brew@theMode.com) Check out my Stock Option Covered Call website http://www.callpix.com and my Musician's Online Database Exchange http://www.TheMode.com ==========================================================================
Hi, I'm having problems with attachments/uploads to the site. It seems that the uploads that aren't being accepted are zip files. I went into admin/settings/upload and added zip as an attachment that was accepted. I also increased the size of allowable file sizes for uploads. So, the general limit is set to 0 for unlimited file size and then the other max file sizes are 100M. Thus it makes no sense that a 4.6M file in zip format cannot be uploaded to the site. Allowing uploads like this allows customers to send various content for a site in a compressed collection of files. So, is the problem the size limit that can be uploaded to the site? or is it something else that I must set? Thanks in advance, Bruce
++++++++++++++++++++++++++++++++++++++++++++++++++++ Word Salad Poetry Magazine - join us online at: http://wordsalad.net/ and also -> Check out the Buffy the Vampire Slayer writing Street Exposure - Street Newspaper http://wordsalad.net/StreetExposure/ Bruce Whealton - Webmaster/Designer/publisher/Writer http://trianglewebservices.com/ ++++++++++++++++++++++++++++++++++++++++++++++++++++ --------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments.
Did you change the settings in your php.ini to allow unlimited size file upload?
Regards, Fernando Silva
On 3/19/06, Bruce Whealton brucewhealton@yahoo.com wrote:
Hi, I'm having problems with attachments/uploads to the site. It seems that the uploads that aren't being accepted are zip files. I went into admin/settings/upload and added zip as an attachment that was accepted. I also increased the size of allowable file sizes for uploads. So, the general limit is set to 0 for unlimited file size and then the other max file sizes are 100M. Thus it makes no sense that a 4.6M file in zip format cannot be uploaded to the site. Allowing uploads like this allows customers to send various content for a site in a compressed collection of files. So, is the problem the size limit that can be uploaded to the site? or is it something else that I must set? Thanks in advance, Bruce
++++++++++++++++++++++++++++++++++++++++++++++++++++ Word Salad Poetry Magazine - join us online at: http://wordsalad.net/ and also -> Check out the Buffy the Vampire Slayer writing Street Exposure - Street Newspaper http://wordsalad.net/StreetExposure/ Bruce Whealton - Webmaster/Designer/publisher/Writer http://trianglewebservices.com/ ++++++++++++++++++++++++++++++++++++++++++++++++++++
Yahoo! Mail Use Photomailhttp://pa.yahoo.com/*http://us.rd.yahoo.com/evt=38867/*http://photomail.mail.yahoo.comto share photos without annoying attachments.
-- [ Drupal support list | http://lists.drupal.org/ ]
Where would I find the php.ini file? I'm not seeing it in the drupal install directory anywhere, at least not yet have I found it. Bruce
Fernando Silva fsilva.pt@gmail.com wrote: Did you change the settings in your php.ini to allow unlimited size file upload?
Regards, Fernando Silva
On 3/19/06, Bruce Whealton < brucewhealton@yahoo.com> wrote: Hi, I'm having problems with attachments/uploads to the site. It seems that the uploads that aren't being accepted are zip files. I went into admin/settings/upload and added zip as an attachment that was accepted. I also increased the size of allowable file sizes for uploads. So, the general limit is set to 0 for unlimited file size and then the other max file sizes are 100M. Thus it makes no sense that a 4.6M file in zip format cannot be uploaded to the site. Allowing uploads like this allows customers to send various content for a site in a compressed collection of files. So, is the problem the size limit that can be uploaded to the site? or is it something else that I must set? Thanks in advance, Bruce
++++++++++++++++++++++++++++++++++++++++++++++++++++ Word Salad Poetry Magazine - join us online at: http://wordsalad.net/ and also -> Check out the Buffy the Vampire Slayer writing Street Exposure - Street Newspaper http://wordsalad.net/StreetExposure/
Bruce Whealton - Webmaster/Designer/publisher/Writer http://trianglewebservices.com/ ++++++++++++++++++++++++++++++++++++++++++++++++++++
--------------------------------- Yahoo! Mail Use Photomail to share photos without annoying attachments.
-- [ Drupal support list | http://lists.drupal.org/ ]
Where would I find the php.ini file? I'm not seeing it in the drupal install directory anywhere, at least not yet have I found it. Bruce
php.ini is the PHP configuration file and has nothing to do with Drupal as such. It usually resides in /etc on Linux servers. If you can't find it, check with your host or use phpinfo() to find out. Check the PHP manual (php.net) for directions and examples on using phpinfo().
-K
On Monday 20 March 2006 05:55 am, Bruce Whealton wrote:
Where would I find the php.ini file? I'm not seeing it in the drupal install directory anywhere, at least not yet have I found it. Bruce
The php.ini file is part of your PHP installation, not part of Drupal. Read through this thread for clues on how to fix this problem:
BTW, I wouldn't set it to unlimited, but a large enough size to handle your needs. You never know what someone will try out of ignorance or malice.
Fernando Silva fsilva.pt@gmail.com wrote: Did you change the settings in your php.ini to allow unlimited size file upload?
Regards, Fernando Silva
On 3/19/06, Bruce Whealton < brucewhealton@yahoo.com> wrote: Hi, I'm having problems with attachments/uploads to the site. It seems that the uploads that aren't being accepted are zip files. I went into admin/settings/upload and added zip as an attachment that was accepted. I also increased the size of allowable file sizes for uploads. So, the general limit is set to 0 for unlimited file size and then the other max file sizes are 100M. Thus it makes no sense that a 4.6M file in zip format cannot be uploaded to the site. Allowing uploads like this allows customers to send various content for a site in a compressed collection of files. So, is the problem the size limit that can be uploaded to the site? or is it something else that I must set? Thanks in advance, Bruce
Hi all, I'm wondering if this can be done... or if there is another module I might want to try. I want to have a nice way to display photographs by groupings for a specific customer of mine. The image module (specifically the module named image) is not the most elegant (is that the word?) way to display photographs. Maybe I could use some more ideas on how others have used this module? Or other modules that might work for this project. Basically I have an architectural firm that wants to display images/photographs of their different 'Projects.' So, I thought, one image gallery (either in Gallery or in the Image module) for each project, where the project names match the image galleries. I could instal Gallery elsewhere on my server and just not include it within Drupal. Linking outside Drupal from within Drupal may not be elegant either. I don't have shell access on the server so I don't think I can do what the instructions say for installing the Gallery module. That issue may be due to the fact that I'm trying to install Gallery using cPanel from my server. When it says install Gallery in the same directory as Drupal does that mean it should be like this: mydomain.com/drupal_install/Gallery or should Gallery and Drupal_install use the same exact directory? If so, won't they have the same file names, e.g. index.php For specifics about what I am describing go to http://ghwilliamscollaborative.com This below is what my web hosting provider said.
Hello,
As to your question, the technical team said that there is no reason why you shouldn't be able to do this. The problem is probably that you are not installing it in a subfolder. For example, you should install it in the folder Drupal/gallery. This way they are both in the same folder, but one is in a subfolder.
The documentation I was referred to on this list referenced a procedure using a simlink to link things if the Gallery application was not installed in the same directory as Drupal. Again does this mean I can install Gallery here: Drupal/gallery or must they share the same directory?
Are there other recommendations, other modules to accomplish this that someone can recommend? Thanks so much, Bruce
++++++++++++++++++++++++++++++++++++++++++++++++++++ Word Salad Poetry Magazine - join us online at: http://wordsalad.net/ and also -> Check out the Buffy the Vampire Slayer writing Street Exposure - Street Newspaper http://wordsalad.net/StreetExposure/ Bruce Whealton - Webmaster/Designer/publisher/Writer http://trianglewebservices.com/ ++++++++++++++++++++++++++++++++++++++++++++++++++++