Jump to content

gizmola

Administrators
  • Posts

    6,044
  • Joined

  • Last visited

  • Days Won

    153

gizmola last won the day on April 2

gizmola had the most liked content!

7 Followers

About gizmola

Contact Methods

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

Profile Information

  • Gender
    Male
  • Location
    Los Angeles, CA USA

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

gizmola's Achievements

Prolific Member

Prolific Member (5/5)

356

Reputation

72

Community Answers

  1. This isn't directly related to your question, but you should consider using cloudflare that will give you a free CDN/Edge cache for your site, increasing performance and saving you bandwidth. Going to assume that your app is using PHP Sessions. If so, you need to review this setting as a first step. The only other thing I can suggest is that in a case like this, is that hopefully you have a mac, and can use a cable to connect to the phone and use the safari develop menu. I'd also likely open a tail on the server so I can see the requests coming into the server. You certainly want to question your assumptions as to what is happening as the app runs. The typical complaint in regards to safari is not lack of caching but the opposite -- aggressive caching that makes it hard to unload/clear the cache when developing/testing. Your server environment is also an essential component with different options that can be used to configure the server (apache/nginx/etc) in how it handles different types of files.
  2. So it's something that you put in header.php that you didn't show the code for. You need to understand that when you print something out, the browser sends an HTTP response to the request. Thus the HTTP header is composed and sent. This is not the way to do a redirect -- using meta refresh. You should be doing that in the HTTP header using a location, and that code should be followed by an exit. <?php session_start(); if (!empty($_SESSION['admin'])) { header('Location:/login.php'); exit(); } // This user is admin
  3. RewriteEngine on RewriteCond %{HTTPS} !=on RewriteCond %{HTTP_HOST} ^www.thelogos.net$ RewriteRule ^(.*)$ https://thelogos.net$1 [R=301,L]
  4. Hopefully, it's clear to you that Barand's solution and the one I presented are the same, only Barand used a 100% functional approach, and a lambda (anonymous function) passed to array_map. Compare/contrast the two solutions, and if you can understand them both, you'll have a good basis for solving future problems like this. One thing I would note about these solutions, is that any solution is only as good as its suitability to the data. For example, if the names can have suffixes like jr, sr, 3rd etc, you'll probably not get what you want. They could be improved to handle those situations, should the data you're working with warrant it. Using PHPUnit to create unit tests for code like this is a really valuable investment, if you care about testing, maintainability and quality.
  5. I strongly recommend that you change all of your tables to use the InnoDB engine. It's currently the default engine, given that it provides superior performance and features. Any aspect of a table can be changed (no dropping required) using the ALTER TABLE syntax.
  6. I really have no context with which to give you a "best solution" but a longstanding way of handling this is to have the customer website utilize an iframe that wraps your hosted site.
  7. To a degree, because you can create your desired list/count in one pass through the array. <?php $names = ['bob_jones', 'sam_smith', 'jane_doe', 'john_smith', 'jill_jackson', 'matt_jones', 'john_doe', 'emily_smith']; $lastNames = []; foreach ($names as $name) { $lname = substr($name, strpos($name, '_') +1); if (array_key_exists($lname, $lastNames)) { $lastNames[$lname]++; } else { $lastNames[$lname] = 1; } } var_dump($lastNames);
  8. From the way the question was worded, it doesn't appear that the data is in a relational database.
  9. As requinix stated, not really with css, because css "styles" markup. You could inject an additional DOM element using javascript. I'm not suggesting that is a good idea, but it would work fine, especially if this "row" is static.
  10. If the form is a "web form" then host it, and store the data within your own infrastructure, and you've accomplished SaaS, with all the benefits of code ownership we've discussed. You do need to account for the fact that you'll be paying for hosting. There are many solid/reputable hosting companies that provide a virtual server with room to grow your application, where you'll know your price in advance. You also want the server to be in a DC that is co-located near to your customer, and these mid size hosting companies tend to have that type of coverage. Linode, Vultr, Hetzner and Contabo are a few of the better known companies with track records to compare and contrast. I would highly advise against using shared hosting. Given that you will be running a monolithic architecture, I'd suggest looking at 8gb vps's to give you room to run the mysql database as well as your webserver/php stack.
  11. I don't really want to guess at what the application is, but SaaS would entail you hosting the application on your infrastructure and the customer using the functionality you provide within the app as an end user. There's no subterfuge involved in it. If there's some reason that a user would believe they were tricked in some way, then it's not SaaS.
  12. If you're developing code for someone at a cost, typically they would expect to own that code or a license to that code in return for the payment they are making to you. Generally speaking, the "data" for a system is the property of the customer/business using your system. It's not unusual for companies to provide a separate "maintenance" agreement that covers a period of time, wherein the customer would pay you an amount to enhance it and fix bugs. You also could provide the system in a Software as a Service model, where you host the system and code, and provide the customer access to the application, without otherwise providing the system level access they would need to even see the code. As far as pricing, there are many ways to estimate and cost projects. Understandably companies tend to like to know a price for something, so you need to have a decent idea of what amount of time it will take you to build the features. You make this estimation in "ideal" time, which is the amount of time any feature might take if you are head-down and fully productive. Then add a reasonable amount of overhead to your ideal estimate (anywhere from 10-35% is not uncommon). Determine a reasonable market rate for your time, and in combination, you'll have a "by feature" estimate you can utilize as a fix bid, with associated milestones. Any project like this should involve a contract.
  13. In order to "upload" a file to a server, and make that "quicker" you need to have optimized the size of the photo on your workstation. PHP doesn't come into it.
  14. You are reinventing the wheel for no good reason. Your database wrapper functions are simplistic and have many issues with them. Just looking at the code here are the things you are trying to accomplish: mysql connection setup and management Query building Query execution and result set fetching There are already a number of well designed PDO wrapper libraries out there. I recommend using Doctrine2 DBal. Doctrine2 is an Object Relational Mapping library that is used by many projects, and is the standard ORM integrated into the Symfony framework. Doctrine2 was architected to utilize a "Database Abstraction Layer" (DBAL) and layers the ORM features on top of that, but you can easily use DBAL by itself. I did exactly that in this simple example web application (rowCloner) I created to illustrate one particular feature of DBAL. By looking at that code, you have an example of how to setup a connection, make a query with parameters and get results. DBAL provides you all the things you need to make queries of different types when you require that. It also has a well designed Query Builder which is fluent and alllows you to create any type of query you want. You can further abstract DBAL with your own classes as I did with the rowCloner class in the example app.
  15. Every browser has a DOM built into it which represents the HTML elements and styles the browser has created from the underlying HTML/CSS and Javascript code. To manipulate the page, once the HTTP response from the server is complete, you need to use javascript. That is not inherently dangerous, given the limitations that are built into browsers, and standard security models like CORS which you can read more about here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/CORS So yes, you want to use "ajax" which is a generalized term for using javascript functions (should use fetch at this point) to retrieve data, and from there to make updates to the DOM that is loaded.
×
×
  • 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.