Jump to content

kraxzy

Member
  • Posts

    19
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by kraxzy

  1. kraxzy

    Facebook API

    Have you terminated the session? I think it was something like setSession(null) for example ( check out if it setSession, might have it confused with some other API ).
  2. The abosulote easiet.. well that would be via phpMyAdmin -> Export -> [Then choose either CVS for excel or excel file] And that should fix it, as it's easier to use that than coding it from scratch that's for sure.
  3. check out session and information saving with cookies.
  4. Haha kids these days .. how did you install PHP on apache back in the days if not by adding a Addtype and linking to the php engine?
  5. Another way would be to find a promising open source project being developed that meet a lot of the requirements here and go in as a partner company where you bring in additional boost to the project contributing with some in house solutions etc. This way you both could win on it. You get the base that you can try out and evaluate for free, and you contribute with some code that aids the developers sitting there in their spare time. See it as an exchange. Another approach would be actually building your project with open source modules in connection with in house made bridges and realization, however here you would have to check the licenses very carefully for what stands if you would want to profit on application utilizing parts or whole modules of code. Maybe you could get the author or authors to release the same code under another license exclusively to your party for a small royaltee fee / sold application. Which should be a per centage of the asset their particular code brings to the whole product. Otherwise you got two option basically: Do it all from scratch, which means the developement, testing, error fixing, launching, maintance phase; equals a big investement. And the worst case scenario is you reach maintance phase and the application fails to penetrate the market effectively and you are standing there with a big ass negative balance. I'd recommend you to treat it as a regular investment, do the regular investment calculations that'd you do with say buying a new machine versus a used one or leasing it. Make sure you scale it down as you must likely will get a different contribution profit when investigating each investement choice.
  6. You do realize that that would be an immense pain in the ass if you got more than 10 properties that you need to keep track on, not only the names.. but also the order of all of them in the parameters. For large scripts it would be a pain in the ass. Not to mention how the function code would grow in the pace of new properties introduced which would introduce a time complexity that varied depending on the number of properties. I'd suggest you solve it using dynamic variables instead, that wasy you can create generic (not true generic but still generic in a sense) way. I had something similar back when I was taking the PHP certificate and I think I got some bitching for doing it in this fashion, but hey as long as it's valid it's valid, and if you feel as it will make your code look/feel/behave better than check this out: (btw, in your code example you haven't defined what accessibility level your properties have, thus technically you could access them straight by doing $reference->nameOfVairable without any need of getters and setters. However I assume you meant them being private as you got a set function ) <?php /** * Forum example @ killersites.com * 2010 * * Exempel: PHPClass * @author Kraxzy */ class PHPClass { private $height = "short"; private $weight = "skinny"; private $age = "young"; public function universalSetter($varName, $value){ $this->$varName = $value; } public function universalGetter($varName){ return $this->$varName; } } //Test $t = new PHPClass(); echo $t->universalGetter(($name = "height"))."<br>"; echo $t->universalGetter(($name = "weight"))."<br>"; echo $t->universalGetter(($name = "age"))."<br>"; $t->universalSetter(($name = "height"), "tall"); $t->universalSetter(($name = "weight"), "heavy"); $t->universalSetter(($name = "age"), "old"); echo $t->universalGetter(($name = "height"))."<br>"; echo $t->universalGetter(($name = "weight"))."<br>"; echo $t->universalGetter(($name = "age"))."<br>"; ?> this will output: short skinny young tall heavy old Thus it's changed and works. Voilà!
  7. How will you prevent the buyer from just ripping the code that is supposed to connect validate then turn the exec off? Only way I see you doing this is by hosting it on your server. Unless you are planning of having each page encrypted then having the server decrypting it via a key they only can get from your server when and if they are validated by your server... if so then make sure it's a key that changes, But then again it would mean that each page of code would be one connection to your server.. so make sure that doesn't create loading time and angry costumers.
  8. Actually the code would be very similar, but the way about how you go around coding it would differ. As it's another mindset really. Here you would for example solve it in a oop way of thinking, what kind of objects would I need to fulfill this task? Well I need a page, so maybe a page object would be needed.. Then I need an object that keeps track of my different pages maybe so a page-controll, maybe a specific object that acts as an interface dealing with user input, maybe I want more generic page objects thus I make an special interface that the database interacts with.... and so on. Then maybe some helper objects and some task-specific objects that utlize the generic objects into solving your task. So you might ask but that's a lot more memory and resource consuming concept.. the answer is yes it is. However in larger projects it really works well, as you encapsulate most code into classes and create packages wich only work to solve special task. And if you code well you will have a lot of generic classes and packages that you then can reuse in other projects. In your example you have project specific code, you got code that only works in your project, you wouldn't be able to pull that example code and use it in another site without having to recode at least the sql part. In a good OOP solutions you would be able to just copy every non project depended class and just write the ones missing saving you time. Now this is a small example and you can't really see the benefit as you can justify just switching the small ammount of SQL depended code, but think of thousands of lines of code and hundreds of files of function libraries etc, and in some degree you always get nested code that go back and forth which would mean a lot of changes and pretty horrifying to move and readapt on a completely new project. I've been involved in such projects, they were a nightmare and at the end of the day you had to recode most of it as it many times was faster to just code it again than having to go around looking and collecting the dependencies in different files. Now all of a sudden the OOP solution would have been a gift from god, as you would just pull the packages needed for the core and behavior and any other task specific class. Then instantly proceed with coding the project specific classes and you are done. And at that time you would also have a good knowledge of the object functionality in house, or at least a good documentation a long with code that has already been proven to do it's job well in previous projects.
  9. grab netbeans, it's free and delivers a lot of the features that the costly applications also do. With the distinct difference that that netbeans will not force you into a negative economic phase.
  10. Yes, in OOP circumstances there are two key concepts, behaviour and properties of the object. The properties in php would be things as the variables, constants etc, and the behavior would be the way it acts through the interface available with which you communicate with the object ( in short the functions available). Also key is to really grasp the distinction between a class and an object, as these are not the same, a little deeper knowledge here is neccessary in order to really be able to write good code. Object is an instance of a class, which could be described as all unique properties and behavior to that individual set living in the memory, whereas the class bound properties and behavior would point to the same areas in the memory always during the run, thus are not a part of the object. In short this means that a part of an object are properties that change (aka variables, and functions using these) they are unique and have unique storing adresses in the memory, thus you have to create an instance of the class in order to get to use these properties and behavior. each instance of the object becomes an independed identity in memory. Wheras constants, static variables and functions, are class bound, and not object bound as they never change they are by nature constant throughout the code run. Making these values unique would be a waste of resouces. So they are only a part of the class and not of the object. They are also auto loaded into memory thus making them available without creating instances of objects. So to remember; properties, behavior, the difference between a class and an object.
  11. kraxzy

    A login method

    I'd let the webserver handle the uphold of banned users, and spare the server of having to do extra database lookups.
  12. It means exactly what its name stands for. If I say to you like this, how would you classify this batch of code? Well you would look at the behavior of the code, and what another batch of code would see and be able to get to if using it. And you conclude: (for example) Aha! it has all the functionality and behavior needed to classify it as an account, or vehicle, or human or maybe something else. Thus it must be that thing! If you can classify something as X, it is of class X. I can classify you as a human thus you are of class human. And this is the key element of OOP, encapsulation of code, NOTE code that describes and adds functionality that object should have to be classed as such. So if you for example want to create an object with the functionality of a airplane, and you end up with something more resembling a bicycle, then you have failed with the classification. You can then create your own classes, let say you want to call everything that has this behavior and this functionality for a BUMP, then you can write a interface describing this new object and what is needed and expected from such a class of objects. Once you get into the OOP mindset, it becomes almost strange to think about it in a procedural matter.
  13. It's called IP.Board 3 a quick google should show be enough to find this particular set of forums that killersites is using. But it's not free.
  14. From the go php engine doesn't allow direct access to it, if it hasn't been redirected by the webserver. However there are often other codes in combination that we tend to use that unwillingly impose threats very easily used by people with bad intention. Let say you got any other php function utilizing the eval() function, like include, ínclude_once, require, require_once and so on. What you then do is, generate a server side error getting the php version if lucky, or spend some extra time getting hold of that, google all known code inject vulns associated with eval() php for that version and down. And as often is the case you the vuln is still active on so many places. Then simply load in your own snippet of code among the stuff already there. And lets face it too many are using includes without securing basedirs and basepaths. Thinking anything is secure is a wrong move, you need to assume everything is unsafe and take every possible step in preventing it from being easily taken advantage of. I assume you guys have at some point taken the PHP certificate, just remember the security part of it, pretty much all the things you should look out for is still around today.
  15. kraxzy

    PHP image caching

    Yes it's called dynamic programming and used a lot in other languages when it comes to reducing the memory and time consumption of recursive methods. Which basically means that you keep a list of operations that you've already excecuted, a easy example would if you already had 2 and 2 and the code is calculating the sum of the provided entries, you check your list if you already had these, and if so fetch the result instead of redoing the calculation ( note that this is a basic example where having a dynamic solution would be useless for something trivial as occasional addition operations ). So you could solve it in a similar fasion, where you store the images for some time, let say if the same image hasn't been generated again within 24 h or something like that you take it away from the list ( as you need to make sure that having a list, and searching in it won't give you a greater time complexity than generating the images in the first place ). Then each time a user specifies the data you check the list if this set of data already has been generated, if it has just smack up the link to the saved image. If not generate it and add it to the list. Then just add a cron job that flushes the unused data at a time where the server isn't busy.
  16. A quick note, if you are gonna use this live on the net, please spend some time making the code more secure. A potential black hat would nail the variablename and the value within his/her first tries of variable injections, which would bypass your security rendering it useless.
  17. kraxzy

    OO PHP For Beginners

    OOP is just a mindset and coding technique, it's no different from the regular procedural php coding you've been doing up until you encountered OOP. I'd recommend you to google and read up on OOP mindsets and thoughtprocesses as with many php OOP guides they focus more on the fact that this is only a different syntax over the more important fact that this is another thought process. So what I would recommend is that you take some of your old projects, rethink how you best could solve the same project using OOP coding techniques and doing it, sure in almost all cases it will mean a lot more code and memory allocations, but hey you are learning so it's worth every singel frustrating rage that you will get doing it.
  18. kraxzy

    Session "security"

    No suhch thing as safe, but you can make it a lot harder and more pain in the ass for the theif to maintain the session. A quick google for things like; php session tokens, seesion timestamps, session validation, secure sessions. Or you could go the better way of actually learning all the techniques of stealing sessions, that way you yourself will know while coding how you could take advantage of your own code thus automatically code in preventive messures while coding. Which I also recommend anyone who is going to attempt doing systems where theft can pose great harm, as you don't go about coding user auths without knowing about the darkside.
  19. The function, PDF_get_buffer() can only be used when you are writing a file to memory, and not to a physical file as you are doing now. That's why you get the error "Don't fetch buffer contents when writing to file". It would be strange if you didn't get the error in your case.
×
×
  • Create New...