Author |
Topic |
|
apswater
VP-CART Super User
444 Posts |
Posted - May 25 2005 : 09:37:45
|
On 4.5 ...
Does anyone happen to know a variable I can use to trigger tags to appear only when logeed on as admin.
on my site labwater.com I added a bunch of edit buttons for updating categories and products on the fly.
I need to instead say " If logged in as admin then write the edit tag"
can anyone help? I was hoping on not spending a lot of time tracing the admin files for it.
|
|
greatphoto
VP-CART Super User
USA
304 Posts |
Posted - May 25 2005 : 10:09:00
|
I think this is what you are after: If GetSess("ShopAdmin")="" Then
You have an interesting idea here....but I'm wondering about security. This seems benign enough to me, but I'd think long and hard about it. I'd hate to do anything that could weaken security.
Nathan
|
|
|
apswater
VP-CART Super User
444 Posts |
Posted - May 25 2005 : 10:23:14
|
Thanks...
I am not worried about the security of this mod... andy hacker can call the same asp file for edit but admin should cover the attempt just fine.
I want to remove the edit tags because people just cant seem to resist clicking on em!
THanks.
|
|
|
apswater
VP-CART Super User
444 Posts |
Posted - May 25 2005 : 10:49:13
|
ok I got it working but havd to change the = to <> here is how I create the edit buttons so you dont have to go into the admin section to change things.
If GetSess("ShopAdmin")<>"" Then %><a href="shopa_addcategory.asp?which=<%=cat_id%>&idfield=categoryid&table=categories&database="><font face="Arial" size="1" color="black">Edit</font></a><br><br><% end if
This is a major time saver.
Now I just need to figure out how to slip an if then into the tmp_products and prodcuts templates that are html. Any thoughts?
I tried the <% stuff but it didnt work...can an html file have an if then or doyou have to have it as asp first?
Edited by - apswater on May 25 2005 10:58:09 |
|
|
greatphoto
VP-CART Super User
USA
304 Posts |
Posted - May 26 2005 : 00:05:22
|
By the way, the code I posted is found in the ShopCheckAdmin subroutine in shop$db.asp. ...and yes, I should have changed the "equals" to "not equals."
"I am not worried about the security of this mod... andy hacker can call the same asp file for edit but admin should cover the attempt just fine. "
Yeah, you are right. I thought about this later this morning. This is a great idea and I'll probably implement it on my site...except editing individual products is probably more important to me than categories, so your other questions are really important:
"Now I just need to figure out how to slip an if then into the tmp_products and prodcuts templates that are html. Any thoughts? I tried the <% stuff but it didnt work...can an html file have an if then or doyou have to have it as asp first?"
These are good questions. I thought of the same myself. I have been interested in using ASP code in html headers and templates as well, but haven't done it.
There are some good references for the concept of asp code in templates elsewhere in the forum. There is a hack listed here (http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=1524) whose concept may be used for what we want. It doesn't really let you add ASP code to the template, but will have a similar affect. Also in this post, support states that it is not possible to use ASP code directly in the templates.
In this post (http://www.vpasp.com/virtprog/vpaspforum/topic.asp?TOPIC_ID=1449) multiple people seemed to think it is possible to add ASP code to templates, but I don't think they realized at the time that templates work differently in this regard than other HTML.
Hmmm...I have a better idea based on past posts that I'll drop in here shortly....
|
|
|
greatphoto
VP-CART Super User
USA
304 Posts |
|
apswater
VP-CART Super User
444 Posts |
Posted - May 26 2005 : 13:00:53
|
Thanks so much. I was hoping it would be easier. Only one of the edit tags is in displayproducts. The rest are in the the templates. I guess I could always hard code the display instead of using the html template.
As far as adding the tag for categoriy edits, I use that one a lot. You can tweek your descriptions much easier and to add a category you simply pull up a category that is similar, change what you need and save as new. it is much faster then setting up cateogries or products from scratch.
|
|
|
|
Topic |
|