Jump to content

benanamen

Members
  • Content Count

    1,783
  • Joined

  • Last visited

  • Days Won

    32

Everything posted by benanamen

  1. benanamen

    php session variable html not rendering

    Yeah, I finally figured out what the op was trying to say. Post was not worded very well. I edited my post as you were posting.
  2. benanamen

    php session variable html not rendering

    I think I misread the post. The redirect is obviously not right, but what html is not showing up? You mean your not seeing the usrMsg in the source? You have already unset the variable so it's not going to be in the source.
  3. benanamen

    php session variable html not rendering

    Problem is single quotes vs double quotes. $_SESSION['type'] is echo'd with single quotes and therefore will not interpolate the variable.
  4. benanamen

    Return image after If statement

    As a fresh noob one of the very first things you need to learn before writing any code is how to turn on and display errors. If you had done this PHP would have told you what is wrong.
  5. benanamen

    Can't change color of a field

    You have numerous basic errors. You are missing a period before the RED css. You are also missing quotes on your row variables. If you had error reporting turned on you would have known about that. If you used single quotes in your html strings you wouldnt have to do all that escaping. The center tag is obsolete. You will also get an error with your row[id]. It will need to be {row['id']}. If this is not for tabular data, then don't use tables
  6. benanamen

    preg_match in statement

    OP, tell us what the real problem you are trying to solve is instead of your attempt at solving it.
  7. I agree with @ginerjmm, learn PDO instead. This tutorial will get you going. https://phpdelusions.net/pdo You can also download my PDO Bumpstart Database. It will help you get going quickly with the basics. https://github.com/benanamen/pdo_bumpstart_ver1.6
  8. benanamen

    DB query not working

    For starters you have several mismatched curly braces. If you used a proper IDE you would spot basic errors like this right away. I would also suggest you learn one of the standard code formatting styles and stick to it. You also have a substantial amount of duplicate code. DRY - Don't Repeat Yourself.
  9. benanamen

    help with sign up form error

    Stop what your doing! You are using obsolete code that has been removed from PHP. You need to use PDO. This tutorial will get you going. https://phpdelusions.net/pdo
  10. benanamen

    Check if username already exists

    Your your logic is incorrect. You do not check to see if the user already exists. You set a unique constraint on the username column and then attempt the insert capturing the duplicate error if any. Your method will create a race condition.
  11. benanamen

    help with writing a web crawler with LWP

    You do realize there are at least seventy thousand, two hundred other tutorials on how to write a web crawler in LWP right? This is also a Php forum. You might want to post to a PERL forum if the other seventy thousand, two hundred tutorials are not of any help.
  12. benanamen

    PHP sessions

    Sessions will work just fine but I would first suggest you rethink the multi page idea. What you want to do can be done in a single page and including the other pages when required. It would be much cleaner.
  13. benanamen

    Get Current Directory Errors ?

    I guess you also forgot you are supposed to check the REQUEST METHOD and not the name of a button.
  14. UIMan, I am seriously trying to have patience with you even after all these years, but c'mon man. Error message says it is expecting an integer. The error message is more than clear what is wrong, STRING GIVEN. Do you really not know how to create a variable with an integer as a value? Even a blind man can see the answer to this VERY simple first day in Php problem.
  15. benanamen

    Get Current Directory Errors ?

    UIman/phpsane, after over two years you should very well know that Php runs from the top down and that you need to check if there was a POST request before your processing code code runs. undefined index errors are first day in Php noob errors. After all this time you STILL cant grasp the most basic of basics. Truley unbelievable!
  16. benanamen

    PDO Update

    As far as picking a tutorial, it is one of the "better" ones, mainly because it uses PDO. Nevertheless, you still need to learn what the code is actually doing to know if there are any potential issues. The tutorial I linked to will give you a good understanding of using PDO. The rest will come with experience along with our feedback. I think it's safe to say we all prefer to help you with code YOU wrote instead of trying to debug some third party code copy/pasted from the Internet. Just keep at it. We were all beginners at one time. 😀
  17. benanamen

    PDO Update

    This Should be if ($_SERVER['REQUEST_METHOD'] == 'POST') Here is a tutorial to get you going. https://phpdelusions.net/pdo
  18. benanamen

    PDO Update

    There a few problems with that tutorial. The code (including your post) has been littered with try/catch blocks and exposing internal system errors to the user. PDO exceptions should be allowed to bubble up the stack. PHP handles it quite well. You can use set_exemption_handler if you want to do something custom. Outputting Internal system errors is only good for hackers. Also, the script depends on the name of a button to be submitted in order to work. That will completely fail in certain cases. You need to check the REQUEST METHOD. The code has also built in a race condition on the registration by checking if a username is available first. The insert should just be attempted and then capture the duplicate error if any. This is the one place where it would be OK to use a try/catch block. It also exposes specific username/email error messages that are a security risk. The script keeps running after redirects. There needs to be a die or exit right after the redirects. There are probably more issues as well. On the plus side, it uses PDO.
  19. Awwe c'mon, phpsane/forumcoder/uniqueideaman/uiman has only been at this for over two years. You cant expect him to know the basics yet.
  20. benanamen

    PHP Update Prepared Statement Script Help

    You are missing the closing bracket for the try and you are missing the catch. Looks like you are mixing up Mysqli and PDO. Perhaps you should study this PDO tutorial. https://phpdelusions.net/pdo
  21. benanamen

    PHP Update Script Help

    This is some very poorly written and dangerous code. You never ever put variables in a query. You are wide open to an SQL Injection Attack. PHP_SELF is also vulnerable to an attack. You need to use Prepared Statements and get rid of the action altogether for starters. And stop outputting internal system errors to the user.
  22. benanamen

    Uninitialized string offset

    Perhaps you should look again... Source: https://github.com/pricing Bitbucket is FREE as well, https://bitbucket.org/product/pricing FREE Signup https://bitbucket.org/account/signup/
  23. benanamen

    Uninitialized string offset

    Posting to GitHub is not a requirement. It is also FREE for public repository's. You can also use Bitbucket if you want free private repositories. As @mac_gyver said, you can also attach a zip of the project files. We are now at TWENTY-TWO posts and counting and still no further than the first post. Are you starting to see what I said about an endless thread?
  24. benanamen

    Uninitialized string offset

    You can describe what you have all you want. If we cant see the code for this case this is just going to be an endless thread like I said. We are now SIXTEEN posts in and you are no closer to an answer than the first one. I told you what you need to do. If you refuse to provide what is asked of you then you are just going to have to figure out the problem yourself. Despite our many years of expertise, we do not have magic crystal balls and we cannot see your screen. Since you do not know what code to provide you need to provide all of it. GitHub is the simplest way for us to review a lot of code easily. The problem at hand, is you do not know the problem at hand and neither do we.
×

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.