Jump to content

gizmola

Administrators
  • Posts

    5,945
  • Joined

  • Last visited

  • Days Won

    145

Everything posted by gizmola

  1. gizmola

    onclick

    Because PHP is serverside, not clientside. Javascript is clientside. The only way you can have functionality like this (call a serverside script based on a a clientside (javascript) event occurring) is to implement the serverside functionality in a seperate script that you make an ajax call to using a get or post method.
  2. Huh? If you have the url to an image, you can access the image. I'm not sure I understand what you are trying to say here AyKay... Of course I'm not clear on what the OP wants. I thought he had an xml feed of some type and just wants to get the img url that's contained in the CDATA.
  3. Techmate: What we try and do here is teach people how to develop websites. We're not a script finding service. Google, Hotscripts etc. are your alternatives.
  4. You are in the right direction, but the question is: is this a nested hierarchy (tree)? That is tricky. What is the structure of a single row you're fetching and how does $row['category'] relate to $row['subcategory']?
  5. This is what you are looking for: http://en.wikipedia.org/wiki/Combinatorial_number_system You can use "Combinadics" to help you. There is an article about solving this problem but unfortunately it's c# code, but at least the problem and solution is layed out with code: http://msdn.microsoft.com/en-us/library/aa289166%28v=vs.71%29.aspx You'd have to port it.
  6. Your assumption is incorrect. A key in an array is unique. If you do this: $foo['mykey'] = 'Apple'; $foo['mykey'] = 'Grape'; echo $foo['mykey']; What do you expect the output to be? The only way you could associate multiple "things" with a key, is to use a nested array: $foo['mykey'] = array('apple', 'grape', 'banana'); var_dump($foo); $foo['mykey'] = array('fruit' => 'apple', 'entre' => 'pb&j', 'drink' => 'milk'); var_dump($foo); Arrays in php are very flexible and easy to work with once you understand the syntax of how to do certain things. If there's something you don't understand how to do, please ask.
  7. Client side validation can be done regardless of the data type. That is not relevant or an argument for storing a date in mysql as a string. You didn't present a single benefit to storing things as a string. In terms of database query performance, flexibility, and storage requirements, I listed a series of problems using strings, and benefits to using a Date type. Should we then assume that you aren't really able to pinpoint any advantages to storing a string other than that a string will store invalid dates? (Which is a benefit in what way?) It's fine to do something because that's what you know, but you'll be a far better developer in the long term if you open your mind to alternatives, and research and consider different ways of doing things. Preferring to do something a particular way because that's all you know, is not an argument in support of your opinion.
  8. Based on? -A MySQL Date requires 3 Bytes of storage -You can do Date arithmetic inside mysql (search for dates within ranges) -It intrinsically will only store valid dates -You can format it in numerous ways -A string will require minimum 8 bytes, or 10 with seperators -can't do any form of range queries -can't format it in SQL -will allow completely invalid dates
  9. This is using apache mod_rewrite. Whether or not the rules go into a .htaccess file or not, is related to your access to the server. For many people, they don't have access to change their apache config, but rewrite rules can be placed directly in the apache config files for a vhost. This is using apache mod_rewrite. Whether or not the rules go into a .htaccess file or not, is related to your access to the server. For many people, they don't have access to change their apache config, but rewrite rules can be placed directly in the apache config files for a vhost, so it's a bit misleading to say that this is done by htaccess. htaccess is just a file that apache can be configured to read which allows you to override default settings for files in that directory -- one of the settings being mod_rewrite rules. mod_rewrite utilizes in most cases regular expression syntax. The Link Zul provided does a pretty good job of laying out a number of different uses. As you can see from that page, mod_rewrite is a toolkit that facilitates SEO friendly url's but can be used to do a number of other things as well. The problem you describe is related to your rewrite rule(s). If you're having problem with a specifc set of rules then you might want to post them and ask for help.
  10. In your example, then the way to do that would be in firstclass to have doSomething call the parent method first. function doSomething() { parent::doSomething(); $secondline = " World"; }
  11. No, you just need to use a combination of array_pop and array_unshift in one direction and array_shift and array_push in the other.
  12. The best way in mysql is to use a mysql DATE column.
  13. In cases like this I often do a little test script: for ($x=1; $x $input = rand(); $uniq = uniqid($input, true); echo "$x. [$input] ($uniq):". md5($uniq) . " \n"; } Run it a few times and I'm sure you'll see that even the md5() of uniqid by itself iself based on rand() there is really very little reason to be concerned about a duplicate code. Adding the email addy is icing on the cake, but I'd still do it myself personally.
  14. MySQL has a SET column type. http://dev.mysql.com/doc/refman/5.0/en/set.html As far as I'm concerned the SET type violates basic relational database rules of normalization, as it is essentially a repeating group. With that said, if you're dead set on using it, it does provide an answer. I've also seen people store a comma delimited string as a varchar, and even seen people store the data in a varchar or text, in json format. There's a few solutions, but just know in advance that if you want to query for rows that contain specific values with one of these schemes, retrieval is going to be very slow if the database is at all large, because you will have to read every row, parse the values up and determine whether or not the row contains the value(s) you are looking for. A normalized design does not have that problem.
  15. Looks good. You don't have to make string variables ($style1, $style2) just to use them in the ternary, you could just specify those same strings in the ternary. $bgstyle = ($i % 2 == 0) ? 'style1' : 'style2';
  16. There really isn't much of a problem with the md5() of the uniqid, other than the possiiblity that someone, who knew what you were doing, could try and generate an activation code that might match some random person. With the email added as extra input to the md5() that just eliminates the possibility of that happening. I think the original author probably combined them because you could guess an email address of a pending user, or generate an auth code, but generating the auth code for the exact user is next to nil. Adding the email as input to the md5 essentially does the same thing. This is why when people generate md5 or sha1 hashes for passwords the recommendation is to add a "salt" in, which is extra input to the hash function.
  17. What do you have so far? That example doesn't even have a valid link in there: .... What is that?
  18. Yeah i would have to agree that what you are trying to do is reinventing a PKI. We've had similar threads from people. Browsers already support certs. You can build even better authentication around what is already available, and insure end to end security and encryption of all data without a kludge. Check this out as a jumping off point for more research: http://cs.uccs.edu/~cs526/secureWebAccess/secureWebAccess.htm
  19. Yes the $activationCode will be unique, because it's based on http://www.php.net/uniqid. The md5() is just a little extra obfuscation in this case, but it makes the prospect of someone guessing a working signup to be miniscule. However what you could do to make it even more unique would be this: $activationCode = md5($email . uniqid(rand(), true)); I think that is what the original author was in essence trying to accomplish, but it's better to just add the email connection into the authorization id by adding it as additional input to the md5() hash. For the purposes of making the database lookup fast, you should have an index on that column of the member table as well. I'm not sure why the original author included email, but it's very unusual, and in terms of security, it makes this less secure, because you are disclosing the original user's signup email in the link, and there's no benefit to that. I'm sure you've done plenty of activations for accounts you use, and if you look at them, I think you'll find that the inclusion of an email parameter is highly unusual.
  20. I forgot that they rebranded it as Vuze. http://azureus.sourceforge.net/
  21. The answer to that is to use https: if you don't want that plaintext going over the internet. In the realm of security concerns an activation isn't a major one, as long as you handle it correctly. Here's my advice FWIW: -Rather than null or blanking an activation column, I think it's better to have a status column in the table, where you do something like: 0 - Banned 1 - Pending 2 - Active Someone who just registered would be at status 1. A status 1 user can only do one thing - activate. This is useful because you can allow a limited login that simply takes them to the activation page. - I don't see why you need to pass the email as a parameter, when you can simply pass the activation code. That could should uniquely identify someone since you're storing it in their user row. - Time limit the activation. Have a datetime or timestamp column you put in the user row when registration occurs. Use that to time limit an activation to some reasonable amount of time (24-48 hours). - If someone activates, change their status. When someone is already active there is no need to ever honor a reactivation, so your script can safely ignore a replay.
  22. Looks like a good start with the UI. I'm sure people here will be happy to alpha test for you when you have something ready. I don't really like the name P2PMovie for a couple of reasons. First off, a lot of content is not movies. Also I think that P2P has a bad reputation these days. Try and pick a name that you can trademark. If you think about spotify, as your original reference point, there is perfect case study where the name doesn't include music, cloud, streaming etc. or anything else about the tech involved. For it to be successful you have to expect that your userbase will not be entirely techies, and all the tech jargon ends up being is a turn off. I don't know if you have ever tried out the bt client Azuerus, but it has a lot of the same features you're planning, and it's a very mature application at this point, although it's written in java. Definately check it out for ideas.
  23. No you can't reference another domain in a domain zone file using CNAME. CNAME lets you point to an ANAME for the same domain. However there is no problem having multiple domains point to the same IP. Every shared host in the world is doing this, using apache and the httpd 'HOST" header, which is what shows up in the HTTP_HOST. The key here is that apache must know to handle the domain. It looks at that same header and attempts to match it up with a vhost. This can be done, but you need to to have apache configured so that it will serve vhost content for that domain. I think this is what the hosting company is trying to tell you. YES you can serve the same vhost for multiple domain names, but you have to tell apache to do so.
  24. All errors like that indicate you have a syntax problem. In this case the $query = mysql_query.... line above your echo doesn't have a closing semi-colon. So the "echo" on the following line is "unexpected".
×
×
  • 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.