Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. I'll check it out. So far, there has never been what I would even consider a competent PHP podcast let alone a good one.
  2. I think you kind of missed my point. For simplicity sake I left out a discussion of movie distribution in the analogy. What needed to be taken away, is that the way you get traffic is you "market" your site. You need to have a "budget" and spend money. Long and short... you buy traffic. You can't put up a site and expect people to come to it, when you didn't advertise it. There are things like CPC deals or CPA deals (advertising networks) and Google Adwords. As for the mechanics of google... who cares if you're number 1 for 5 keywords that each generate 5 visitors a day? Worse yet, focusing on gaming search engines so you get traffic for people who hit your site, see immediately that it is not relevant to what they were looking for, and immediately leave is an exercise in futility, that far too many people seem preoccupied with. Not to mention that google is constantly working on ways to keep people who are attempting to game them out of their results.
  3. Really an email confirmation system is a trivial addition. I wouldn't rush to throw things out just because there's a feature that is missing. Since you're heading that direction it seems, I'd point you to the freelance forum. If you don't trust it, you might be better off, starting with the code, and asking for an assessment of it. It might be poorly written code that will be hard to maintain, but it could also be solid code, that is a good basis for extending. Since you started with a "subscription" system as your basis, again the problems that need to be solved for "subscription" like monthly billing and payment processing are not insignificant. There's really no good reason for you to be upset at this point about what you got previously, until you've gotten an expert opinion that the code is garbage and you really need to start over, but I'm sure you would admit that you're not able to decide that for yourself. Get an expert to help you out with the problem.
  4. You are making this too complicated. Think about movie marketing. -Movie A is a romcom that sucks. -Movie B is romcom that is great. Movie studio A spends 10m on tv commercials and internet ads to market it's movie, it opens in 2k theaters and that generates $18m at the box office. After word of mouth gets out the movie dips quickly. 2 weeks later it's out of theaters, with a total gross of $27 million. Movie studio B spends 10m, it opens in 2k theaters, makes $18m, and then stays in theaters for the next 5 weeks, ultimately making $40m at the BO. Both movies get reviewed, but as public appreciation for Movie B is higher, there is a lot more attention paid to it. People write glowing reviews and proviles of the writer and director. Fans create sites in homage to it. A young actor in the movie starts getting oscar buzz and begins to be followed around by paparazzi and appearing on red carpets for other movies. This phase is a lot like search engines. In order for this to work, there has to be genuine interest. People need to be searching for the movie, or its stars. The more interest, the more value the search engines place, and the more long term traffic will be generated for it. But notice, that both movies had to spend money to get enough public attention for it to make any money. People have this idea that the internet is like a "Field of Dreams". "Build it and they will come." That just isn't the case.
  5. The solved system is an SMF forum modification that was created by a mod for the use of phpfreaks. Recently the forum was upgraded, and the customizations would need to be re-installed. I don't know what the plans are in terms of the customization at this point.
  6. There is no way to answer that in a vacuum. If you are going to write the code yourself, you have to learn to understand how your system works, and the web environment seems easy to people because they can write html and get results, but it's actually very complicated and comes with a lot of complexity once you get beyond the surface level. PHP sessions are not hard. In your "protected page" -you start the session -check if($_SESSION['authorized'] !== 1) { header('location: loginpage..... exit(); This can all be put in a small include file you require_once() at the top of any of your protected pages. In your login script where the code returns that the person successfully logged in, you set $_SESSION['authorized'] = 1; Of course for convenience you also probably want to put some more variables in the $_SESSION at login time, like the user_id, and perhaps the username etc.
  7. The basic mechanics of OOP take a while to learn. Once you learn those, there remains a gap between having OOP as a tool in your toolbox and understanding how to make it work for you. For the most part, where you really see oop is in largish projects (frameworks, complicated applications etc.). I'm sure you've used a library of functions from someone in the past, and purely as a distribution method, oop has advantages for people who have written a library to do something. But in terms of your own understanding, oop is the foundation that enables the implementation of design patterns. There are many books on this topic, so I'd recommend that you take a look at some of those. From what I've read in recommendations from other people there are at least a couple of good ones that tackle the topic in php code. You can also take a look at zend framework or symfony to find examples of the implementation of design patterns. One example that I think helps is the example of an object relational mapper like Doctrine or Propel or Zend_DB_Table. Reading the documenation for these, you will often see reference to a particular design pattern they are trying to implement ("table gateway pattern" or "Active record" pattern). People are used to the idea of making sql queries and getting back rows of the data from a query, and then working with that. With an ORM, you have to change your thinking -- you aren't working with a "row" of data, you are working with an object. Since objects have behavior this leads to code like this: // change name $person = PersonTable::getOneById($personId); $person->firstname = $_POST['firstname']; $person->lastname = $_POST['lastname']; $person->save(); Rather than dealing with functional routines, you're dealing with objects that have behavior. It's a different way of thinking about problems and coding.
  8. To Ken's point, you seem confused about the diffrence between get and post. There's really no reason to be mixing them together. $_GET values come from url parameters .... ?somekey=value&somekey2=value2 Post values come from a form where the method= POST. We have no idea what you are doing or why based on your code, but if you just want to use GET values, you can do that easily enough by having your form use method="get". That will cause all the form data to be turned into get parameters when the form is submitted. These days most people reserve get params for application flow of control (the controller part of Model view controller pattern). Data that you're getting from a user and which you eventually would want to insert is kept inside the post mechanism. Mixing the two, while it can be done, is confusing and not the best practice at all.
  9. The security issue of pages, is typically handled via the use of php sessions. There's no magic however... if you had an existing site which had no authentication/user system, and you pay someone to provide a "subscription" system, I wouldn't expect that those are two things that go together anymore than I'd expect that you'd have a password retrieval system built in. md5() is a hash routine. It takes data as an input and does a 1-way hash that can not be retrieved, however md5 has been shown to have some issues, and in general fallen out of favor. People use sha1 now as a frequent alternative. With that said, when combined with a salt value, md5 does the main thing it needs to, which is to encode values, so they can not be turned back into plaintext. Without a salt there are tables of values that have been generated by people for all sorts of common words and names, so if someone is using "cat" as their password, a cracker with a table of values may be able to take the md5 data that you stored and determine some number of the values, simply by comparing the md5 hash they generated with the one you have. A lot of things have to have gone wrong for this to be useful -- the person exploiting you needs to already have gotten access to your database and the password column, so in general many people still use md5 and it works adequately when a salt value is applied to the hash. Now to put your mind at ease, the md5 calculation runs on the server. When the username/password is gotten from a form it has to get to the server in some manner. Forms typically use the post method. Post takes all the data submitted and passes it from the workstation/browser of the user to the server. The server can't run code on the user's workstation in advance... the input has to be submitted. So the concern about sniffing will be an issue no matter what you do, unless you utilize https://. How the person wrote their code, and where the md5() calculation is done is irrelevant when you consider that sniffing allows people to see any data that is on the shared network, so long as the sniffer is positioned in a place where the data will be passing by. So if someone is using your site in NYC, and your server is in San Jose, anyone who is able to get a sniffer on any network between NYC and San Jose can see the data. An even greater threat than sniffing data these days is the interception of cookies used in sessions that allows someone to man-in-the middle by getting the session token and setting things up so that it looks to the server like you are the same user. My point is that, there is no way to "code around" sniffing. Realisticallly the biggest concern about sniffing comes from kids on college campuses or people using wifi. These days, most people are connected to a switch, and there's no shared network to sniff at their point of entry, so most of the hubub about sniffing is based on wifi hotspots and people jumping on free wifi at their coffee house. At the end of the day, only you can decide what steps you need to take, but there is a reason that your entire bank connection stays within https://. There is a reason why gmail and other sites keep you in https://. The only way you can guarantee that nobody has their session or password sniffed is to used https, and for the most part, those are configuration items that have to do with how your website is setup.
  10. You have to get more specific about your definition of "not working". Do you meant to say that when you use my rewrite rule and you have a url of http://www.yoursite.com/showdetail/id/1 it doesn't work? If you want to pass a parameter that is not the id, that is doable. Typically this is called a slug, but there is no magic to it. You need to create the slug and store it in a column that has a unique index on it, and use that in your WHERE clause rather than the id. You can see an example of this on my blog: http://www.gizmola.com/blog/archives/105-Load-the-Url-symfony-helper-in-a-model-or-form-class.html When an article is entered into the blog, it takes the titlle, converts spaces to dashes, and puts the id of the blog row as the first 3 characters to guarantee uniqueness in the case that i were to write 2 different entries with the same title. The mod rewrite rules pass this parameter rather than the id of the blog entry, although if you employ a similar scheme you could just explode the string on '-' and use the first element as the id. Either way that requires code.
  11. strpos in combination with substr. This assumes that you will have the entire string inside that is currently inside short_message. strpos will get the starting point (looking for 'text:' and substr will use that number to get you the piece of the string that starts there, up until the end of the string. Manual pages at php.net for each should be all you need.
  12. Lookey har, yer code ain't even all that, mein. You gone and done a while loop and inside that biznatch you go all crazy and add a do-while?? WTF? That ain't even right. Pull that do-while outta there, cause that be janky.
  13. Some years ago I implemented this feature for someone using a php library I licensed. There's a list of similar packages of all different costs, but the basic idea for each is the same -- mapping the zipcodes to long/lat and providing radius calculations to determine a result set. http://www.hotscripts.com/category/php/scripts-programs/zip-code-locators/ Here is a free script with database for mysql. The script needs some work, and the data is somewhat out of date, but it would provide you a good basis for the calculations needed for determining proximity. http://www.micahcarrick.com/php-zip-code-range-and-distance-calculation.html It could be that it would be fairly easy to update it using this data, which might be more current -> http://www.populardata.com/zipcode_database.html This dataset has even more zipcodes, so it might even be better: http://www.boutell.com/zipcodes/
  14. Your rewrite rule should work fine, although I wouldn't use show_detail, when you could use showdetail instead. Try this instead: RewriteEngine on RewriteBase / RewriteRule showdetail/id/(.*) show_detail.php?id=$1
  15. btherl's reply brings up some interesting aspects, but I thought I'd expand purely on the question of $this. A class is like DNA. It's not a thing yet, but it's the blueprint for the thing. You make an object using the "new" keyword. $myFoo = new Foo(); So the question in regards to what $this-> does inside class code, is that it represents "this object", allowing you to refer to its variables and methods. At runtime the values will reflect the object that was created by new. Of course you can have many Foo() objects, each with its own properties.
  16. Try this script: echo 'Current locale:' . setlocale(LC_ALL, 0) . " \n\n"; $locales = `locale -a`; echo "Locales: \n\n"; echo $locales; Let me know what the output is.
  17. That loop is going to fill $result as an array with one row of data. Usually you would output it in some way. For a really quick test: var_dump($result);
  18. This topic has been moved to PHP Coding Help. http://www.phpfreaks.com/forums/index.php?topic=326024.0
  19. We really would need to see some code, and a specific example of where your problem is occurring. In particular we would need to see your registry class.
  20. Your form is going to post to it's target, and that script will have the values from the form in the $_POST. Assuming you need to use the post in your query, your results script should just contain or include the query. There is no redirect or intermediary involved.
  21. No there is no advantage to limiting a result set that only has one row in it.
  22. The point is not whether you get error messages from php, the point is that this stuff only works with the proper locales installed, and everything has to match. If the locales are not installed on the server, gettext will not work. It is an extension that makes calls to the gnu library, which has requirements in regards to the host configuration and setup.
  23. Well there's mount and umount, which you should be able to test from the shell. Add those to your script, and you can test for the existence of a file with: #!/bin/bash #mount share here if [ ! -f /mountdir/backupfilename ] then mail -s "Backup file missing" you@domain.com fi #umount here That's about all there is to it. Stick in a cron for this at the appropriate time, and you should be covered.
×
×
  • 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.