Categories > Coding > PHP >

file_put_contents() not doing anything


Aja

mainly Node.JS

Posts: 1396

Threads: 135

Joined: Apr, 2021

Reputation: 6

  • 0

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.

Languages I know:

- Node.JS

- PHP
- C#

RealNickk

Nicholas (Nick)

vip

Posts: 3863

Threads: 172

Joined: Feb, 2020

Reputation: 47

  • 0

Replied

Did you see if that chunk of code even executed? Also PHP is crappy ;-;

https://github.com/RealNickk

check out my github i make stuff

Aja

mainly Node.JS

Posts: 1396

Threads: 135

Joined: Apr, 2021

Reputation: 6

  • 0

Replied

@RealNickk it isn't tho

Languages I know:

- Node.JS

- PHP
- C#

pepsi

PePsIDeveloper

vip

Posts: 326

Threads: 6

Joined: Apr, 2021

Reputation: 10

  • 0

Replied

@AjaL plus ratio

L php

W nodejs ,Express

 

 

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

RealNickk

Nicholas (Nick)

vip

Posts: 3863

Threads: 172

Joined: Feb, 2020

Reputation: 47

  • 0

Replied

@pepsi W pepsi

https://github.com/RealNickk

check out my github i make stuff

SeizureSalad

i love femboys

Posts: 862

Threads: 49

Joined: Mar, 2021

Reputation: 23

  • 0

Replied

@RealNickk W delete entire repo

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

https://cdn.discordapp.com/attachments/908778288426651739/928478435066642492/siggy_1.png

Aja

mainly Node.JS

Posts: 1396

Threads: 135

Joined: Apr, 2021

Reputation: 6

  • 0

Replied

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

 

Languages I know:

- Node.JS

- PHP
- C#

pepsi

PePsIDeveloper

vip

Posts: 326

Threads: 6

Joined: Apr, 2021

Reputation: 10

  • 0

Replied

@Aja : L you L wrd L php L expressjs

no wonder why there so much vulns LOL.

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

Aja

mainly Node.JS

Posts: 1396

Threads: 135

Joined: Apr, 2021

Reputation: 6

  • 0

Replied

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

Languages I know:

- Node.JS

- PHP
- C#

RealNickk

Nicholas (Nick)

vip

Posts: 3863

Threads: 172

Joined: Feb, 2020

Reputation: 47

  • 0

Replied

@Aja i asked

https://github.com/RealNickk

check out my github i make stuff

RiceUsesArchBtw

rice cracker

vip

Posts: 249

Threads: 6

Joined: Aug, 2021

Reputation: 23

  • 0

Replied

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

https://cdn.discordapp.com/attachments/864522742095544320/1010136235316105276/siggy.png

 

dm me on discord (RiceCracker#2234)

Posts: 474

Threads: 29

Joined: Aug, 2021

Reputation: 24

  • 0

Replied

why tf u using php 💀💀

please for the love of god use nodejs + express

Aja

mainly Node.JS

Posts: 1396

Threads: 135

Joined: Apr, 2021

Reputation: 6

  • 0

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.

Languages I know:

- Node.JS

- PHP
- C#

RiceUsesArchBtw

rice cracker

vip

Posts: 249

Threads: 6

Joined: Aug, 2021

Reputation: 23

  • 0

Replied

@Ajafor the love of god use mysql or mongodb

 

https://cdn.discordapp.com/attachments/864522742095544320/1010136235316105276/siggy.png

 

dm me on discord (RiceCracker#2234)

Aja

mainly Node.JS

Posts: 1396

Threads: 135

Joined: Apr, 2021

Reputation: 6

  • 0

Replied

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

Languages I know:

- Node.JS

- PHP
- C#


Next >>>

Users viewing this thread:


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