Make Page Only for Admin - نوشته شده در (1311 Views)
Senior Member
leatherlips
مطلب: 1838
1838
I have a pop up page that I only want accessible by moderators or admins. Right now if someone types in the URL they can see it. I want them to get a message saying the page is not able to be viewed by them.
I think it has to do with mlev = 2 or something but I don't know how to add it.<
 پیش‌فرض مرتب‌سازی برای تاریخ DESC به معنی جدیدترین است  
 تعداد در صفحه 
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
I found out the answer myself. At least I think this is the right way to do it. It appears to be working.
I added this near the top of the page after the includes:

Code:
If mLev < 2 Then
Response.Redirect("default.asp")
End If
<
نوشته شده در
Advanced Member
Etymon
مطلب: 2396
2396
1 = Member
2 = Author
3 = Moderator
4 = Admin

What you have will work, but normally it would be:

Code:
if mLev < 3 then
Response.Redirect("default.asp")
end if

<
نوشته شده در
Senior Member
MaD2ko0l
مطلب: 1053
1053
so what does this bit fo code do then? its in all the admin_ pages

Code:
if Session(strCookieURL & "Approval") <> "15916941253" then
scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
end if
<
© 1999-2010 MaD2ko0l
نوشته شده در
Average Member
Andy Humm
مطلب: 908
908
Mad, I found if you use the session check and the admin/moderator has time expired or not logged in, the popup window diverts to a full forum page with full header and full footer, all crammed into the small pop up window. No problems though if an external visitor types the popup window url into the browser window then the full page is ok.

This if mLev < 3 then Response.Redirect("default.asp") end if allows you to ignore time sessions etc and points the vistor to the default, straight away.<
نوشته شده در
Advanced Member
Etymon
مطلب: 2396
2396
I remember the guys here talking about the "15916941253" part a long time ago and how the number is just an arbitrary number. I am pretty sure you can change it to what you want as long as you do it throughout your code. I think I also remember another person who made the number longer while another person made the number random with a generator.
From what I remember those statements are true.
Is that the question you were asking?


<
نوشته شده در
Senior Member
leatherlips
مطلب: 1838
1838
This bit of code is doing what I want:

If mLev < 3 Then
Response.Redirect("default.asp")
End If

Thanks!<
 
شما باید یک متن وارد کنید