Completed
Push — master ( 3bdd73...3b96a7 )
by Ankit
02:28
created

message.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
session_start();
3
if(isset($_SESSION['start']) and empty($_GET['user']))
0 ignored issues
show
Comprehensibility Best Practice introduced by
Using logical operators such as and instead of && is generally not recommended.

PHP has two types of connecting operators (logical operators, and boolean operators):

  Logical Operators Boolean Operator
AND - meaning and &&
OR - meaning or ||

The difference between these is the order in which they are executed. In most cases, you would want to use a boolean operator like &&, or ||.

Let’s take a look at a few examples:

// Logical operators have lower precedence:
$f = false or true;

// is executed like this:
($f = false) or true;


// Boolean operators have higher precedence:
$f = false || true;

// is executed like this:
$f = (false || true);

Logical Operators are used for Control-Flow

One case where you explicitly want to use logical operators is for control-flow such as this:

$x === 5
    or die('$x must be 5.');

// Instead of
if ($x !== 5) {
    die('$x must be 5.');
}

Since die introduces problems of its own, f.e. it makes our code hardly testable, and prevents any kind of more sophisticated error handling; you probably do not want to use this in real-world code. Unfortunately, logical operators cannot be combined with throw at this point:

// The following is currently a parse error.
$x === 5
    or throw new RuntimeException('$x must be 5.');

These limitations lead to logical operators rarely being of use in current PHP code.

Loading history...
4
{
5
?>
6
<!DOCTYPE html>
7
<html>
8
	<head>
9
		<meta charset="UTF-8">
10
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
11
		<title>Messages</title>
12
		<link rel="stylesheet" href="css/style.css">
13
	 	<link rel="stylesheet" href="css/font-awesome-4.6.3/css/font-awesome.min.css">
14
	 	<script type="text/javascript" src="js/jquery-3.0.0.min.js"></script>
15
	<script type="text/javascript" src="js/index.js"></script>
16
	<script src="js/handlebars.min.js"></script>
17
    <script src="js/moment.min.js"></script>
18
	<!-- // <script type="text/javascript" src="js/mobile.js"></script> -->
19
20
	</head>
21
	<body>
22
		<!-- header -->
23
24
		<div class="header">
25
			<a id="brand" href="">OpenChat</a>
26
			<ul class="nav-right">
27
				<li><a href="account.php">Account</a></li>
28
				<li><a href="index.php">About</a></li>
29
				<li><a href="logout.php">Log Out</a></li>
30
			</ul>
31
32
			<div class="mob-right">
33
34
35
				<div class="dropdown">
36
					<div class="line"></div>
37
					<div class="line"></div>
38
					<div class="line"></div>
39
				</div>
40
			</div>
41
		</div>
42
43
		<div id="dropdown">
44
			<ul class="dropdown-list">
45
				<li><a href="account.php">Account</a></li>
46
				<li><a href="index.php">About</a></li>
47
				<li><a href="logout.php">Log Out</a></li>
48
			</ul>
49
		</div>
50
51
		<!-- search -->
52
53
		<div class="search_message">
54
			<input type="text" name="search_item" id="search_item" value="" onkeyup="search_choose();" placeholder="Search">
55
			<!-- <select name='search_item' id='search_item' onkeyup='search_choose()'></select> -->
56
		</div>
57
58
59
		<!-- sidebar -->
60
61
		<div class="sidebar" id="message">
62
		</div>
63
64
		<!-- chat name -->
65
66
		<div class="chat_name" id="chat_name">
67
			<div id="chat_heading">
68
			</div>
69
			<div class="compose_text" id="compose_text">
70
				<b id="to">To:</b> &nbsp;<input type="text" name="compose_name" placeholder="Name" id="compose_name" value="" onkeyup="ComposeChoose()">
71
				<div id="compose_selection">
72
					<ul id="suggestion">
73
					</ul>
74
				</div>
75
			</div>
76
77
			<div class="compose" onclick="compose()"><a href="#">+ New Message</a></div>
78
		</div>
79
80
81
82
		<!-- conversation -->
83
		<div class="main" id="conversation">
84
		</div>
85
86
		<!-- Reply -->
87
88
		<div class="conversation_reply">
89
			<textarea type="text" name="" id="text_reply" placeholder="Write a reply.."></textarea>
90
			<br>
91
			<span><input type="submit" name="submit" value="Reply" onclick="reply()"> &nbsp;<i onclick="startDictation()" class="fa fa-microphone" aria-hidden="true"></i></span>
92
		</div>
93
94
		<div class="mob-reply">
95
			<div class="input-group margin-bottom-sm text_icon">
96
				<input type="text" name="" id="text_reply" placeholder="OpenChat..">
97
				<span class="send" ><i class="fa fa-paper-plane" aria-hidden="true" onclick="reply()"></i></span>
98
			</div>
99
100
			<br>
101
		</div>
102
103
104
		<div class="mob-footer">
105
			<span>
106
				<a href="#" onclick="init()"><i class="fa fa-arrow-left fa-lg" aria-hidden="true"></i></a>
107
				<a href="#" onclick="show_search()"><i class="fa fa-search fa-lg" aria-hidden="true"></i></a>
108
				<a href="#" onclick="compose()"><i class="fa fa-plus-circle fa-lg" aria-hidden="true"></i></a>
109
			</span>
110
		</div>
111
112
		<script type="text/javascript">
113
			$(".dropdown").click(function() {
114
				$("#dropdown").slideToggle();
115
				// $("#dropdown").show();
116
			});
117
			$("span .fa").click(function() {
118
				$(".search_item").show();
119
			});
120
			// var w='';
121
			// if(window.innerWidth<500 && window.outerHeight!=w)
122
			// {
123
			// 	console.log(1);
124
			// 	w=window.outerHeight-135;
125
			// 	$(".main").css('min-height',w);
126
			// }
127
		</script>
128
	</body>
129
</html>
130
131
<?php
132
}
133
else{
134
	header('Location:http://localhost/openchat');
135
}
136
?>
137