Categories > Coding > PHP >

file_put_contents() not doing anything

Posts: 2016

Threads: 198

Joined: Apr, 2021

Reputation: 16

Posted

Hi, so what I am trying to do, is when a user posts "?addkey", it adds the given key to a file in "database/keys.json".

And when I am trying to add a key, it doesn't do anything at all. What is the problem?
Using a localhost, so the updates should occur immediatelly.

 

Code:

## The code for the add key, I know it has a else if, I just posted this part of my code
# So no one would copy
else if($_GET["addkey"] != ""){
    $content = $_GET["addkey"];
    file_put_contents("database/keys.json", ", " + $content);
}

 

I also tried:

else if($_GET["addkey"]){
    $content = $_GET["addkey"];
    file_put_contents("database/keys.json", ", " + $content);
}

 

Yet nothing worked.

Any help would be appreciated.

  • 0

Added

@_realnickk it isn't tho

  • 0

Random quote here...

pepsi

PePsIDeveloper

vip

Posts: 309

Threads: 6

Joined: Apr, 2021

Reputation: 16

Replied

@67078L plus ratio

L php

W nodejs ,Express

 

 

  • 0

https://cdn.discordapp.com/attachments/661621789591470090/1013919752294498314/Untitled_1366_768_px_1546_202_px_2.gif

SeizureSalad

i love femboys

Posts: 1159

Threads: 79

Joined: Mar, 2021

Reputation: 40

Replied

@_realnickk W delete entire repo

  • 0

"Questionable intellegence, but I like the mystery" - CubeFaces

https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png

Posts: 2016

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

@pepsi this is my selection so stop hating php, plus i am 100% wrrd was also made in php

 

  • 0

Random quote here...

pepsi

PePsIDeveloper

vip

Posts: 309

Threads: 6

Joined: Apr, 2021

Reputation: 16

Replied

@VoidableMethod : L you L wrd L php L expressjs

no wonder why there so much vulns LOL.

  • 0

https://cdn.discordapp.com/attachments/661621789591470090/1013919752294498314/Untitled_1366_768_px_1546_202_px_2.gif

Posts: 2016

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

@pepsi L you + ratio + no one asked + didn't ask + goofy ahh 💀 + bruh moment + skid moment

  • 0

Random quote here...

RiceUsesArchBtw

rice cracker

vip

Posts: 465

Threads: 19

Joined: Aug, 2021

Reputation: 39

Replied

is- is that your attempt at implementing a database???????

  • 0

https://cdn.discordapp.com/attachments/1023423265160560745/1132948683747500092/Frame_12x.png

Posts: 512

Threads: 32

Joined: Aug, 2021

Reputation: 58

Replied

why tf u using php 💀💀

please for the love of god use nodejs + express

  • 0

Posts: 2016

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

@kyron I just wanted to learn a new programming language, PHP was the one I selected. Plus, I know Node.JS and how to use Express, so I might use it later. As for now I will use PHP.

  • 0

Random quote here...

RiceUsesArchBtw

rice cracker

vip

Posts: 465

Threads: 19

Joined: Aug, 2021

Reputation: 39

Replied

@67078for the love of god use mysql or mongodb

 

  • 0

https://cdn.discordapp.com/attachments/1023423265160560745/1132948683747500092/Frame_12x.png

Posts: 2016

Threads: 198

Joined: Apr, 2021

Reputation: 16

Replied

@RiceUsesArchBtw as I said, this is my project, I choose what I code and what I use.

  • 0

Random quote here...

Zera

Casual Femboy Agent

vip

Posts: 1556

Threads: 39

Joined: Mar, 2020

Reputation: 42

Replied

The guy's asking help in the right section for this post and all the majority can do is to tell him to use a different resource? Not sure if this is actually helping him solve his problem. He started php for a reason, no need to force him out of his current decision.

  • 0

https://cdn.discordapp.com/attachments/995469995742068832/1073019970012848228/Untitled39_20220604185345.png

Posts: 149

Threads: 17

Joined: Jul, 2020

Reputation: 9

Replied

@VoidableMethod Looks like nobody should ever use your project if you don't care about security. It's insecure and blatantly wrong. Data should never be stored in a publicly accessible file whether it's keys or personal information. Bad practice.

  • 0

RiceUsesArchBtw

rice cracker

vip

Posts: 465

Threads: 19

Joined: Aug, 2021

Reputation: 39

Replied

@67078and i can criticize you how insecure your implementation is. stop being ignorant.

  • 0

https://cdn.discordapp.com/attachments/1023423265160560745/1132948683747500092/Frame_12x.png

Next >>>

Users viewing this thread:

( Members: 0, Guests: 1, Total: 1 )