How to create a screen type for each user?

Asked

Viewed 77 times

0

I am creating an online system in real time, so far only know Html5/css3/js.. How do I stop as soon as the customer logs in his or her information appears to him and not another customer? I don’t think it would be a good idea to keep creating . html files for each client.

1 answer

1

My suggestion is that you create a customer table, for example, and at the time of login you save in the session the logged in customer id. Later, in queries, insertions, changes... Anyway, in the actions in the database, you should validate the client’s Id. For example:

In the client table you have the columns: Id, Name, CNPJ, Status.

In the product table you have the columns: Id, Name, Weight, Value, Customer.

When making the select of products, for example, you will use:

SELECT C.Nome AS Clietne, P.Nome AS Produto, P.Peso, P.Valor
FROM Produtos P 
INNER JOIN Clientes C ON (P.IdCliente = C.Id)
WHERE P.IdCliente = $_SESSION['sIdCliente']
  • 1

    Very good :D there in the company my friend always does this to save the id and use it for everything, the problem I think, and that so this data becomes more vulnerable, no ? (I don’t know much about php)

  • 1

    I don’t see vulnerability... I believe it depends a lot on the whole structure of the project... is not a value in the session that will leave your project vulnerable.

  • tendi :D thanks for the clarification

  • Don’t forget to dial in your answer if you solved your problem ;)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.