Jump to content

mmosel

Members
  • Posts

    66
  • Joined

  • Last visited

    Never

Everything posted by mmosel

  1. Oh yes, thank you kenrbnsn - you did give the solution first. I was writing my reply as a you all posted. Thanks to everyone to replied!
  2. Interesting. I've used it for ranges on a few occasions and it works great! I've seen examples of it elsewhere as well. People have posted similar examples on php.net, but it's not an official example. I noticed that on php.net it says switch/case does 'loose comparison', so perhaps that's the answer. When 0, it's probably evaluating to false and causing the problem. I know I can use if else statements. But for a whole boatload of ranges, it's a nice trick to use the switch. It does work, except for the 0 value. Give it a try... ----- update - I like generic's solution - it makes sense since it is simply checking for true or false. I've seen this example on php.net also.
  3. Ok check this out. I've seen this error twice in my code. Is it a bug or am I totally missing something? When I parse the following statement, on both my live and local servers, it echos that $value (when 0 ) is greater than 300. If I switch $value = to 1 then it's fine. So why the problem when = 0? I'm running php 5 on both servers. $value = 0; switch ($value){ case $value < 301: echo "less than 301"; break; case $value > 300: echo "greater than 300"; break; } outputs: greater than 300
  4. Yeah OOP is great, but I'm not so much concerned about our coding style just yet. What I'm thinking about is how to best communicate with a partner about functionality, compatibility, variables, database schema and so forth.
  5. Hello. Been a while since I've been around here! I have a question for some experienced programmers. Up until now, all of my coding has been a one man operation. This is obviously the most efficient way to code in one regard, but it can also take longer. I find myself in a situation where I'm going to be sharing the development of an application, and I'm wondering if people have recommended ways of making collaborations more efficient. My first instinct, going back to early multimedia days, is that a design document is in order. Anyone have any suggestions or links to articles discussing this? I've googled it but nothing jumped out at me. Thanks for any advice.. mmosel
  6. Ok, thanks for the reply, but I'm still not sure how that would work exactly. In terms of storing and retrieving the data for each user and each post and/or thread.
  7. Ok, I'm wondering what is the most efficient way for a forum to keep track of whether or not a member has viewed a thread or not, and that updates when a new post is made in the thread. Seems like a lot of data to keep track of lol. I mean, I could create a table with member ids, thread id and a switch if it's viewed or not. And then everytime a new post is made I'd have to go through and reset the switch for every user and for every thread number. That seems like the table could get pretty massive pretty fast. Had anyone dealt with this or have a clue as to the most efficient way to do it is?
  8. Yeah, thanks for that mr. King. :) I was going to go for the random number, but I decided on auto-increment. I already have a full page_logs table, with ip, user_agent, referer, page, etc. But I want to track repeat visits by guests, and then members who aren't logged in, and then of course while they are logged in. I record raw data, and then run a cron job to filter out bots in the auto-increment table. I'm still working out how I'll process some of the data, but that's another story.
  9. Thanks, but that's a tutorial for who's online. I am building a deeper tracking system that will track return visitors - and using the IP address is not smart for this.
  10. Maybe it's time for a captcha? Either that, or create your own question answer system that stops the bots.
  11. What is your method for tracking guests and returning guests? I'm working on a system where I will set a unique cookie for each guest (or try to). I'm trying to decide if generating a random string is sufficient or if I should use an auto-increment value. If I use the random string, there there is the ever so slight possibility of a duplicate. If I use an auto-increment, then I'm going to have so many non-used numbers it's not even funny (because every time there's a new hit to the home page I would attempt to insert a cookie, which would be an auto increment value). So, how do you or how would you handle this?
  12. [quote author=ShogunWarrior link=topic=100025.msg395472#msg395472 date=1152660622] Except in some browsers ;) [/quote] Really? The base tag doesn't work in all browsers eh? Do you know which ones?
  13. Another tip that I received on another board I visit is a very simple and elegant solution. It doesn't require any special code. Just use the base tag: <base href="http://mydomain.com/" /> And then all of your relative links will magically work as if they were absolute links! Such a simple thing, but it works like a charm. Works for .css, images, and more.
  14. Ok, here's my code! $uri = $_SERVER['REQUEST_URI']; [code] $slashcheck = "\.{1}[a-zA-Z]{3}/+"; $extcheck = "\.{1}[a-zA-Z]{3}"; if (eregi($slashcheck, $uri)){     //echo "slashfound<br />";     $newurl = '/';     $uri = explode('/', $uri);   $count = count($uri); $x = 0; $end = 0;   foreach($uri AS $value){     $x++;     if(!eregi($extcheck, $value) && $value !='' && $end != 1){       $newurl .= $value.'/';       //echo $value." Has has no ext.<br />";     }     if(eregi($extcheck, $value) && $end != 1){         //echo $value." Has an .ext<br />";             $newurl .= $value;                 $end = 1;     }   }//end foreach   echo $newurl."<br />"; } //then of course course redirect to new location... [/code] As an example, $uri = 'index1.php/index2/index3.php/'; returns: index1.php $uri = 'index1php/index2/index3.php/'; returns: index1php/index2/index3.php $uri = 'index1php/index2.php/////index3.php/'; returns: index1php/index2.php
  15. [quote author=GingerRobot link=topic=100025.msg394782#msg394782 date=1152568752] This is all does seem kind of pointless though, i mean, if someone wants to go fiddling with the url what do they expect? [/quote] Well, perhaps you are right. But it bugs me and it just seems like a flaw. If it is fixable, then why not fix it?
  16. [quote author=GingerRobot link=topic=100025.msg394748#msg394748 date=1152566474] That will only redirect if the forward slash is at the end of the file. [/quote] I realise that, but what if the url looks like: mydomain.com/category1/category2/ I didn't test it, but my guess is that your code wouldn't work here. ----- Note, I wrote this before Ginger's last post. I don't know how your new code would affect this. One solution might be to test the REQUEST_URI for a '.ext/' case and then if found, strip the slash, or just strip everything after the .ext if one doesn't plan on allowing that condition.
  17. I've read some articles on using PHP to process accessible URLs, and I'm also aware that a lot of people use mod_rewrite for this. So, what's the difference really? If you do this with your site, what solution do you use?
  18. Shogun, I think you are partly correct. It is probably looking for the page.php directory. But it's not returning a 404 error, but instead it's processing the script and outputting the html content, minus images and style. GingerRobot, I think you have a good idea, but it's not practical, because then anytime I had a slash in the url, it's going to redirect. Sometimes there might be a need for a trailing slash. I'll write up something custom to solve this I guess. I was just checking to find out if this is a common issue and if there was a common solution.
  19. I'm not applying a slash after index.php file, but if I do, I get the error. Sometimes people play around with URLs and i don't want my site to show up as text only if someone messes with the URL.
  20. It's not me I'm worried about. It's my visitors. I wouldn't want anyone to see my site like that, without images or style sheets applied. There must be a way to solve this problem.
  21. I discovered a strange quirk with my site. If I add a slash after a script name, such as index.php/, then my page will show up but with no formating or style sheet, just a white page with text. Does anyone know why this happens? What might be a way to prevent this?
  22. Simple recommendation really. It would be nice if there were some links to the main phpfreaks.com site from the forum area.
  23. Thanks for the tip. I am using PHPMailer, which works wonderfully, but I was using the IsMail and IsSendmail functions. These functions were making the headers much worse than they needed to be. I switched to using the SMTP feature in my script, and it has eliminated some of my concerns from the source info. It still shows my server and host, but it doesn't show my username and the X-AntiAbuse doesn't show the script name that generated the email! Not perfect, but better!
  24. Hi all, I'm hoping that maybe some expert in here has had some experience with this or might have some ideas. I have my php scripts that handle my back-end ecommerce processing (notification scripts) send out emails to my customers. I'm hosting on a shared server. While inspecting the emails that my customers receive, I've noticed that there is some very sensitive data that gets included with each email. Such as what machine I'm on at what host. What my username is at this host. And now they have X-AntiAbuse header data that actually shows the name of my script and it's directory! This just seems so lame. Why can't they wrap it in an alias or something? Anyway, I need to find a way to secure this information. They aren't being very helpful. So, is there a way that I can use php to perhaps forward this email to a service or something that would cleanse this info and then send the email to my customer? Or, are there any other ways that I might be able to get around this? Thanks for any tips or ideas that you may have.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.