Server IP : 172.16.15.8 / Your IP : 3.139.108.99 Web Server : Apache System : Linux zeus.vwu.edu 4.18.0-553.27.1.el8_10.x86_64 #1 SMP Wed Nov 6 14:29:02 UTC 2024 x86_64 User : apache ( 48) PHP Version : 7.2.24 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0705) : /home/kabaines/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
<!-- create.php --> <!-- remove all 'i's from mysql commands for older php versions --> <?php session_start(); $name = $_POST['name']; $login = $_POST['user']; $pass = $_POST['pass']; $genres = $_POST['genre']; $tropes = $_POST['trope']; $triggers = $_POST['trigger']; $host = 'localhost'; $user = 'kabaines'; $passwd = 'CS389'; $database = 'kabaines'; $connect = mysql_connect($host, $user, $passwd); $adduser = "insert into USERS (NAME, USERNAME, PASSWORD) values ('$name', '$login', '$pass')"; // Remove $connect mysql_select_db($database); // Switch Parameters if (mysql_query($adduser, $connect) or die(mysql_error($connect))) { $findid = "select ID from USERS where USERNAME='$login'"; // reverse parameters $findid_result = mysql_query($findid, $connect); if ($findid_result or die(mysql_error($connect))) { while ($row = mysql_fetch_row($findid_result)) { foreach($row as $field) { $id = $field; } } $_SESSION['userid'] = $id; foreach($genres as $gen) { $query = "insert into GENRES values('$id', '$gen')"; // reverse parameters $result = mysql_query($query, $connect); } foreach($tropes as $tr) { $query = "insert into USERTROPES values('$id', '$tr', 10)"; // reverse parameters $result = mysql_query($query, $connect); } foreach($triggers as $trig) { $query = "insert into GENRES values('$id', '$trig')"; // reverse parameters $result = mysql_query($query, $connect); } $_SESSION['password'] = $pass; $_SESSION['username'] = $login; echo '<script>window.location = "dashboard.php"</script>'; print "<a href=dashboard.php>Continue to Dashboard here</a>"; } else print "failed at ID"; } else print "failed at add book"; ?>