File tree Expand file tree Collapse file tree 1 file changed +19
-10
lines changed
Expand file tree Collapse file tree 1 file changed +19
-10
lines changed Original file line number Diff line number Diff line change 33require_once '../videos/configuration.php ' ;
44
55if (!isCommandLineInterface ()) {
6- return die ('Command Line only ' );
6+ die ('Command Line only ' );
7+ }
8+
9+ // Check if a username is passed as a command line argument
10+ $ userName = isset ($ argv [1 ]) ? trim ($ argv [1 ]) : '' ;
11+
12+ if (empty ($ userName )) {
13+ echo "Enter the username or press enter to skip: " ;
14+ echo "\n" ;
15+ ob_flush ();
16+ $ userName = trim (readline ("" ));
717}
8- echo "Enter the username or press enter to skip: " ;
9- echo "\n" ;
10- ob_flush ();
11- $ userName = trim (readline ("" ));
1218
1319if (!empty ($ userName )) {
14- $ sql = "UPDATE {$ global ['tablesPrefix ' ]}streamers SET isAdmin = 1 where user = ' " . $ userName . "' " ;
15- echo $ sql .PHP_EOL ;
20+ $ sql = "UPDATE {$ global ['tablesPrefix ' ]}streamers SET isAdmin = 1 WHERE user = ' " . $ userName . "' " ;
21+ echo $ sql . PHP_EOL ;
22+
1623 $ insert_row = $ global ['mysqli ' ]->query ($ sql );
1724
1825 if ($ insert_row ) {
19- echo "User created " . PHP_EOL ;
26+ echo "User updated to admin successfully. " . PHP_EOL ;
2027 } else {
2128 die ($ sql . ' Error : ( ' . $ global ['mysqli ' ]->errno . ') ' . $ global ['mysqli ' ]->error );
2229 }
30+ } else {
31+ echo "No username provided. Exiting. " . PHP_EOL ;
2332}
33+
2434echo "Bye " ;
25- echo "\n" ;
26- die ();
35+ ?>
You can’t perform that action at this time.
0 commit comments