-
Notifications
You must be signed in to change notification settings - Fork 2
/
sub_process_control.php
117 lines (90 loc) · 3.78 KB
/
sub_process_control.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
<?php
if (isset($_POST) && $_POST != null) {
session_start();
echo '
<!DOCTYPE html>
<html>
<head>
<title>PHP Tweets ~ By Kofix</title>';
require 'font.php';
require 'style.php';
echo '
</head>
<body class="grey lighten-2">
<div class="navbar-fixed">
<nav class="deep-purple darken-2 z-depth-4">
<div class="nav-wrapper container">
<a href="#" class="brand-logo">PHP Tweets ~ <span style="font-size: 1rem;vertical-align: middle; font-style: italic;">powered by Kofix Tech</span></a>
<ul id="nav-mobile" class="right hide-on-med-and-down">';
require 'nav.php';
echo '
</ul>
</div>
</nav>
</div>
<br>
<br>
<br>
<div class="row">
<div class="col s12 m4 offset-m4">
<div class="card-panel white lighten-2">
<div class="row">
<div class="col s2 m2" style="padding: 0;">
<img src="images/profile.png" alt="Contact Person" width="100%" class="z-depth-3">
</div>
<div class="col s10 m10">
<p>'.$user.'<p>
<p>'.$tweets_row["tweet_text"].'</p>
</div>
</div>';
$_SESSION['error'] = "Welcome back!!";
if (isset($_POST['action']) && $_POST['action'] == "edit_tweet") {
// edit tweet go here
require 'openmysqlconnection.php';
$tweetdata = mysql_query("SELECT * FROM tweets where id='".$_POST['tweet_id']."' ");
$tweetdata_row = mysql_fetch_assoc($tweetdata); // array [user_id = "@user"]
// begin editing
echo '
<div class="row">
<form action="process_control.php" method="post" style="padding: 15px;border-radius: 15px">
<input type="hidden" name="tweet_id" value="'.$_POST['tweet_id'].'">
<textarea id="textarea1" name="tweet_body" class="materialize-textarea grey lighten-3" style="padding: 0px 10px; -webkit-box-sizing: border-box;">'.$tweetdata_row['tweet_text'].'</textarea>
<button class="btn waves-effect waves-light" type="submit" name="action" value="tweet_edit" style="width: 100%;text-transform: none"><i class="material-icons left">movie</i>Save tweet !!</button>
</form>
<div style="padding: 15px;">
<a href="'.$_SERVER['HTTP_REFERER'].'" class="btn waves-effect waves-light" style="width: 100%;text-transform: none"><i class="material-icons left">call_missed</i>Cancel</a>
</div>
</div>';
// finish editing
}elseif (isset($_POST['action']) && $_POST['action'] == "edit_profile") {
// edit profile go here
require 'openmysqlconnection.php';
$userdata = mysql_query("SELECT * FROM users where id='".$_SESSION['user_reg_id']."' ");
$userdata_row = mysql_fetch_assoc($userdata); // array [user_id = "@user"]
// begin editing
echo '
<div class="row">
<form action="process_control.php" method="post" style="padding: 15px;border-radius: 15px">
<textarea id="textarea1" name="user_bio" class="materialize-textarea grey lighten-3" style="padding: 0px 10px; -webkit-box-sizing: border-box;">'.$userdata_row['user_bio'].'</textarea>
<button class="btn waves-effect waves-light" type="submit" name="action" value="profile_edit" style="width: 100%;text-transform: none"><i class="material-icons left">movie</i>Save Status !!</button>
</form>
<div style="padding: 15px;">
<a href="'.$_SERVER['HTTP_REFERER'].'" class="btn waves-effect waves-light" style="width: 100%;text-transform: none"><i class="material-icons left">call_missed</i>Cancel</a>
</div>
</div>';
// finish editing
}
echo '
</div>
</div>
</div>';
require 'script.php';
echo'</body>
</html>';
}else{
// wrong page or wrong request
http_response_code(404);
include('404.php');
die();
}
?>