Jump to content

Strider64

Members
  • Content count

    245
  • Joined

  • Last visited

  • Days Won

    1

Strider64 last won the day on April 28 2014

Strider64 had the most liked content!

Community Reputation

13 Neutral

About Strider64

  • Rank
    Advanced Member
  • Birthday 08/28/1964

Contact Methods

  • Website URL
    http://www.pepster.com

Profile Information

  • Gender
    Male
  • Location
    A burb of Detroit, MI
  1. Strider64

    Checking variables

    Not to harp on it, but my IDE (Netbeans) is always flagging me to use === instead of ==, so it is rare that == should be used. I think the only time I had this come into play (==) is when I was developing an online php calendar and even then it was used very minimal. There are a lot of times a person who is typing on a fly that typing = will be very easy to do. I agree you should use == when should it is actually called for and I don't see many cases where that comes in play. Though using a good IDE is better than using an old trick, but in this case I can't see where this particular old trick will lead a person astray until he or she is better knowledgeable in PHP. I know one instance it actually got me to slow down and think when I saw $row = $stmt->fetch(PDO::FETCH_OBJ) in a while loop and realized that was supposed to be like this when I first started learning PHP.
  2. Strider64

    Checking variables

    Someone told me an old trick on another forum (He passed away about a year ago) to use === when doing a comparison that way if you accidentally type == it will still work. Very rarely will you have to use == instead of === (or vice versa) and just remember the === operator actually checks to see if the left and right values are equal, and also checks to see if they are of the same variable type (like whether they are both booleans, ints, etc.). The == just cares if both the left and right values are equal.
  3. Strider64

    Secure Login and Page Thesedays

    I'm in the process of redoing my login scripts to add better security and I will eventually post it on my Github account (https://github.com/Strider64) as a repository once I have it working. With that said I would check into password_hash() http://php.net/manual/en/function.password-hash.php and password_verify http://php.net/manual/en/function.password-verify.php this takes care of encryption and salting for you.
  4. Strider64

    Suggestions for OOP CMS

    I use forums like this to avoid writing obsolete PHP code and there are a lot of obsolete tutorials out on the web. Jacques1 I find will help a noob from wasting his/her time by writing bad PHP code. I find going to the latest edition of a PHP Book is the way to go when learning PHP and PHP OOP. I have found Larry Ullman to be a good author to bridge the gap between procedural and OOP. I also find having a strong grasp of HTML/CSS helps out tremendously before even attempting PHP (procedural or OOP), for if you don't then your will struggle with PHP. It also helps to have basic knowledge of a programming language even if it is basic. I think my very first programming language was Fortran in college in the early 80s. For all programming language have the basic programming structure (if statements, loops, arrays, etc...). I'm finally getting the handle on PHP OOP myself, but I don't even consider myself an expert. I would probably go as far to I'm at advanced level, but even then there are times I have my doubts that I'm even that. My point is the goal of writing OOP in my opinion is to have classes that are very portable from one web project to another without have to change anything in the classes or very minimal changes. I have this one class Calendar that I have develop that I simply move over to the current project and the only thing I have to change is the CSS. The classes will also save you a lot of unnecessary code in your projects and save you time in the development stage. A lot of people just learn the minimal amount of PHP OOP and use a framework to do the heavy lifting. There's nothing wrong with that for you're not reinventing the wheel and there are even times employers demand that you use a framework. I personally like writing my own PHP classes and I work for myself so I have that luxury. I also found after obtaining a Graphics Designer degree in computer technology that people critiquing you or telling you the truth is way better than someone sugar coating it because they are afraid of hurting your feelings. I found asking family members or friends is the worst thing you can do when it comes to this. Just my .02 cents.
  5. Strider64

    calendars wtih hours

    I developed a calendar in PHP that uses namespaces here that you could use -> https://github.com/Strider64/Website-Development/tree/master/src/Calendar or you could use Google Calendar (I think) that I hear is pretty good. The rest is just manipulating the calendar with Javascript.
  6. Strider64

    Namespacing and PHP.

    This link might help you out -> http://phpenthusiast.com/blog/how-to-autoload-with-composer HTH John - I know it did me, for before this I was using my own crazy autoloader and it should make my GitHub repositories more standardized.
  7. Strider64

    Captach Image Help

    Google's reCaptcha is pretty nice and easy to use -> https://www.pepster.com/contact.php I like using it for it save me from coming with my own and I can move onto other PHP scripts.
  8. Strider64

    Login button not working -- Brand new to php

    I like this link https://phpdelusions.net/pdo, but I don't agree with everything they write. However, for the most part it's very informative and won't steer you wrong. (In my opinion)
  9. On points number 1 & 2 .....why not just have security levels for the admins? It would be easier and make people happier than blocking users by country? Heck, you could only have a only member site that way you can control who has access or not to certain pages. Think of it as having a green jacket at Augusta's Country Club (The Masters in case people don't know golf).
  10. Strider64

    Bracket Question

    I agree with ginerjm. I just wanted to add Radio Buttons can have only one value in the first place, so I don't even know why you are using an array? Unless all of the $id is going to be the same? An if that was the case there would be no need for an array for you are using Radio Buttons. <div class="radioBlock"> <input type="radio" id="radio1" name="reason" value="support" checked> <label class="radioStyle" for="radio1">support</label> <input type="radio" id="radio2" name="reason" value="advertise"> <label class="radioStyle" for="radio2">advertise</label> <input type="radio" id="radio3" name="reason" value="error"> <label class="radioStyle" for="radio3">Report a Bug</label> </div> However, I really don't understand what you are trying to do, so onward..... An to use an array you would in a form you wouldn't use $id, you would do something like: <input id="example" type="radio" name="use_item[id]" value=""> and this is how I retrieve it using php: $data = filter_input(INPUT_POST, 'use_item', FILTER_SANITIZE_FULL_SPECIAL_CHARS, FILTER_REQUIRE_ARRAY);
  11. I personally would concentrate on getting PHP with PDO acting right, before moving on to JavaScript/jQuery. It's relatively easy to add client-side script later and at the same time you'll have graceful degradation with the scripts. Myself I find if I have too many layers (I'm talking about coding) going on at the same time I get easily confused, but it could just be my old age creeping up on me. Just my .02 cents. BTW JQuery is easy to implement Ajax but plain vanilla JavaScript isn't that much harder. For example this is a little bit of the coding of a trivia game that I'm developing.. function insertNew() { var addform = document.getElementById('addTrivia'); var action = 'add_trivia.php'; var fdata = new FormData(addform); // for ([key, value] of fdata.entries()) { // console.log(key + ': ' + value); // } var xhr = new XMLHttpRequest(); xhr.open('POST', action, true); xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest'); xhr.onreadystatechange = function () { if (xhr.readyState == 4 && xhr.status == 200) { var result = xhr.responseText; console.log(result); var info = JSON.parse(result); console.log('info', info); if (info.result) { document.getElementById("addTrivia").reset(); function closeit() { document.getElementById("shadow").style.display = "none"; } if (info.result) { document.getElementById('shadow').style.display = 'block'; setTimeout(closeit, 2000); } } } } xhr.send(fdata); } done in vanilla javascript. Though I agree jQuery is easier to use for Ajax.
  12. I personally don't like protecting code to begin with and here my reasoning. I used to work for auto paint manufacturer that bought this really expensive software package from a company that heavily protected their code (though they did have tech support that they paid for), if the people in charge (the IT department) running the software even had to make a simple change to the software package they had to had the company do it. To make a long story short, the company that sold us the software package went bankrupt and left us up a creek without a paddle. Even though they were going out-of-business they still wouldn't unprotect the software claiming they still had held the rights to to software. So here we are with an expensive digital paperweight and having to fork over more $$$ to another company. My memory is a little fuzzy but it was so specialized piece of software that the competitors would have to write it from the ground up thus costing us money for the downtime and/or praying the software that we would currently using would hold up until the replacement could be up and running. Anyway, my point is that you being a small company (while you probably won't go out-of-business) are probably specializing in developing software that for most part isn't going to be freely distributed to other companies unless it's a game or a general application then like someone stated you don't have to give them the php file though that presents a minor problem (that also stated). I know from personal experience being held hostage on a software package is a negative experience. Besides the company went to you to write the software for they didn't want to take the time to develop themselves for they have other priorities. Like in my case we were making paint for the automotive industry and my specific job was matching the color to customer's (auto companies) OEM color standards. The last thing I wanted to do is figure out how that software work.
  13. Strider64

    Best practice for passing data to db class

    Well, if you are GETTING then you can just easily SET the data. If you set the data then you can easily save the data. Doing it this way class userModel{ private name; private email; /*lots more properties for user */ public function getName(){ return $this->name; } public function getEmail(){ return $this->email; } } would be more secure in my opinion.
  14. Strider64

    Array results to select option

    A side note, most people get annoyed entering (or choosing) more than 8-10 fields on one page, so if the form is huge with a lot of input fields it is best to split the form and have it on multiple web pages. So that might give you an idea if you should separate the code in a separate file?
  15. Strider64

    Basic Registration form

    It's still a work-in-progress but I'm developing a registration and login tutorial and you can find it here: https://github.com/Strider64/php-registration-tutorial The registration portion works (though I want to rework it a little) and I need to do the login portion of the tutorial. All the files can be found there.
×

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.