Codebase from 2008. I think it was still those good old cathodic monitors (rn we have like 35 ISA cards for 17 PCs in production, so it's plausible). Must be a 0.25 font and good glasses.
if (empty ($ajout_moyen))
{
if (empty ($suppression_moyen))
{
if (empty ($ajout_uet)
{
if (empty ($suppression_uet))
{
if (empty ($ajout_type))
{
if (empty ($suppression_type))
{
if (empty ($ajout_intervenant))
{
if (empty ($suppression_intervenant))
{
if (empty ($ajout_moteur))
{
if (empty ($suppression_moteur))
{
if (empty ($ajout_organe))
{
if (empty ($suppression_organe))
{
if (empty ($ajout_chariot))
{
if (empty ($suppression_chariot))
{
if (empty ($ajout_pollution))
{
if (empty ($suppression_pollution))
{
if (empty ($ajout_mobile))
{
if (empty ($suppression_mobile))
{
if (empty ($ajout_commun))
{
if (empty ($suppression_commun))
{
echo "
<p style=\"font-size: 16px; text-align: center\">
Veuillez renseigner au moins un champ ...</p>";
echo '<META HTTP-EQUIV="Refresh" CONTENT="r; URL=index.php?cat=gestion_gmao">';
}
else
{
//Connection à la base de données
$cnx = mysql_connect("[REDACTED]") ;
//Sélection de la base gmao
$db = mysql_select_db("[REDACTED]") or die (mysql_error());
//Suppression de la ligne dans la table administration
$sql20 = "DELETE FROM administration WHERE donnee='$suppression_commun'";
// Exécution de la requête
$requete20 = mysql_query($sql20, $cnx) or die(mysql_error());
//Fermeture de la base de données
mysql_close();
echo '<p style=\"font-size: 16px; text-align: center\">Suppression de l\'équipement commun <b>'.$suppression_commun.'</b></p>';
}
}
else
{
//Connection à la base de données
$cnx = mysql_connect("[REDACTED]") ;
//Sélection de la base gmao
$db = mysql_select_db("[REDACTED]") or die (mysql_error());
//Ajout de la ligne dans la table administration
$sql19 = "INSERT INTO administration (type, donnee) VALUES ('equipement_commun','$ajout_commun')";
// Exécution de la requête
$requete19 = mysql_query($sql19, $cnx) or die(mysql_error());
//Fermeture de la base de données
mysql_close();
echo '<p style=\"font-size: 16px; text-align: center\">Ajout de l\'équipement commun <b>'.$ajout_commun.'</b></p>';
}
}
else
{
$cnx = mysql_connect("[REDACTED]") ;
$db = mysql_select_db("[REDACTED]") or die (mysql_error());
$sql18 = "DELETE FROM administration WHERE donnee='$suppression_mobile'";
$requete18 = mysql_query($sql18, $cnx) or die(mysql_error());
mysql_close();
echo '<p style=\"font-size: 16px; text-align: center\">Suppression de l\'équipement mobile <b>'.$suppression_mobile.'</b></p>';
}
}
else
{
$cnx = mysql_connect("[REDACTED]") ;
$db = mysql_select_db("[REDACTED]") or die (mysql_error());
$sql17 = "INSERT INTO administration (type, donnee) VALUES ('equipement_mobile','$ajout_mobile')";
$requete17 = mysql_query($sql17, $cnx) or die(mysql_error());
mysql_close();
echo '<p style=\"font-size: 16px; text-align: center\">Ajout de l\'équipement mobile <b>'.$ajout_mobile.'</b></p>';
}
}
Oh, I definitely am crazy. :P I really don't have a proper estimate, though. Most days I probably do at least 10 posts, but rarely huge code ones like these, since they don't show up often. Mostly it's smaller things such as Twitter posts, etc. I don't know how much time that would translate to. Maybe like an hour average a day, slightly less?
I’m guessing iOS 15´s OCR had to be welcome for content transcribers, you can just copy text from images and it works really well in my experience. Just have to deal with formatting
I don't know php, but out of curiosity what would right look like in this case? It looks like it's basically just checking if the variables aren't empty, wouldn't you be able to do that in one if?
You can definitely check if multiple variables are empty in one if, and depending on whether all those ifs have else clauses that might be one thing that would improve this, but the "bad code" part is that $cnx and $db are the same in all the cases, that definitely needs to go outside of all those ifs.
150
u/[deleted] Nov 02 '21
Uh, oh, also instant SQL Injection?
Where is Bobby Tables when you need him? https://xkcd.com/327/
130
u/haltmich Nov 02 '21
The real crime is coding in fr*nch
43
u/InsertMyIGNHere Nov 02 '21
Jesus christ this guy had to be on font size .5 to see all his code wtf
21
u/trBlueJ Nov 02 '21
... else if?
189
u/MurdoMaclachlan public boolean isInt(int i) { return true; } Nov 02 '21
Image Transcription: Code
I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!
11
u/[deleted] Nov 02 '21
I don't know php, but out of curiosity what would right look like in this case? It looks like it's basically just checking if the variables aren't empty, wouldn't you be able to do that in one if?
9
u/veskoyyy Nov 02 '21
Looks legit. Would push to production.
9
u/militia848484 Nov 02 '21
Also comments on each and every line is a bad practice. Comments tend to lie over time.
4
u/killersquirel11 Nov 02 '21
I know it's hard to get anyone to agree on brace styles, but can we all agree that this is not it?
4
u/Bit5keptical Nov 03 '21
The stairway to hell
4
u/garfield1147 Nov 03 '21
Me today: Every single line is all wrong. Even the ones with a closing curly. Me back in 1996: yes it works!
1
u/enchantingkryptonite Nov 03 '21
What editor is that?
3
u/Spynder shameless stealing content to r/YandereTechnique Nov 03 '21
Different amount of margin lines between ifs also mildly pisses me off.
r/YandereTechnique
2
u/TiBiX_ Nov 02 '21
pas mal non, c'est français
2
u/sticknweave Nov 02 '21
You ruined my morning
2
u/orefat Nov 03 '21
Thus guy has serious statements.
2
u/oldcastor Nov 03 '21
for this kind of stuff one should be excluded from rebirth cycle
3
u/g_hi3 Nov 02 '21
thank god, it's just PHP and not actual code /s
3
u/gravity_is_right Nov 02 '21
This is why php has a bad name
2
u/lil409 Nov 02 '21
php and french lol
1
u/DorkInShiningArmour Nov 02 '21
That’s what my code looks like now 😂😂
1
u/CaitaXD Nov 02 '21
For fuck sake that's why you learn boolean algebra in college
1
u/DonkeyTron42 Nov 02 '21
Looks like a case of r/thereifixedit over many years and many devs.
1
u/mynameSved Nov 03 '21
"OR DIE" Lol
1
u/HerissonMignion Nov 04 '21
This is french
0
u/[deleted] Nov 02 '21
[deleted] — view deleted comment