-
Notifications
You must be signed in to change notification settings - Fork 0
/
addrider.php
37 lines (29 loc) · 953 Bytes
/
addrider.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
ini_set('display_errors', 'On');
header('Content-Type: text/html');
include "storedInfo.php"; //contains hostname/username/password/databasename
include "globalConstants.php";
include "sqloperationfunctions.php";
if(!isset($_POST['rider_name']) || $_POST['rider_name']==''){
fishy('you must set a name','riders');
}
$stmt = $mysqli->prepare("INSERT INTO sk8_riders (rider_name) VALUES (?) ");
$stmt->bind_param('s',$_POST['rider_name']);
$stmt->execute();
if($stmt->errno){
$error=$stmt->error;
$number = $stmt->errno;
$stmt->close();
fishy($error,'riders');
}
$stmt->close();
if(isset($_POST['rider_url']) && $_POST['rider_url'] != ''){
//update img url
$last_id = $mysqli->insert_id;
$stmt=$mysqli->prepare("UPDATE sk8_riders SET rider_img_url=? WHERE id=?");
$stmt->bind_param('si',$_POST['rider_url'],$last_id);
$stmt->execute();
$stmt->close();
};
redirect("{$_POST['rider_name']} added to riders",'riders');
?>