Why does the belly grow? Belly in men posting php mode quote. Why the belly grows Secrets of men posting php mode quote

The problem of excess weight in the abdominal area is relevant for men of different ages. To effectively remove fat deposits in this area, men need to create an individual nutrition plan, introduce an active training regimen and give up bad habits.

Big belly in men, reasons for how to remove it

Over the past decades, against the backdrop of rapid growth in urbanization and the popularization of a sedentary lifestyle, the problem of abdominal obesity has become widespread. Nutritionists are increasingly hearing the question - how to remove a man's belly? To successfully get rid of it, you need to become familiar with the factors leading to its accumulation.

Unhealthy food. This category includes fast food, ready-made food, fast food, fried, highly salted food. High-calorie foods with fast, easily digestible carbohydrates are contraindicated if you are overweight.

Harmful drinks. Low-alcohol carbonated drinks, beer, and lemonades contain a colossal amount of harmful substances, the consumption of which leads to a progressive increase in fat on the abdomen, waist, and sides. In addition, a large amount of beer leads to hormonal imbalance and a gradual increase in female hormones.

Low activity. To the question of why a big belly grows in men, the reasons for how to remove it, the answer is an assessment of average daily physical mobility.

Sedentary work, a personal car, lack of active recreation and a regular physical training regimen lead to the deposition of fat on the abdomen, waist, and sides.

This affects the state of the cardiovascular system, and in combination with obesity, the musculoskeletal system suffers.

Stress. One of the leading risk factors for abdominal obesity is high stress loads. Increased stress affects the chemical processes of metabolism, worsens the general condition of the body, and leads to overeating.

Among the reasons for the development of visceral obesity, genetic predisposition is noted, but correct implementation of recommendations on how to remove a large belly in men leads to significant results. You need to start losing weight by correcting your diet.

Diet

Despite the fact that men’s commitment to diets and fasting days is quite low, a well-designed diet, taking into account individual characteristics, is necessary for losing weight and getting rid of extra centimeters.


Slow metabolism, the intake of large amounts of calories and fats lead to the storage of unspent energy resources - fatty acids - in the subcutaneous fatty tissue, around the internal organs. As fat accumulates, the question comes to the fore: how to remove belly fat for a man without harming his health? Correction of food intake and development of correct eating habits are required.

Food diary

At the beginning of the weight loss process, maintaining a food diary is required to maintain the level of self-organization and general motivation. At first it is filled daily, and then, as the eating habit develops, weekly. Notes in the food diary reflect all meals, calorie content of dishes, consumption of junk food, alcohol, weight and waist size.

Over time, carefully filling out a food diary will reflect the reasons for weight fluctuations, the effect of certain foods on the metabolic rate, and the general condition of the body.

Fractionality of food

The first task of how to remove a big belly in men is to speed up the metabolism. This is possible by dividing the daily volume of food into fractions - the body stops storing fatty acids with a constant intake of small amounts of food. Fractional nutrition helps maintain the level of nutrients, vitamin complexes, and minerals in the body.

Diet

A balanced diet is not only a guarantee of rapid weight loss, but also one of the effective methods on how to remove a man’s belly. The diet excludes the consumption of fast, easily digestible carbohydrates, and is based on protein foods, whole grain cereals, vegetables, fruits, a limited amount of polyunsaturated fats, and slow carbohydrates. It is important to have a variety of prepared dishes and fresh natural food.

Proper nutrition does not require exhausting diets, significant food restrictions, or fasting - in this case, the body begins to store nutrients, and excess weight returns. For optimal weight loss, it is important to maintain the same level of nutritional saturation throughout the day and avoid hunger.

Menu

Many women complain that their husband has a big belly; advice from nutritionists and fitness specialists in the field of proper nutrition will tell you how to remove it. The basis of healthy weight loss, in addition to diet, is also a daily menu based on freshly prepared products.

Indicative menu

First breakfast. A glass of water at room temperature with lemon and mint added. Fresh fruit, a glass of milk or low-fat fermented milk product.

Lunch. Oatmeal or muesli with dried fruits. Multi-component vegetable salad with olive oil and sesame seeds. A piece of boiled chicken breast or turkey.

Dinner. Soup with vegetable or meat broth. Stew or poultry. Vegetable side dish with rice or buckwheat porridge. Dried fruits, a slice of rye bread. Weak tea without sugar.

Afternoon snack. Fruit juice, smoothie. Fresh fruits. Before an intense workout, you should add protein (chicken, turkey, seafood).

Dinner. Stewed vegetables, buckwheat porridge. Baked or steamed fish. Vegetable salad. Low-calorie bread, bread with bran. Green tea.

If you have a pronounced feeling of hunger in the evening, you are allowed to drink a glass of milk or kefir with fruit and bran. During the day, it is acceptable to satisfy your hunger with nuts, energy bars, and yoghurts in small quantities.

The menu is based on fruits, vegetables and whole grain cereals. Before training, it is mandatory to eat protein food no later than two hours before class. This will help you to remove belly fat for a man in a short time without harming the body.

Intermediate result

The first kilograms will begin to rapidly disappear immediately after giving up junk food. Two weeks after you stop receiving a large amount of calories, extra centimeters will begin to disappear from your waist. Unlike the female body, the male body loses weight much more intensively, and the extra pounds, as a rule, do not return.

Against the backdrop of losing weight, another question becomes relevant - how to remove a sagging belly in men? It is necessary to introduce regular physical activity and change your usual lifestyle.

Physical training

You should start with walking at a normal pace, Nordic walking, cycling, riding a scooter with alternating changes in the leading leg, and roller skating. As your training level increases, you should make adjustments to the organization of your training strategy - introduce additional loads, increase the intensity of training.

If, even against the background of dietary restrictions, a large belly persists in men, the reasons for how to remove and cope with it will help overcome a gradual increase in vital activity. For example, organizing ten-minute breaks during working hours to warm up - climbing stairs, walking in place, stretching.

Before you begin to follow the recommendations on how to remove belly fat for a man in the gym, you should increase your level of fitness with morning exercises or morning jogging. Such loads start the metabolism, optimize energy consumption during the day and increase overall performance.

Run

Running loads are an excellent workout for the cardiovascular system and musculoskeletal system. You can do interval running with fast walking, with weights for your legs or dumbbells for your arms. Any running load requires strict monitoring of the state of breathing and the absence of dizziness. After running, you should perform several sets of exercises with lifting the body and legs for the upper and lower abdominal muscle groups.

Gym

Ideal for how to remove belly fat for a man in the gym in a short time with the help of a personal trainer. Exercises on sports machines help to work out different groups of abdominal muscles, including the lateral muscles, with different weight loads.

The ideal workout aimed at how to remove belly fat in the gym for a man is circuit training. It consists of performing each new approach on different machines, it allows you to strengthen all muscle groups, promotes intensive weight loss, and increases endurance. As your training level increases, the weight load during circuit training increases along with the number of approaches.

Cardio training, aerobic group classes are well suited for those who do not know how to remove belly fat in the gym for a man. The personal control of the coach and the personal achievements of each group member are good motivation and increase self-discipline.

results

After starting active physical training, the result will be rapid - centimeters on the stomach, waist, and sides will begin to disappear. With increasing training, the contours of the torso will improve and muscle definition will appear.
After changing your usual lifestyle, your performance will increase, your mood will improve, and your immunity will increase.

The so-called “beer belly” usually appears in men by the age of 35-40. What are the reasons for such a sharp growth of the abdomen and how to deal with them? Why the belly grows in men: the main reasons. Why does the belly grow in men and how can you get rid of it? Over time, harmless at first, the fat layer on the abdomen begins to grow - a man has a belly. No matter how men joke about their belly, the size of this part of the body is directly proportional to the growth of the authority of its owner

The belly, which has arisen due to a sedentary lifestyle, also hangs down on the sides with rolls of fat. To avoid this, you need to walk 3 kilometers or more per day. The next reason why a man's belly grows is gluttony.

Let's try to list the factors that contribute to the growth of the abdomen in men, we will talk about the reasons for the growth of the abdomen, as well as how to get rid of it. Knowing why the belly grows in men is useful for every person, because... the problem is very simple and obvious.

For most men, their belly begins to grow over time. This can happen both in youth and in old age. In general, this moment is individual for each person.

So why does the belly grow in men and how to prevent it?

You can find many “everyday” versions that make men’s bellies grow. Some say it's from drinking too much beer. The second is that the tummy gradually grows from overeating. There are even versions that the belly grows in men who often drive or suffer from metabolic diseases.

In fact, experts identify only two main reasons for the growth of a man’s belly (the rest also occur, but as a consequence):

  1. The man's abdominal muscles have lost their tone;
  2. The presence of fat deposits (most often on the intestinal mesentery);

In men, fat is deposited in the so-called “greater omentum,” which is located in a special fat fold where internal or abdominal fat can grow.

An increase in waist size in men can also be associated with hormonal imbalances, which are often accompanied by infertility and impotence.

What is the reason for this unusual phenomenon and why does the belly grow in men? The problem is that the body spends much less energy than it receives and this same energy appears in the form of belly fat.

What else is dangerous about excess weight in men?

Fat located at the waist puts pressure on the diaphragm, thereby changing the position of the heart to horizontal. This is the occurrence of heart attacks, since the heart muscle is not sufficiently supplied with blood.

A large belly in men can cause diseases of the spine, as it constantly experiences considerable stress.

Also, due to excess weight, testosterone levels decrease. As a result, impotence appears, mammary glands enlarge, and the timbre of the voice increases.

But before choosing a way to deal with a big belly, let's find out why it grows so much. Of course, the first thought that comes to mind about this is beer. There is some truth in this. The foamy drink is now becoming a constant companion for many men. According to nutritionists, beer contains a large number of calories. Yes this is true. But there are no more calories in beer than in other products beloved by men, which they also consume daily. So is beer to blame for this problem? Yes, but it’s not the only one.

The main reasons why the belly grows in men

After 35 years, hormonal changes begin to appear more clearly, which cause fat deposits on the waist and sides.

Another main reason is banal overeating. Probably all healthy men love to eat tasty food and eat a lot. Fatty spicy foods, beer with salty crackers, salty snacks and chips are the favorite foods of many. If you add to this a sedentary lifestyle, belly fat accumulates very quickly.

Now about beer. The fact is that it contains a certain amount of female plant hormones. When they enter the body, they promote the accumulation of fat. In addition, salt, which is contained in large quantities in snacks for drinks, retains water in the body. Thus, fat cells are formed even faster.

Also, the appearance of excess weight can be caused by hypertension, heart disease, diabetes mellitus, a sedentary lifestyle, as well as genetic reasons.

Drivers' bellies grow very quickly. The body behind the wheel is positioned so that the oblique abdominal muscles remain relaxed. Over time, they lose their tone and belly, and their sides literally creep apart.

However, there are more serious reasons. For example, a large belly along with other symptoms may indicate problems with insulin production. If a person does not drink beer, eats normally, does not overeat, but experiences constant thirst, swells, and quickly gains weight, he needs to be tested for type 2 diabetes.

Excess weight can appear due to serious hormonal imbalances. At the same time, in men, not only the belly grows, but the shoulders and hips expand. In this case, you need to consult an endocrinologist and undergo a hormone test.

As you can see, there are many reasons for the appearance of a big belly. But we are the masters of our own bodies. Therefore, you need to take a balanced, thoughtful approach to the problem and successfully solve it.

How to get rid of belly fat in men?

If your stomach is very large, you need to consult a doctor. To reduce its volume and lose weight, begin to control the calorie content of the food you consume. Have a hearty breakfast, reduce the amount of food you eat during the day, and in the evening eat only vegetable dishes.

If you find it difficult to give up beer, just drink a little less of it, but do not eat salty, fatty snacks with beer.
You just need to give up beer, fatty and starchy foods, and more fruits and vegetables. Start running in the morning. It will be hard, but I will still overcome laziness. As a result, your belly will almost completely disappear and you will feel great.

Remember that the feeling of fullness occurs 20 minutes late. Therefore, pull yourself together and leave the table a little hungry. Try to season your dishes with mayonnaise as little as possible. Replace hamburgers with homemade sandwiches.

And of course, move more. If you can't go to the gym, do your abs at home. In the summer, cycling and swimming can be your assistant, and in the winter, skiing and walking in the snow. In addition to losing weight, you will gain a boost of energy and health.

So it is useful for all men to know why their belly is growing. But it’s even more useful to know how to get rid of it. I hope these helpful tips will help you regain your confidence. Be healthy!

So what actually causes men's bellies to grow?

  1. Constitution, physique. Both father, grandfather, and great-grandfather “suffered” from such a figure. Did you think such things only concern women?
  2. Metabolism is disrupted. This, of course, is very bad, but it can be fixed if you take care of yourself properly.
  3. Men are lazy to play sports. And even physical education is the “end of the world” for them.
  4. Men either start smoking or quit. The body does not perceive this behavior at all, that is, it perceives it, but negatively, taking revenge on the figure for it.
  5. There is little sex in the lives of these men. Sex is an outspoken calorie hater. There will be sex - the tummy will be smaller.
  6. The men apparently gave up going to the gym. And you shouldn’t do this at all! It's a pity that men don't understand simple things.
  7. Stress helps your belly grow. Since stereotypes prevent men from crying, they begin to actively eat it up and wash it down.
  8. There is no motivation to look after the condition of the body. A lot of things probably didn’t work out in life. And there is no time to think about tummies and other parts of the body.

If we talk about why a woman’s belly can grow and why a man’s belly grows, then here we can identify both general reasons and those that are characteristic of one or another gender.

Today, many men are trying to find the answer to the question of why their belly is growing. After all, the presence of a large belly is the most common problem that causes a lot of trouble.

So, the first and probably the most common reason for abdominal growth in males is considered to be frequent consumption of a drink such as beer in large quantities. After all, this alcoholic drink is considered a very high-calorie product, as it contains yeast. That is why, if a sufficient amount of such a substance enters the human body, then the cells begin to acquire a rather loose character over time.


As a result, a person may experience symptoms such as abdominal puffiness. At the same time, people, as a rule, consume all kinds of snacks with beer in the form of crackers or salted nuts, which entails fluid retention in the body, which, in turn, causes swelling and growth of the abdomen.

Answering the question why the belly grows in men, it is worth noting that the main reason for all this may also be a person’s prolonged driving of a vehicle or a sedentary lifestyle as such. Indeed, as a result of this, the tone of male muscles begins to weaken over time.


In addition to the formation of a belly, in this case the following symptoms are also encountered: sagging skin and hanging fat on the sides. As a preventive measure, experts recommend daily three-kilometer jogging.

Why do guys' bellies grow?

Remember what your cave ancestor did for most of his life. That's right, I hunted mammoth with my tribe. Or, as part of his self-employment, he tracked down some antediluvian porcupine in order to provide food for the family waiting in his native cave. That is, your ancestor moved almost continuously. If you don't move fast enough, you may end up without dinner. Or even end up being eaten by some saber-toothed predator for dinner.

A modern man mostly hunts computer mammoths, which does not require much physical activity. He gets to work by car, and doesn’t walk from work either. And appetite, like all other life support mechanisms, is no different from cave ones. Therefore, by eating ready-made, beautifully packaged porcupine in the kitchen, a modern man receives free calories that are not provided by energy costs. And then he asks: why do guys’ bellies grow?

What happens to us men, hunters of pixelated mammoths and consumers of store-bought porcupines? Nature has nothing superfluous. If muscles are not in demand, they lose their tone. As a result, the contents of our abdomen, under the influence of internal pressure, begin to protrude the anterior abdominal wall. And – goodbye to the treasured six-pack abs and last year’s youthful jeans. Now you have to choose trousers not by size and style, but by the ability to fasten them on the stomach. More precisely, under the stomach, because no trousers will stay on it anyway.

The reason for the proud protrusion of the abdomen forward is weakness of the rectus abdominal wall muscle. Insufficient tone of the oblique abdominal muscles is to blame for the spreading of the once youthful waist to the sides. This is excluding the actual growth of the fat layer, which occurs not only on the anterior abdominal wall, but also on the intestinal loops, in the so-called omentum. By the way, this internal fat shows particular persistence when trying to get rid of it. Your body will fight for its own omentum, like an Olympic champion for victory. Because I am sure that the deposited fat is necessary to ensure its vital functions. And he accumulates this fat not to annoy you, but for a rainy day. Let's remember how often the cave ancestor had successful hunts? Has it ever happened that the fat layer provided energy exchange for a faint hunter, giving him strength for further searches for food? There is nothing unnecessary in nature. It's all about how we manage the opportunities given to us by nature.

Why does the lower abdomen grow?

But why does the lower abdomen grow? For the same insufficiency of the oblique muscles of the abdominal wall. But not only. Here we smoothly move on to internal matters, that is, to metabolic disorders.

Fat deposits in the lower abdomen, fat depot. Where did it come from? From there, it was synthesized from untapped excess calories. Do you want to get rid of it? Endocrinology to help. The fact is that the most important male hormone, testosterone, among its other functions, is also responsible for lipid metabolism in a man’s body. An age-related decrease in testosterone production is a physiological phenomenon, that is, it occurs naturally. But - smoothly. We have a store-bought porcupine and a minimum of movements. And from the invisible fat layer inherent in every organism, we grow a full-fledged “beer” belly. Ask – what does endocrinology have to do with it? With everything, despite that. An increase in the number of fat cells contributes to an increase in the production of the hormone antagonist of testosterone - leptin. As a result, the process of reducing testosterone production occurs faster than it should. And accordingly, leptin production increases. And an increase in the volume of fat depots. Just some kind of Fibonacci sequence.

This most masculine “Fibonacci sequence” affects all men’s health, both reproductive and general. This results in inexplicable lethargy, increased fatigue, a tendency to illness and reduced resistance to stress.

If the state of health is still satisfactory, then in terms of metabolism it is no longer so good. And the process continues to gain momentum.

But let's get back to beer. Why does beer make your belly grow? Everything is simple here - an abnormally elongated stomach (rarely anyone drinks one bottle of beer), extractivity, which increases appetite, and the presence of analogs of female sex hormones that stimulate fat formation. Recently, attempts have been made to rehabilitate beer. I believe that at the suggestion of beer companies who are not interested in anti-advertising. But you and I are interested in our health, and not in other people’s profits. Isn't it better to think about yourself seriously before it's too late?

Or is it better this way?)))

03/15/17 5.2K

The php.ini configuration file is the main configuration tool for the PHP core. It is counted every time PHP is initialized. If the change is not visible, be sure to stop and restart httpd. If the changes you made are still in effect, use the phpinfo() function to check where php ini is located.

The configuration file is well commented and detailed. Parameters are case sensitive, keyword values ​​are not; spaces and lines starting with a semicolon are ignored. Boolean values ​​can be represented as 1/0, Yes/No, On/Off or True/False. The default values ​​in php.ini will affect the PHP installation, which can be customized later.

In this article we will look at important settings in the php.ini file that may be required for the PHP parser.

short_open_tag = Off

Short open tags look like this:. This setting must be set to Off if you want to use the XML processing features.

safe_mode = Off

If this setting is ON, you probably compiled PHP with the enable-safe-mode flag. Safe Mode is most important for using CGI.

safe_mode_exec_dir =

This option only matters if Safe Mode is enabled. It can also be installed with the --with-exec-dir flag during the Unix build process. PHP in safe mode only executes external binaries from this directory. The default directory is /usr/local/bin . This has nothing to do with serving a regular PHP/HTML web page.

safe_mode_allowed_env_vars =

This php ini option specifies which environment variables users can change in safe mode. By default, only those variables that have "PHP_" appended to them. If this directive is empty, then most variables can be changed.

safe_mode_protected_env_vars =

The parameter sets which environment variables users cannot change in safe mode, even if the safe_mode_allowed_env_vars option is enabled.

disable_functions =

A rather useful addition to the PHP4 configuration, which has been retained in the PHP5 version, is the ability to disable selected functions for security reasons. Previously, this required manual editing of the C code in which the PHP interpreter was written. File system, operating system, and network functions should be first on this list because the ability to write files and change the system via HTTP is not secure.

max_execution_time = 30

When setting up php ini, you need to be aware that the set_time_limit() function will not work in safe mode. Therefore, this is the main way to implement delaying script execution in safe mode. On Windows, you must force termination based on maximum memory consumption, not time. You can also use the Apache timeout setting to implement a delay. But it will also apply to non-PHP site files.

error_reporting = E_ALL & ~E_NOTICE

The default is E_ALL & ~E_NOTICE , all errors except notifications. Servers should be set to at least the default value. And only on main servers can you use a lower value.

error_prepend_string = [""]

Together with » is used with strings, as in forming the value of a form field.

variables_order = EGPCS

Replaces gpc_order . Both versions have been deprecated along with register_globals. It sets the order of various variables: Environment, GET, POST, COOKIE and SERVER (or Built-in). You can change this order. Variables will be overwritten sequentially from left to right, with the rightmost one always “winning”. This means that if you leave the default value and use the same name for the environment variable, the POST variable, and the COOKIE variable, the name will end up being the COOKIE variable.

register_globals = Off

This php ini set option allows you to determine whether EGPCS variables should be registered as global. This method has now been deprecated, and as of PHP 4.2 this flag is set to Off by default. Use superglobal arrays instead.

gpc_order = GPC

This option is deprecated.

magic_quotes_gpc = On

Escapes quotes in GET/POST/COOKIE input. If you use many forms that submit data to themselves or other forms, and display form values, you will need to enable this directive or use the addslashes() functions on string data types.

magic_quotes_runtime = Off

This option escapes quotes in incoming database strings and text strings. Remember that SQL adds slashes to single quotes and apostrophes when storing strings and does not remove them when returning strings. If this option is disabled, you must use the stripslashes() function when outputting any type of string data from a SQL database. If magic_quotes_sybase is set to On , then this setting must be Off .

magic_quotes_sybase = Off

Escapes single quotes in incoming database strings and text strings with Sybase-style single quotes rather than backslashes. If magic_quotes_runtime is set to On , this option should be disabled.

auto-prepend-file=

If this php ini parameter specifies a path, PHP should automatically add an include() construct to the beginning of every PHP file. Restrictions on include file paths should be taken into account.

auto-append-file=

If this parameter specifies a path, PHP must automatically insert an include() construct at the end of every PHP file, except when exiting using the exit() function. Restrictions on include file paths should be taken into account.

include_path =

If you set this value, you will only be allowed to include or request files from the specified directories. The include directory is usually located under the root document. This is necessary if you are working in safe mode. Set the parameter to .in to include files from the directory where your script is located. Multiple directories are separated by colons: .:/usr/local/apache/htdocs:/usr/local/lib.

doc_root =

When setting up php ini, if you are using Apache, then in the httpd.conf file the document root directory for this server or virtual host is already set. Set this value here if you are using Safe Mode or only want to allow PHP for part of the site ( for example, in only one subdirectory).

This material is for beginner programmers.

Error demonstration

Why do I so often see something like this when I go to a website:
Warning: Use of undefined constant LOCAL_SERVER - assumed "LOCAL_SERVER" in /web/includes/page-definitions.php on line 13

This is one of the standard PHP errors, which a) is ugly for the user; b) potentially dangerous.
Therefore, they need to be intercepted and ordered.

First, the error_reporting function allows us to decide which errors we want to see.
In principle, it is enough to simply turn off the display of all errors (error_reporting(0)), but this is not what we need, because we want to know about errors.
The constant for all errors is E_ALL.
In the fifth version, the E_STRICT constant appeared, showing strict comments about the code.
Of course, it is desirable to see them, but they are not included in E_ALL, so we will use the numerical value error_reporting(8191), which includes everything, up to new errors of the sixth version.

Note for the curious: error_reporting(E_ALL | E_STRICT) is not suitable, because then PHP 4 will swear, not knowing what E_STRICT is. There will be no problems with the numerical value.

We add a check for DEBUG - a constant set in the config, and, using set_error_handler, we will catch errors in an already running service. By the way, your error reporter must return true, otherwise PHP will throw a standard error.

Result:
(As for comparing a variable with five parameters, I’m not sure about the choice of method: in_array is more beautiful, and much slower, and switch case case is faster, but not at all beautiful. Beauty is a subjective matter...)

register_globals

Prior to version 4.2.0, the register_globals directive was enabled by default in PHP.
This has led to the fact that many are accustomed to the fact that if there is a form in the form, then in PHP code you can check if ($username == "admin")...

However, this is a potential hole that has led to many hacks.
Therefore, POST, GET, COOKIE variables must be accessed through superglobals $_POST, $_GET, $_COOKIE.
Many found this too difficult and the import_request_variables command became very popular, returning everything to normal.
So here it is.
Do not do that.

Another problem with register_globals:
150) ( echo "Boom!"; ) ?>
If the user is not an administrator and the $user_level variable is not initialized
(it is not given the value 0 at the beginning of the script, in the hope that it will be 0 automatically),
then a bad person can add foo.php?user_level=999 in the address bar and gain access.

SQL injection and magic_quotes

This design is so popular among beginners

dangerous. If the user enters " OR `username` = "admin" instead of the password, the system will let him in as an admin.

The example given is, of course, elementary.
But if you don’t solve the problem globally, you can always miss some query that is susceptible to SQL injection.
To combat this, the PHP developers decided to make sure that all information coming from the user is processed and all quotes are escaped (they are preceded by a slash, which is what the addslashes command does).
What's happened? All information from the user comes with slashes. Even the one that looks like it shouldn’t receive slashes. For example, comments on an article.
Moreover, this is not a 100% way to protect against SQL injection.

Solution. a) remove slashes, if any, from all incoming information. b) All information entering the SQL query is filtered by the specially created function mysql_real_escape_string (or an analogue for another database).

We remove slashes:

We create a function for filtering (mysql_real_escape_string - long, and tied to the verification format. What if you need to change the filter?)

And we use it everywhere. As soon as some dynamic data is sent to SQL, we immediately use quote:

Data checking

Check All what the user enters.
By default he is an attacker.

Try not to filter, try validate.
In other words, don't create a blacklist, create a whitelist.
Instead of

use

This way you will be sure that the information is clean and there will be no surprises.
If you are compiling a list of prohibited characters, you can always look at some bad %00 and similar ones that you most likely have no idea about.

Of course, there are situations when filtering is needed, for example, when a user writes a comment.
Then you need to cut off bad characters.
But in principle, you should try to validate.

There are several commands that need to be handled Very carefully.
These are include, require, readfile, eval, ``, system, exec, create_function, dir, fopen and the like.
Always look three times when you use them, if they use data that can come from the user, you can be sure that someone will use it.

This piece is dangerous. If an attacker enters "../../../../../etc/passwd%00", he will be happy, but you are unlikely to be happy.

Authentication

Don't forget that cookies are no more difficult to edit than what is visible in the address bar.
Therefore, everything that comes as a cookie is potentially an attack.
So there is no need to store the user's access level or ID in cookies.
It's best to let PHP handle this on its own using sessions.

By the way, in general, you need to store anything in cookies very modestly and think three times, is it necessary?

Conclusion

Always think of the data in the $_GET, $_POST, $_COOKIE variables as an attack by an attacker.
Trust no one! :)