-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsend_msg.php
More file actions
203 lines (174 loc) · 7.68 KB
/
send_msg.php
File metadata and controls
203 lines (174 loc) · 7.68 KB
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
<?php
$msg = isset($_REQUEST['msg'])?$_REQUEST['msg']:'';
// require 'assets/facebook.php';
require 'assets/connect.php';
// require 'functions.php';
// // Create our Application instance (replace this with your appId and secret).
// $facebook = new Facebook(array(
// 'appId' => '1434847386732269',
// 'secret' => '1c500d02a9a8c52dd1b8fd84546ec172',
// ));
// // Get User ID
// $user = $facebook->getUser();
// // We may or may not have this data based on whether the user is logged in.
// //
// // If we have a $user id here, it means we know the user is logged into
// // Facebook, but we don't know if the access token is valid. An access
// // token is invalid if the user logged out of Facebook.
// if ($user) {
// try {
// // Proceed knowing you have a logged in user who's authenticated.
// $user_profile = $facebook->api('/me');
// } catch (FacebookApiException $e) {
// error_log($e);
// $user = null;
// }
// }
// Login or logout url will be needed depending on current user state.
// if ($user) {
// $logoutUrl = $facebook->getLogoutUrl();
// saveProfile($user_profile);
// $result = getArea($user_profile);
// } else {
// $statusUrl = $facebook->getLoginStatusUrl();
// $loginUrl = $facebook->getLoginUrl();
// saveProfile('none');
// $result = getArea('none');
// }
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script src="js/jquery.min.js"></script>
<script src="https://www.google.com/jsapi"></script>
<title>chatlas</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="http://fonts.googleapis.com/css?family=Source+Sans+Pro:300,400,600,300italic" rel="stylesheet" type="text/css" />
<!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]-->
<script src="js/jquery.min.js"></script>
<script src="http://maps.google.com/maps/api/js?sensor=false"
type="text/javascript"></script>
<script src="js/jquery.poptrox.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/init.js"></script>
<script src="js/functions.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="http://refaktorthemes.com/other/sites/default/files/css/css_TADBuXPPmrbFPyk6hDkPf84uFQkeNTvGKIQWxMUpw28.css" />
</noscript>
<script type="text/javascript">
google.load('search', '1');
var imageSearch;
function addPaginationLinks() {
// To paginate search results, use the cursor function.
var cursor = imageSearch.cursor;
var curPage = cursor.currentPageIndex; // check what page the app is on
var pagesDiv = document.createElement('div');
for (var i = 0; i < cursor.pages.length; i++) {
var page = cursor.pages[i];
if (curPage == i) {
// If we are on the current page, then don't make a link.
var label = document.createTextNode(' ' + page.label + ' ');
pagesDiv.appendChild(label);
} else {
// Create links to other pages using gotoPage() on the searcher.
var link = document.createElement('a');
link.href="/image-search/v1/javascript:imageSearch.gotoPage("+i+');';
link.innerHTML = page.label;
link.style.marginRight = '2px';
pagesDiv.appendChild(link);
}
}
var contentDiv = document.getElementById('content');
contentDiv.appendChild(pagesDiv);
}
function searchComplete() {
// Check that we got results
if (imageSearch.results && imageSearch.results.length > 0) {
// Grab our content div, clear it.
var contentDiv = document.getElementById('content');
contentDiv.innerHTML = '';
// Loop through our results, printing them to the page.
var results = imageSearch.results;
var i = 0;
//for (var i = 0; i < results.length; i++) {
// For each result write it's title and image to the screen
var result = results[i]; //alert(result.url);
var imgContainer = document.createElement('div');
var title = document.createElement('div');
// We use titleNoFormatting so that no HTML tags are left in the
// title
title.innerHTML = result.titleNoFormatting;
var newImg = document.createElement('img');
// There is also a result.url property which has the escaped version
var img_path = result.url;
newImg.src=img_path;//"/image-search/v1/result.tbUrl;"
//imgContainer.appendChild(title);
//imgContainer.appendChild(newImg);
$.ajax({
type: "POST",
url: "write_image.php",
data: { img_url: img_path, img_name: result.titleNoFormatting, post_msg: "<?php echo $msg; ?>"}
}).done(function(data) {
$('#dashboard').show();
$('#latest_img').attr('src', data);
});
// Put our title + image in the content
contentDiv.appendChild(imgContainer);
//}
// Now add links to additional pages of search results.
addPaginationLinks(imageSearch);
}
}
function OnLoad() {
// Create an Image Search instance.
imageSearch = new google.search.ImageSearch();
imageSearch.setRestriction(
google.search.ImageSearch.RESTRICT_IMAGESIZE,
google.search.ImageSearch.IMAGESIZE_SMALL);
imageSearch.setRestriction(
google.search.ImageSearch.RESTRICT_FILETYPE,
google.search.ImageSearch.FILETYPE_JPG
);
// Set searchComplete as the callback function when a search is
// complete. The imageSearch object will have results in it.
imageSearch.setSearchCompleteCallback(this, searchComplete, null);
// Find me a beautiful car.
imageSearch.execute("<?php echo $msg; ?>");
// Include the required Google branding
google.search.Search.getBranding('branding');
}
google.setOnLoadCallback(OnLoad);
</script>
</head>
<body style="font-family: Arial;border: 0 none;">
<div id="branding" style="float: left;display:none"></div><br />
<div id="content" style="display:none">Loading...</div>
<section id="dashboard" style="margin-top: -5%;">
<div class="content">
<ul>
<li><img src="" id="latest_img" class="allimg" /></li>
<?php
//get all images
$res = mysql_query("select picture from conversation where picture is not null order by id desc");
while($row = mysql_fetch_array($res)){
//echo '=='.$row['picture'];
if(file_exists($row['picture'])){
?>
<li><img src="<?php echo $row['picture']; ?>" class="allimg" /></li>
<?php
}
}
?>
<li><img src="post_images/img_1174025557_140111_050523" class="allimg" /></li>
<li><img src="post_images/new_img_942533377_140111_062406" class="allimg"/></li>
<li><img src="post_images/new_img_1321478248_140111_010628"/></li>
<li><img src="post_images/new_img_610419253_140111_010711"/></li>
</ul>
</div>
</section>
</body>
</html>