Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
azbne
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Andrew
azbne
Commits
6f0ceff9
Commit
6f0ceff9
authored
Nov 16, 2017
by
Andrew
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
list
parent
f22357e5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
8 deletions
+40
-8
func.php
inc/func.php
+14
-0
index.php
index.php
+2
-0
ndsp.php
pages/ndsp.php
+4
-8
ndsp_list.php
pages/ndsp_list.php
+20
-0
No files found.
inc/func.php
0 → 100644
View file @
6f0ceff9
<?
function
repare_ad
(
$ad
,
$ip
=
0
){
if
(
!
$ip
)
$ip
=
ip2long
(
"127.0.0.1"
);
$data
=
$ad
[
'data'
][
$ip
%
sizeof
(
$ad
[
'data'
])];
unset
(
$ad
[
'data'
]);
$ad
[
'price'
]
=
str_replace
(
'$[price]'
,
$data
[
'price'
],
$ad
[
'price'
]);
$ad
[
'ad_id'
]
.=
"_"
.
$data
[
'l_path'
];
$ad
[
'link'
]
=
"//"
.
$_SERVER
[
'HTTP_HOST'
]
.
'/tgo?l='
.
$ad
[
'link'
]
.
$data
[
'l_path'
]
.
'&s='
.
$ad
[
'ad_id'
];
$ad
[
'image'
]
=
"//"
.
$_SERVER
[
'HTTP_HOST'
]
.
'/timg/'
.
$ad
[
'image'
];
return
$ad
;
}
\ No newline at end of file
index.php
View file @
6f0ceff9
...
...
@@ -5,6 +5,8 @@ if($_SERVER['REQUEST_URI']=='/dsp')
else
if
(
preg_match
(
"/^\/ndsp\?/"
,
$_SERVER
[
'REQUEST_URI'
]))
require
(
"pages/ndsp.php"
);
else
if
(
preg_match
(
"/^\/ndsp_list/"
,
$_SERVER
[
'REQUEST_URI'
]))
require
(
"pages/ndsp_list.php"
);
else
if
(
preg_match
(
"/^\/go\?/"
,
$_SERVER
[
'REQUEST_URI'
]))
require
(
"pages/go.php"
);
...
...
pages/ndsp.php
View file @
6f0ceff9
...
...
@@ -9,20 +9,16 @@ $ip=ip2long($_GET['ip']);
if
(
!
$ip
)
die
;
require_once
(
"inc/func.php"
);
require_once
(
"inc/goods.php"
);
$res
=
array
();
foreach
(
$goods
as
$ads
)
{
$ad
=
$ads
[
mt_rand
(
1
,
10000
)
%
sizeof
(
$ads
)];
$data
=
$ad
[
'data'
][
$ip
%
sizeof
(
$ad
[
'data'
])];
unset
(
$ad
[
'data'
]);
$ad
[
'price'
]
=
str_replace
(
'${price}'
,
$data
[
'price'
],
$ad
[
'price'
]);
$ad
[
'ad_id'
]
.=
"_"
.
$data
[
'l_path'
];
$ad
[
'link'
]
=
"//"
.
$_SERVER
[
'HTTP_HOST'
]
.
'/tgo?l='
.
$ad
[
'link'
]
.
$data
[
'l_path'
]
.
'&s='
.
$ad
[
'ad_id'
];
$ad
[
'image'
]
=
"//"
.
$_SERVER
[
'HTTP_HOST'
]
.
'/timg/'
.
$ad
[
'image'
];
$ad
=
repare_ad
(
$ad
,
$ip
);
$ad
[
'cpc'
]
=
0.02
;
if
(
iconv_strlen
(
$ad
[
'title'
])
<=
50
&&
iconv_strlen
(
$ad
[
'description'
])
<=
50
)
$res
[]
=
$ad
;
}
...
...
pages/ndsp_list.php
0 → 100644
View file @
6f0ceff9
<?
require_once
(
"inc/goods.php"
);
require_once
(
"inc/func.php"
);
$res
=
array
();
foreach
(
$goods
as
$ads
)
{
foreach
(
$ads
as
$ad
)
{
$ad
=
repare_ad
(
$ad
);
echo
'<table width=800><tr><td width=150>'
;
echo
'<img width=150 height=150 src="'
.
$ad
[
'image'
]
.
'"></td>'
;
echo
'<td><a href="'
.
$ad
[
'link'
]
.
'"><span'
.
((
iconv_strlen
(
$ad
[
'title'
])
>
50
)
?
' style="color:red"'
:
''
)
.
'>'
.
$ad
[
'title'
]
.
'</span></a><br>'
;
echo
'<span'
.
((
iconv_strlen
(
$ad
[
'description'
])
>
50
)
?
' style="color:red"'
:
''
)
.
'>'
.
$ad
[
'description'
]
.
"</span><br><i>"
.
$ad
[
'price'
]
.
"</i></td></tr></table>"
;
}
}
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