-
Notifications
You must be signed in to change notification settings - Fork 2
/
admin_mge_tutor_new.php
85 lines (65 loc) · 2.04 KB
/
admin_mge_tutor_new.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php include("session_start.php"); ?>
<?php include("admin_authenticate.php"); ?>
<?php
// form submited code
if(isset($_POST['login']) && isset($_POST['password']))
{
if($_POST['login'] == '' || $_POST['password'] == '')
{
$_SESSION['msg'] = 'Please enter login/password.';
header('Location: admin_mge_tutor_new.php');
exit;
}
include('db_connection.php');
//echo '<br />Breaked 1<br />';
//break;
//echo '<br />Breaked 2<br />';
//exit;
$sql = "INSERT INTO tutor VALUES ( null , '";
$sql = $sql . $_POST['login'] . "', '" . $_POST['password'] . "', '" . $_POST['name'] . "');";
// echo '<br />sql = ' . $sql . '<br />';
if(!mysqli_query($sql))
{
if(mysqli_errno() == 1062) // rec exists
{
//print 'Record already exists for "' . $_REQUEST['txtFullName'] . '"';
$_SESSION['msg'] = 'Record already exists with this login: ' . $_POST['login'];
}
else
{
$_SESSION['msg'] = mysqli_errno() . '<br />Error: ' . mysqli_error();
}
} // if(!mysqli_query($sql))
else
{
$_SESSION['msg'] = $_POST['login'] . "'s record created successfully.";
}
header('Location: admin_mge_tutor_main.php');
exit;
//mysqli_close($con);
//echo "<br>end";
}
?>
<?php include("top.php"); ?>
<?php include("admin_submenu.php"); ?>
<div id="contenttext">
<div style="padding:10px">
<span class="titletext">New Tutor</span> </div>
<div class="bodytext" style="padding:12px;" align="justify">
<strong>New Tutor</strong>
<p>Here we will add new tutor.</p>
<table align="center" border="1">
<form action="admin_mge_tutor_new.php" method="post">
<tr><td>Login: </td><td><input type="text" name="login" /> </td></tr>
<tr><td>Password: </td><td><input type="password" name="password" /> </td></tr>
<tr><td>Name: </td><td><input type="text" name="name" /> </td></tr>
<tr><td align="center"> <input type="button" value="Back" onclick="location.href = 'admin_mge_tutor_main.php';"/>
</td><td align="center" />
<input type="submit" value="Create" />
<input type="reset" />
</td></tr>
</form>
</table>
</div>
</div>
<?php include("bottom.php"); ?>