Jump to content

gizmola

Administrators
  • Posts

    5,878
  • Joined

  • Last visited

  • Days Won

    139

Posts posted by gizmola

  1. Mail was designed to inject outgoing mail into the system MTA (mail transfer agent).  Thus it has no visibility into deliverability.  SMTP (the mail transfer protocol) has no insight into this either, unless the smtp connection is rejected, or the mail server returns an error message.  From the php application standpoint, it just knows it dropped off mail at the post office. 

    This is why libraries like phpmailer and symfony mailer were created, as they are designed to handle more of the process.  Sending email with even a modicum of deliverability is a non-trivial task, which is one of many reasons why there are companies that take care of a lot of the problem.  The mail libraries listed are also suited to integration with many of the popular remailing services (mailchimp, mailgun, sendgrid etc.)

  2. On 10/17/2023 at 4:24 AM, ginerjm said:

    Can you SHOW us the code for the 'Events link' so we can at least try and help?

    Indeed, typically there will be variables, and images and other assets will be referred to using variables, that might even be read from the database.  There's a lot of different possibilities.  Without specifics, people are just guessing.

  3. In general, this would be called provisioning. 

    For the most part, this requires that your application have an underlying architecture that supports this.

    In terms of DNS, you can set up a wildcard DNS entry for *.myapp.com.

    Internally, your application needs code that accepts a request, examines the requested url, extracts the subdomain, and executes the routing accordingly, or you can also have a rewrite that will look for subdomains other than 'www' and rewrite those to https://myapp.com/shop1.

    When a new user creates a store, you will run provisioning code in your application that does any required setup (make new database user, create database with new user assigned rights, save credentials in user profile configuration file or in database.)  There are strengths and weaknesses to each approach so you have to consider the tradeoffs and security implications of each approach.  For example, you could just use the primary database access user, and not create a separate database user for each customer database.  There isn't one right answer for each application.  

  4. In general, functional testing of web apps involves some sort of tool that can either simulate a browser (Codeception, Testing Library)  or integrate with one (Selenium, Watir).  They are specifically built to deal with browser clients.

    For testing of CLI programs, there aren't a lot of options out there that I'm familiar with, but one that you can look at is cli-testing-library  

    Confusingly there is another library worth looking at with the same name.

    Either library should allow you to write and run functional tests for the outcomes you described, but also provide ways for providing input, options and interaction.

    Let us know if one or the other worked out for you. 

  5. On 9/25/2023 at 9:36 AM, requinix said:

    People typically don't like downloading attachments and having to sift through code looking for something. Especially when it's not clear what that "something" needs to be.

    What's the relevant portion of the code involved? And in case it's not obvious from reading it, what do you mean by adding another option?

    100%.  I'm not sure that people will help you hack your custom plugin, but it's not like it's never happened here previously.  

    There' s no guarantees, but what I can tell you, is that you need to:

    • Explain what the current plugin does (with relevant examples).
    • Explain what you want to have changed
    • Provide relevant code snippets based on your examination of the code
    • Explain specifically what "did not work" in your attempt to modify it yourself, with any errors or debugging 
  6. In general, people with a substantial investment in microsoft server infrastructure will use a product built to run on the microsoft stack you mentioned. 

    The only oddity in the ERP you found is that it was built for Oracle.  I know I'm glossing over Postgresql, but in general, when you see this as an alternative, it's because Postgressql has a high degree of architectural and syntactic similarity to Oracle, so that it is often used as a substitute, to save on licensing costs.

    Here are the stack combinations I see most frequently:

    Java/Tomcat/Glassfish/etc/Oracle(Postgresql)

    Nodejs/MySQL/Postgresql/Document DB's

    Apache/Nginx/php-fpm/MySQL/Postgresql

    IIS/.NET/Sql Server

    You began this thread with the claim you wanted to find a PHP based solution.  PHP has no relationship to .NET/ASP etc. and vice-versa.   

    ASP is microsoft's framework for building web applications.  PHP is not related or an option.

    With that said, in general ERP's are closed systems, that will provide configuration options, and some sort of api for integrating with other systems.  Sometimes integration options are driven by the underlying platform, but usually people are more interested in the features of the ERP and how it will meet the needs of their existing business. 

  7. Barand as usual offers an expert solution.  

    Looking at your original schema model, please don't include a prefix for the table name like q_column etc.  

    Also don't use Enums.  They violate a basic tenet of relational database theory (any field/attribute in a row should contain a single value).  If you really want category and type, those are foreign keys to separate tables.

    In cases where the PK is a char, I will tend to name that column "code", just to be clear that it's not a sequential key.  For example, I often have fairly static type tables, like "status" where the allowable values are things like "new", "active", "deleted", and I'll use a char(1) and 'N', 'A', 'D' for those values in a status table with "code" and "description" as the only fields.

    I personally have done what Barand did (using table_id) many times, primarily to make it easier for the design tool(s) I typically used, but most ORM's like it if you just name your table pk "id".  When you add a foreign key, then make that "tablename_id".  

    A lot of ORM's will pick up on naming conventions for keys, so it makes things easier, as the ones I've used will default to the assumption that the "id" field is the primary key for the table.

    Not a huge fan of these types of columns, but created_at, and updated_at are good for timestamps like your "q_added".

     

  8. On 8/12/2023 at 6:29 AM, PNewCode said:

    Yes, I have it so only people with admin permissions can even see the delete button at all. This doesn't help with passing the id though

    Just a quick comment on this.  A user does not need to see a button to call Ajax in order to exploit the Ajax.  All they need is to know that it is there, and they can use whatever technique or tool that they want to, to post to the Ajax url.  

    Anything that needs to be secured should have a separate permissions check.  A simple common solution would be to check something stored in the session that indicates someone is an admin, or some other user level.  Then your Ajax code should check that and only execute the actual deletion code when their status is affirmed.

  9. This is the mod_rewrite rules of a typical current wordpress:

    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]

    What this shows, is that Wordpress implements a front controller.

    I don't know exactly what the issue is, because my example was:

    user's url   ->  rewritten to

    And it appears to me that you presented:

    rewritten to -> user's url

    Requinix has tried to steer you towards this, so I'm going back somewhat to the start, and suggesting you add this to the bottom of your rules:

     

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/ page.php?slug=$1 [L,QSA] 

     

     

  10. On 7/20/2023 at 4:47 AM, aarti789 said:

    Well, the best methodology for coordinating your code with PDO relies upon the particular prerequisites and intricacy of your task. Both approaches are valid, and you can choose the one that fits your needs and coding style better.  

    Thanks  

    Did you get this from chatgpt?  This literally says absolutely nothing, as it refers to 2 "approaches" neither of which were listed.  It's like you cut and paste from something else.  I hope your future posts will be of more value than this one. :(

  11. The eclipse PHP environment (PDT) is built upon the eclipse "Dynamic Languages Toolkit"(DLTK).   What the DLTK does is build the internal structure that PDT depends upon to map and index the project files. 

    It utilizes the project source tree, so in general, there is no need to go farther than that, and as php has evolved with the advent of composer, there isn't much need to specify the location of libraries that exist outside of the source tree.  In the olden days of PHP when people used PEAR libraries, you would have pear libraries that were put in a shared location, but PEAR is entirely deprecated now that we have composer for component library management.

    I don't use Eclipse PDT much these days, other than for a specific maintenance project, as I find that PHPStorm or VSCode with the inteliphense plugin are both much better IDE's for PHP development at this point in time.  

  12. In the code you provided, it assumes there is a function ConfirmCancelOrder.  As requinix stated, if this is your choice, you only need confirm.  

    From a style and usability standpoint, builtin modals like alert and confirm are not used much anymore, because they depend on the browser/os UI kit, and can't be styled to look like the rest of the UI, which looks amateurish.

    Most people implement a modal dialog window.  Most css frameworks come with widgets (css + javascript) that are easy to use.  Twitter bootstrap is the grand parent of this idea, and while I don't offer this a recommendation, if you already happen to be using twitter bootstrap, here's a link to documentation for their modal.  Most other css frameworks, or javascript ui frameworks, have similar helpers.  

    The general idea is simple and reusable -- your markup will include the div for the modal which starts out hidden, and when needed, you pass some parameters to it for the specific title and message.  

    You can usually build your code in a way that makes it easy to include the partial html and javascript you need for any pages that have html forms where you also want confirmation.

     

  13. 4 hours ago, marmelade7 said:

    I've already been through all that stuff.  I need someone to explain where the answer is.  I've deduced that count($matches[0]) contains the answer, but count($matches[0]) does not always work.

    It seems like you are fixed on using $matches.  People tried a few different ways to tell you that the function returns the number of matches, so this is your original code re-written.

    $c = preg_match_all('/[0-9]{1,}[-]{1}[0-9]{1,}/', $txt, $matches);
    $d = preg_match_all('/[A-Za-z]{1,}[-]{1}[A-Za-z]{1,}/', $txt, $matches);
    
    echo "c count=$c";
    echo "d count=$d";

     

    The reason for this, is that any regex can have groupings (capture groups) that produce partial matches, and all of these are returned in the $matches array.  The return value only returns the actual number of full matches, which is clearly what you want.

  14. Not that this explains the problem, but if you want a grouping for these 2 products, then group by product.product_id, not product_name.  

    Also, no reason to do this:

    JOIN products ON (products.product_id = 55 OR products.product_id = 51)

    You should be joining from the salesdetails row to product.

    JOIN products ON (products.product_id = salesdetails.salesdetails_product_id)

     

  15. In addition to what requinix said, consider that private networks are using private "non-routable" IP ranges.  Outwards, your router is doing "Network address translation" (NAT)

    When you want to access a particular computer on a particular port that is inside a private network, there is simply no way to do that, because these IP ranges like 10.x.x.x and 192.168.x.x and 172.31.x.x are reserved for private network use.  Core routers will never route packets with those IP addresses.

    A VPN is giving you a private IP on the private network, and intelligently routing traffic meant to go to your intranet.

    Production networks use the same ideas.  As requinix already explained, there are many good reasons to isolate servers inside a private network, and even subnet the private network to isolate groups of computers from each other.

    Tunneling allows you to use a gateway server for entry into a private network, just as a vpn server does.  And you can then hop to another server, and perhaps others if need be, in order to create a secure tunnel that gets you network access to the server you want.  Most system administration is enabled by the use of SSH to connect and tunnel through servers to access other servers, that otherwise would be unreachable.

  16. If you can afford it, PHPStorm is pretty much the professional standard.  A lot of people also use visual studio code, in combination with the "Intelephense" plugin.  Intelephense provides a good number of features for free, but you can also license it for $20 to unlock the rest of the features, which I would highly recommend.

  17. 2 hours ago, OzWaz said:

    UPDATE:

    To try and determine what part  php on the server plays in my problem I grabbed a domain WHYMYPHP.ONLINE and uploaded the files, that I used for my website 12 months ago containing [Line 22 "$result = $stmt->get_result();"] into a directory in my hosting plan and they still worked perfectly. [Take a look if it helps]

     

    I looked at the site, opened the menu and tried to navigate to:  http://whymyphp.online/galery/fetchit.php which produces a 500 error.  This is the same issue we've been looking at, and we keep coming back to the fact that mysqli is not the version that has been linked to the myslqnd driver.   This is not by any means a new issue.  See this 4 year old SO question.  The confusion relates to godaddy and cpanel, and the specific extensions that are enabled through cpanel.  

    At this point, it is pretty much up to the OP to enable the right extensions through cpanel.

  18. It would not work any better in Oracle, because your logic is faulty.

    Keep in mind that inside your parens, if any of those items are TRUE, then the entire group is true.

    team_name is not null or team_name !='' or team_name NOT LIKE '%[teamname]%')

    In the row you don't expect, consider each condition

    team_name is not null ---> true

    team_name !='' ---> true

    team_name NOT LIKE '....'  ---> false.

    So you get the row, despite the fact that the 3rd condition is false.  What it appears you really want is:

    team_name is not null AND team_name !='' AND team_name NOT LIKE '%[teamname]%')

     

  19. On 7/2/2023 at 4:45 PM, kicken said:

     

    You need to know OOP anyway.

    The vast majority of libraries out there are using OOP, so if you want to take advantage of other peoples work to save yourself time (ie, the various frameworks or even just individual libraries) you need at least a basic understanding of how OOP works.  You don't need deep knowlege of everything OOP and all the design philosophies t hat go with it just to use a few libraries, but you do need basic syntax and structure knowledge to understand the library code and know how to interface with it.  The more you know though, the easier it is to integrate with libraries and customize them to suit your needs.

     

     

    This is really the crux of the issue.  Applications are rarely written from scratch -- they are assembled from component libraries (a collection of OOP classes).   You don't have to know how to write your own OOP code immediately, or even to write any sophisticated OOP to make use of other peoples components.  This is why you really want to start with composer and learn enough about that to start making use of components that will make your application faster, and better quality in the vast majority of cases.  You can always verify the quality of the component, by looking at and even running unit tests they have written for the library.  You need to know the basics of oop, but you don't have to be an OOP expert.

  20. Along with validation, using the developer tools is an excellent iterative way to explore the state of the DOM, and to find syntax errors in javascript, or to explore layout and effective styles.    The network tab is also extremely valuable, in examining request/response data for ajax or regular form processing via get or post requests.  That should always be your first step in starting to debug things.  Most modern code editors people use to develop PHP with will also catch a lot of syntax errors, although code that renders html will typically look valid so long as the php code is valid.  Moving html into a template engine, or even making use of heredoc and nowdoc is helpful in many ways to separate markup from your logical code.

×
×
  • 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.