Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
php
/
maf
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ff42db25
authored
Jan 14, 2020
by
doszhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dos
parent
2bfd5e62
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
67 additions
and
1 deletions
+67
-1
Application/Home/Controller/IndexController.class.php
+35
-0
Public/static/js/common.js
+32
-1
No files found.
Application/Home/Controller/IndexController.class.php
View file @
ff42db25
...
@@ -36,6 +36,41 @@ class IndexController extends Controller
...
@@ -36,6 +36,41 @@ class IndexController extends Controller
$this
->
display
();
$this
->
display
();
}
}
function
commit
()
{
$referer
=
$_SERVER
[
'HTTP_REFERER'
];
$refererInfo
=
parse_url
(
$referer
);
if
(
$refererInfo
[
'host'
]
!=
$_SERVER
[
'HTTP_HOST'
]
)
{
header
(
"HTTP/1.0 404 Not Found"
);
exit
;
}
session_start
();
if
(
!
$_SESSION
[
'joinTime'
]
||
time
()
-
$_SESSION
[
'joinTime'
]
<
5
)
{
header
(
"HTTP/1.0 404 Not Found"
);
exit
;
}
$user
=
$this
->
get_user_info_from_cookie
();
if
(
!
$user
)
{
$this
->
ajaxReturn
(
array
(
'status'
=>
404
,
'msg'
=>
'用户信息错误'
,
'step'
=>
0
));
return
;
}
$name
=
$_POST
[
'name'
];
$tel
=
$_POST
[
'tel'
];
M
(
'info'
)
->
add
(
array
(
'uid'
=>
$user
[
'id'
],
'name'
=>
$name
,
'tel'
=>
$tel
,
'submit_time'
=>
time
()
));
}
public
function
http_get_data
(
$url
)
{
public
function
http_get_data
(
$url
)
{
$ch
=
curl_init
();
$ch
=
curl_init
();
...
...
Public/static/js/common.js
View file @
ff42db25
...
@@ -106,7 +106,8 @@ $(document).ready(function () {
...
@@ -106,7 +106,8 @@ $(document).ready(function () {
$
(
'.question-page .btn-submit'
).
on
(
'click'
,
submitAnswer
);
$
(
'.question-page .btn-submit'
).
on
(
'click'
,
submitAnswer
);
//抽奖
//抽奖
$
(
'.poster-page .btn-tryprize'
).
on
(
'click'
,
tryprize
);
$
(
'.poster-page .btn-tryprize'
).
on
(
'click'
,
tryprize
);
//
//提交信息
$
(
'.prize-page .btn-submit'
).
on
(
'click'
,
submit
);
...
@@ -144,6 +145,36 @@ $(document).ready(function () {
...
@@ -144,6 +145,36 @@ $(document).ready(function () {
});
});
});
});
function
submit
()
{
const
name
=
$
(
'input[name=name]'
).
val
();
const
tel
=
$
(
'input[name=tel]'
).
val
();
if
(
name
.
match
(
/^
\s
*$/
))
{
$
(
'#notification_area'
).
remove
();
my_notify
(
'请填写姓名'
);
return
false
;
}
else
if
(
!
tel
.
match
(
/^1
\d{10}
$/
))
{
$
(
'#notification_area'
).
remove
();
my_notify
(
'电话填写有误'
);
return
false
;
}
$
.
ajax
({
url
:
'/index/commit'
,
type
:
'POST'
,
data
:
{
name
:
name
,
tel
:
tel
},
success
:
function
()
{
$
(
'.prize-page'
).
hide
();
$
(
'.poster-page'
).
show
();
$
(
'input[name=name]'
).
val
(
''
);
$
(
'input[name=tel]'
).
val
(
''
);
}
})
}
function
tryprize
()
{
function
tryprize
()
{
$
(
'.poster-page'
).
hide
();
$
(
'.poster-page'
).
hide
();
$
(
'.prize-page'
).
show
();
$
(
'.prize-page'
).
show
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment