Author |
Topic |
Freeman II
Junior Member
232 Posts |
Posted - 22 March 2001 : 21:13:26
|
If i wanna add a link to test.asp?id=xxxxxx how can i make the xxxxxx part change when user is changed. for example, userA;s id is 8 when he opens the page he sees a link to test.asp?id=8, when userB opens the page he sees a link to test.asp?id=9
ive tried to use different method (from default.asp, pop_profile.asp)but none of them worked. should i use a code that reads cokies that tells the user id??
this is what i use now
-----------------------------------
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " 'strSql = strSql & strTablePrefix & "FORUM.F_STATUS, " 'strSql = strSql & strTablePrefix & "FORUM.CAT_ID, " 'strSql = strSql & strTablePrefix & "FORUM.F_SUBJECT, " 'strSql = strSql & strTablePrefix & "FORUM.F_URL, " 'strSql = strSql & strTablePrefix & "FORUM.F_DESCRIPTION, " 'strSql = strSql & strTablePrefix & "FORUM.CAT_ID, " 'strSql = strSql & strTablePrefix & "FORUM.F_TOPICS, " 'strSql = strSql & strTablePrefix & "FORUM.F_COUNT, " 'strSql = strSql & strTablePrefix & "FORUM.F_LAST_POST, " 'strSql = strSql & strTablePrefix & "FORUM.F_STATUS, " 'strSql = strSql & strTablePrefix & "FORUM.F_TYPE, " 'strSql = strSql & strTablePrefix & "FORUM.F_PRIVATEFORUMS, " 'strSql = strSql & strTablePrefix & "FORUM.FORUM_ORDER, " strSql = strSql & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " strSql = strSql & strMemberTablePrefix & "MEMBERS.M_NAME " strSql = strSql & "FROM " & strTablePrefix & "FORUM " strSql = strSql & "LEFT JOIN " & strMemberTablePrefix & "MEMBERS ON " strSql = strSql & strTablePrefix & "FORUM.F_LAST_POST_AUTHOR = " strSql = strSql & strMemberTablePrefix & "MEMBERS.MEMBER_ID "
set rs = my_Conn.Execute(strSql)
%>
<a href="game1_main.asp?id=<% =rs("MEMBER_ID")%>">Enter</a>
<% rs.Close set rs = nothing end if %>
------------------------------------------------- the output is game1_main.asp?id=2 for some weired reason
thx alot for helping me! =) btw the code for the gambling game is almost done, just need a few tweaks to make it compatible with the forum
|
|
|
sumo
Junior Member
USA
121 Posts |
|
Freeman II
Junior Member
232 Posts |
Posted - 23 March 2001 : 16:11:25
|
any ideas on my above post?
Edited by - Freeman II on 23 March 2001 16:11:41 |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 23 March 2001 : 16:43:01
|
I must have missed your post because of the other post right after yours.
about your question:
I don't understand why you use the selectstatement to select the member-id. The variable STRdbntUserName contains the username when the user is logged on. And there is a function called getMemberNumber(fUser_Name) in inc_functions.asp that retrieves the user-id from the database based on the username, so then you could use: <a href="game1_main.asp?id=<% = getMemberNumber(STRdbntUserName) %>">Enter</a>
Pierre |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 24 March 2001 : 17:53:56
|
yeah! it works! thanks a lot gor! hmm..
what is the file that is responsible for +1 to FORUM_MEMBERS.M_POSTS whenever someone post a message? is it post.asp? if yes and you tell me which line... thanks
|
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 24 March 2001 : 18:08:51
|
that is in post_info.asp
around line 1295 you'll find a select case codeblock with amongst others this code: case "Reply" Response.Write("New Reply Posted!") DoPCount DoUCount Request.Form("UserName") DoULastPost Request.Form("UserName") case "ReplyQuote" Response.Write("New Reply Posted!") DoPCount DoUCount Request.Form("UserName") DoULastPost Request.Form("UserName") case "TopicQuote" Response.Write("New Reply Posted!") DoPCount DoUCount Request.Form("UserName") DoULastPost Request.Form("UserName") case "Topic" DoTCount DoPCount DoUCount Request.Form("UserName") DoULastPost Request.Form("UserName") Response.Write("New Topic Posted!")
The call DoUCount Request.Form("UserName") updates the postcount of the user making the post. DoPCount updates the total Posts count in FORUM_TOTALS DoTCount updates the total Topics count in FORUM_TOTALS DoULastPost Request.Form("UserName") updates the last post date in the FORUM_MEMBERS table (also important to remember to do !)
You can find that procedure DoUCount (and all the other mentioned subs) in inc_functions.asp: sub DoUCount(sUser_Name)
'## Forum_SQL - Update Total Post for user strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " SET " & strMemberTablePrefix & "MEMBERS.M_POSTS = " & strMemberTablePrefix & "MEMBERS.M_POSTS + 1 " strSql = strSql & " WHERE " & strDBNTSQLName & " = '" & sUser_Name & "'" '
my_Conn.Execute (strSql)
end sub
Pierre |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 24 March 2001 : 19:00:16
|
is there a code that -1 to MEMBERS_POSTS, when you delete a post.
|
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 25 March 2001 : 00:37:12
|
No, there is no code for that and that is by design. The postcount is the total amount of post you made sofar, even if some of them have been deleted. If a member floods the forums to get a higher postcount, the administrator can always lower his/her postcount.
I think there is a MOD for making this dynamic, but it is not the way it is implemented in the code.
Pierre |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 25 March 2001 : 11:45:33
|
where is the code for admins to modify the postcount? i wanna add a textbox like the postcount one for admins to change the value in M_GOLD without opening MS access. is it in pop_profile.asp? i can't find it.
|
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 25 March 2001 : 14:03:13
|
Part of the code is in pop_profile.asp and part in inc_profile.asp
in inc_profile.asp you'll find this code: if Request.Querystring("mode") = "goModify" then %> <tr> <td bgColor="<% =strPopUpTableColor %>"align=right nowrap><b><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"># of Posts: </font></b></td> <td bgColor="<% =strPopUpTableColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><INPUT name="Posts" size="25" value="<% = ChkString(RS("M_POSTS"), "display") %>"></font></td> </tr> <% end if
That displays a textbox with the current postcount if an admin opens the profile to modify it.
and in pop_profile.asp (where inc_profile.asp is included in) you'll find this code to save the (possibly) changed postcount: strSql = "UPDATE " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " SET M_NAME = '" & ChkString(Request.Form("Name"),"name") & "'" if strAuthType = "nt" then strSql = strSql & ", M_USERNAME = '" & ChkString(Request.Form("Account"),"") & "'" else if strAuthType = "db" then strSql = strSql & ", M_PASSWORD = '" & ChkString(Request.Form("Password"),"") & "'" end if end if strSql = strSql & ", M_EMAIL = '" & ChkString(Request.Form("Email"),"") & "'" strSql = strSql & ", M_TITLE = '" & ChkString(Request.Form("Title"),"") & "'" strSql = strSql & ", M_POSTS = " & ChkString(Request.Form("Posts"),"") & " " strSql = strSql & ", M_COUNTRY = '" & ChkString(Request.Form("Country"),"") & "'"
Just do a search for case "ModifyIt" and you'll find it a couple of lines below that.
So nothing fancy, just display a textbox when allowed and save it.
Pierre |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 25 March 2001 : 20:54:50
|
gor, i need some help with my gambling code. This code checks if the user has enough gold, if everything is ok it should say start gambling theres only one problem with my code(the code in red), it keeps saying that betgold is greater than nowgold. i don;t know if i used the correct code for getting a value from the database.
nowgold = user's gold betgold = the gold for gamle
--------------------------------------- <!--#INCLUDE FILE="config.asp" --> <!--#INCLUDE FILE="inc_functions.asp" --> <!--#INCLUDE FILE="inc_top.asp" --> <%
if strDBNTUserName = "" then doNotLoggedInGame else strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_USERNAME, " & strMemberTablePrefix & "MEMBERS.M_EMAIL " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_FIRSTNAME, " & strMemberTablePrefix & "MEMBERS.M_LASTNAME " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_TITLE" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ICQ" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_YAHOO" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_AIM" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_COUNTRY " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_POSTS" strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_CITY " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_STATE " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_COUNTRY " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_POSTS " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_GOLD " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_REP " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_HIDE_EMAIL " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_DATE " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_PHOTO_URL " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_HOMEPAGE" strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_LINK1, " & strMemberTablePrefix & "MEMBERS.M_LINK2 " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_AGE, " & strMemberTablePrefix & "MEMBERS.M_MARSTATUS " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_SEX, " & strMemberTablePrefix & "MEMBERS.M_OCCUPATION " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_SIG" strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_HOBBIES, " & strMemberTablePrefix & "MEMBERS.M_LNEWS " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_QUOTE, " & strMemberTablePrefix & "MEMBERS.M_BIO " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE MEMBER_ID=" & Request.QueryString("id")
set rs = my_Conn.Execute (strSql)
dim betgold,nowgold
nowgold = 0 betgold = 0 nowgold = rs("M_GOLD")
betgold=request.form("game1") if betgold <= 0 then %> <script language=vbscript> MsgBox "Error, no gold!" location.href = "javascript:history.back(1)" </script> <% else
if betgold > 100 then %> <script language=vbscript> MsgBox "Error, MAX. 100 Gold" location.href = "javascript:history.back(1)" </script> <% else
nowrep= rs("M_REP")
if nowrep < 5 then
%> <script language=vbscript> MsgBox "Sorry, not enough rep. point." location.href = "javascript:history.back(1)" </script> <% else
if betgold > nowgold then
%> <script language=vbscript> MsgBox "Sorry, you don't have enough gold " location.href = "javascript:history.back(1)" </script> <% else
m3 = Int(6 * Rnd + 1) m6 = Int(6 * Rnd + 1)
%>
Start gambling
<%
end if end if end if end if
rs.Close set rs = nothing
%><!--#INCLUDE FILE="inc_footer.asp" --><%end if%> ------------------------------------------------
|
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 26 March 2001 : 01:57:20
|
Sorry for stepping in guys, just thought I could help out before Gor comes around. You could try it this way Freeman:dim betgold,nowgold
nowgold = 0 betgold = 0 nowgold = rs("M_GOLD") nowrep= rs("M_REP")
betgold=request.form("game1") if betgold <= 0 then %> <script language=vbscript> MsgBox "Error, no gold!" location.href = "javascript:history.back(1)" </script> <% elseif betgold > 100 then
%> <script language=vbscript> MsgBox "Error, MAX. 100 Gold" location.href = "javascript:history.back(1)" </script> <% elseif nowrep < 5 then
%> <script language=vbscript> MsgBox "Sorry, not enough rep. point." location.href = "javascript:history.back(1)" </script> <% elseif betgold > nowgold then
%> <script language=vbscript> MsgBox "Sorry, you don't have enough gold " location.href = "javascript:history.back(1)" </script> <% else
m3 = Int(6 * Rnd + 1) m6 = Int(6 * Rnd + 1)
%>
Start gambling
<%
end if I moved the nowrep= rs("M_REP") up to the top. That should work.
|
|
|
Davio
Development Team Member
Jamaica
12217 Posts |
Posted - 26 March 2001 : 02:08:08
|
You could try using Response.Write("betgold is: " & betgold & "<br>nowgold is: " & nowgold) to see what each varaible has. You can put it after this code: betgold=request.form("game1"), which is right before the if statement. Then you can see why it keep saying betgold is greater than nowgold.
Edited by - Davio on 26 March 2001 02:09:42 |
|
|
gor
Retired Admin
Netherlands
5511 Posts |
Posted - 26 March 2001 : 03:16:38
|
quote:
Sorry for stepping in guys, just thought I could help out before Gor comes around.
no problem, this isn't an exclusive topic, you are very welcome to help/reply...
Pierre |
|
|
Freeman II
Junior Member
232 Posts |
Posted - 26 March 2001 : 17:19:31
|
thanks for your help, but it still don;t work
no matter what i put (a number betwwen 1-100) it still say "not enough gold" i used your code and it worked fine, it says: betgold: 60 nowgold:100 then the vb msgbox says: not enough gold.
here the code ---------------------------------- <!--#INCLUDE FILE="config.asp" --> <!--#INCLUDE FILE="inc_functions.asp" --> <!--#INCLUDE FILE="inc_top.asp" --> <%
if strDBNTUserName = "" then doNotLoggedInGame else
strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_USERNAME, " & strMemberTablePrefix & "MEMBERS.M_EMAIL " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_FIRSTNAME, " & strMemberTablePrefix & "MEMBERS.M_LASTNAME " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_TITLE" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_ICQ" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_YAHOO" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_AIM" strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_COUNTRY " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_POSTS" strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_CITY " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_STATE " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_COUNTRY " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_POSTS " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_GOLD " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_REP " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_HIDE_EMAIL " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_DATE " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_PHOTO_URL " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_HOMEPAGE" strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_LINK1, " & strMemberTablePrefix & "MEMBERS.M_LINK2 " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_AGE, " & strMemberTablePrefix & "MEMBERS.M_MARSTATUS " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_SEX, " & strMemberTablePrefix & "MEMBERS.M_OCCUPATION " strSql = strSql & ", " & strMemberTablePrefix & "MEMBERS.M_SIG" strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_HOBBIES, " & strMemberTablePrefix & "MEMBERS.M_LNEWS " strsql = strsql & ", " & strMemberTablePrefix & "MEMBERS.M_QUOTE, " & strMemberTablePrefix & "MEMBERS.M_BIO " strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS " strSql = strSql & " WHERE MEMBER_ID=" & Request.QueryString("id")
set rs = my_Conn.Execute (strSql) dim betgold,nowgold nowgold = 0 betgold = 0 nowgold = rs("M_GOLD") nowrep= rs("M_REP")
betgold=request.form("game1") Response.Write("betgold is: " & betgold & "<br>nowgold is: " & nowgold) if betgold <= 0 then %> <script language=vbscript> MsgBox "Error, no gold!" location.href = "javascript:history.back(1)" </script> <% elseif betgold > 100 then
%> <script language=vbscript> MsgBox "Error, MAX. 100 Gold" location.href = "javascript:history.back(1)" </script> <% elseif nowrep < 5 then
%> <script language=vbscript> MsgBox "Sorry, not enough rep. point." location.href = "javascript:history.back(1)" </script> <% elseif betgold > nowgold then
%> <script language=vbscript> MsgBox "Sorry, you don't have enough gold " location.href = "javascript:history.back(1)" </script> <% else
%>
Start gambling
<%
end if
%><!--#INCLUDE FILE="inc_footer.asp" --><%end if%> -------------------------------------- it works fine in other situations (if i put 0, the response is correct, "error no gold", also tested with 10000...)
|
|
|
Topic |
|
|
|