The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
whats going on here? :(
Yes im having abit of a problem with some hacking here. Maybe someone can help me out. Worth a shot huh? Okay here it goes.
I started to work on a hack that will remember if a user has clicked the I Agree on a T.O.S. Page. I was told to use a session or a setcookie. But then i decided to go ahead and do it this way: add a field to the user table called 'tos' or 'agree' or something - enum ('n','y'); set all current and new users to 'n'; on the usercp.php page, once they successfully enter it, check this field - if it's set to 'n' then show the user agreement form - if it's set to 'y' then let them go to there user cp panel. So heres what i did. I ran this SQL Query: [sql] ALTER TABLE user ADD tos ENUM('n','y') DEFAULT 'n'; [/sql] And this is what you put in the begining of the usercp.php after permissions are checked. PHP Code:
HTML Code:
<form action="tos.php" method="post"> <table cellpadding="0" cellspacing="0" border="0" width="100%"> <tr><td> <!-- My Agreement Terms Here --> <input type="checkbox" name="agree" value="y" /><strong>I have read, and agree to abide by tos rules.</strong> <input type="submit" value="I Agree"> </td></tr> </table> </form> Then i made a tos.php file with this: PHP Code:
Quote:
[sql]ALTER TABLE user ADD id BIGINT NOT NULL;[/sql] and when i did that i had this problem. lets say no users have clicked i agree yet. And user A logs in and see the new agreement, then clicks the i agree button. Then he is redirect back to the usercp page. which is perfect. But now when user B logs in, he don't see it cause user A has clicked yes. This is vice versa also. Seems if any one person clicks yes, it sets yes to all. i was told it may be that the $user array isn't returning the user data. Any other ideas why? Thanks guys!!!!!!!! |
#2
|
||||
|
||||
PHP Code:
PHP Code:
Also, you can require global.php and you wont have to use mysql_query: PHP Code:
|
#3
|
||||
|
||||
Steve is right
just a suggestions, when you add yes/no options, i would suggest to use the useroptions bitarray for that. Just a hint of course, enum isn't bad |
#4
|
|||
|
|||
Quote:
|
#5
|
||||
|
||||
at first you have to edit init.php
there you will find this codeblock: PHP Code:
PHP Code:
PHP Code:
PHP Code:
There is a thread at the mod hints and tips iirc explaining how to work with bitarrays |
#6
|
|||
|
|||
Thank you very much Xenon! Will look into this right now. Who needs sleep! (2 days and counting....)
|
#7
|
||||
|
||||
You're welcome
Hmm, who needs sleep? Would you be so kind to explain the word sleep? I don't recognize it ^^ |
#8
|
||||
|
||||
@Xenon
I don't think it is a good idea to use currently unused bits in standard bitfields for custom hacks. Sooner or later Jelsoft will use them for other options, which will cause problems then. |
#9
|
||||
|
||||
That's why i left out a few bits between
the way Jelsoft did it was to make it easier for custom additions, and so i would recommend to follow their way |
#10
|
|||
|
|||
would require deleting the old query and adding a new one?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|