Google+

Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rezolvat O intrebare...
#1
Vreau sa imi fac un forum RPG si as vrea ca useri dupa ce fac un test sa fie automat pusi in alt grup (depinde de puncta)
#2
Da se poate face asa ceva.
#3
Pai si cum se poate face?
#4
un link catre forumul tau.
#5
il am localhost
#6
scriptul testului il ai facut? ce cunostinte de php ai?
#7
minime..
si da l-am facut
#8
poti sa postezi scriptul aici sau nu vrei sa il faci public?
daca nu vrei sa il faci public da-mi un mesaj privat cu scriptul si incerc sa te ajut cumva.
#9
Ti-am dat MP
#10
astazi am terminat formularul de testare al userilor si de mutare in grupul corespunzator pentru AALLEEX.

test_promovare.php

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<?php
//chdir('forum'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="global.css" />
<script type="text/javascript" src="jscripts/popup_menu.js"></script>
<script type="text/javascript" src="jscripts/general.js"></script>
<script type="text/javascript" src="jscripts/prototype.js"></script>
<title>Test Promovare</title>
</head>
<body>
<?php echo $header; ?>
<!-- Start Content Template -->
<?php

if($mybb->user['uid'])
{
echo "
<table width=\"100%\" border=\"0\" align=\"center\">
<tr>
<!-- start: test_template -->
<td valign=\"top\">
<form action=\"rezultat_promovare.php\" method=\"post\" >
<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"2\"><strong>Bine ai venit la testul de promovare ".$mybb->user['username']."!</strong></td>
</tr>
<tr>
<td class=\"tcat\"><strong>1.) Oglinda lui Erised ti-ar arata:</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q1\" value=\"1\" /> Glorie eterna adusa de castigarea Turnirului celor Trei Vrajitori.
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q1\" value=\"2\" /> Pe tine in mijlocul prietenilor, sanatosi si fericiti.
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q1\" value=\"3\" /> Note maxime la terminarea examenelor de sfarsit de an.
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q1\" value=\"4\" /> Directorul scolii inmanandu-ti Cupa Caselor.
</td>
</tr>
<tr>
<td class=\"tcat\"><strong>2.) Esti nevoit sa-ti petreci cateva ore dupa cursuri in Sala de Detentie pentru o altercatie cu un elev din alta casa. Este si el prezent acolo, dar nu spune nimic si ramane tacut. Tu:</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q2\" value=\"2\" /> Te gandesti ca ai putea intra in vorba cu el, dar totusi nu o faci.
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q2\" value=\"4\" /> Ai impresia ca timpul trece mult prea greu si nu mai ai rabdare, iar celalalt elev ramane la fel de tacut in banca lui.
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q2\" value=\"1\" /> Iti vezi de treburile tale si parasesti incaperea oftand usurat ca ti-ai sfarsit detentia.
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q2\" value=\"3\" /> Te gandesti la cate lucruri ai putea face in acel timp si regreti ca ai ripostat atitudinii lui si ai ajuns in detentie.
</td>
</tr>
<tr>
<td class=\"tcat\"><strong>3.) Daca ai fi un Animag, ce forma ti-ai alege?</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q3\" value=\"3\" /> Bufnita
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q3\" value=\"2\" /> Lebada
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q3\" value=\"1\" /> Lup
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q3\" value=\"4\" /> Pantera
</td>
</tr>
<tr>
<td class=\"tcat\"><strong>4.) Daca ai putea sa alegi o abilitate pe care sa o stapanesti, aceea ar fi:</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q4\" value=\"4\" /> Sa influentezi deciziile unui om pentru ca acesta sa faca alegerile corecte
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q4\" value=\"1\" /> Sa poti vedea slabiciunile unui om
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q4\" value=\"3\" /> Sa citesti gandurile celor din jur
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q4\" value=\"2\" /> Sa ii faci pe altii sa spuna adevarul si sa nu se lase condusi de minciuni
</td>
</tr>
<tr>
<td class=\"tcat\"><strong>5.) Consideri ca regulile sunt:</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q5\" value=\"2\" /> Facute cu un scop si menite sa fie respectate
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q5\" value=\"4\" /> Menite sa fie nerespectate din cand in cand, dar doar pentru adrenalina si distractie
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q5\" value=\"3\" /> Realizate de oameni intelepti care vor sa fereasca vrajitorimea de pericole
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q5\" value=\"1\" /> Facute pentru a fi incalcate
</td>
</tr>
<tr>
<td class=\"tcat\"><strong>6.) La ce te gandesti cel mai mult in cadrul unei zile?</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q6\" value=\"4\" /> Prieteni
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q6\" value=\"1\" /> Dusmani
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q6\" value=\"3\" /> Lucruri noi, planuri, schimbari
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q6\" value=\"2\" /> Dreptate
</td>
</tr>
<tr>
<td class=\"tcat\"><strong>7.) La ce casa ai vrea sa fii sortat?</strong></td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q7\" value=\"6\" /> Cercetasi
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q7\" value=\"-4\" /> Viperini
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q7\" value=\"4\" /> Ochi-De-Soim
</td>
</tr>
<tr>
<td  class=\"trow1\">
<input type=\"radio\" name=\"q7\" value=\"0\" /> Astropufi
</td>
</tr>
<tr>
<td  class=\"trow1\" align=\"center\">
<input name=\"submit\" type=\"submit\" value=\"Verifica rezultatul\" />
</td>
</tr>
</table>
</form>

</td>
</tr>
</table> ";
} else {
/*echo "
<table width=\"100%\" border=\"0\" align=\"center\">
<tr>
<!-- start: test_template -->
<td valign=\"top\">
<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"2\"><strong>Bine ai venit la testul de promovare ".$mybb->user['username']."!</strong></td>
</tr>
</table>


</td>
</tr>
</table> ";*/
error_no_permission();
}
?>
<!-- End Content Template -->
<?php echo $footer; ?>
</body>
</html>


si rezultat_promovare.php

PHP Code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
<?php
//chdir('forum'); // path to MyBB
define("IN_MYBB", 1);
require './global.php';

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="global.css" />
<script type="text/javascript" src="jscripts/popup_menu.js"></script>
<script type="text/javascript" src="jscripts/general.js"></script>
<script type="text/javascript" src="jscripts/prototype.js"></script>
<title>Rezultatul testului</title>
</head>

<body>
<?php echo $header; ?>
<?php 
if($mybb->user['uid'])
{  
$scor = 0;
$q1 = $_POST['q1']; $scor = $scor + $q1;
$q2 = $_POST['q2']; $scor = $scor + $q2;
$q3 = $_POST['q3']; $scor = $scor + $q3;
$q4 = $_POST['q4']; $scor = $scor + $q4;
$q5 = $_POST['q5']; $scor = $scor + $q5;
$q6 = $_POST['q6']; $scor = $scor + $q6;
$q7 = $_POST['q7']; $scor = $scor + $q7;

echo "
<table width=\"100%\" border=\"0\" align=\"center\">
<tr>
<!-- start: test_template -->
<td valign=\"top\">
<table border=\"0\" cellspacing=\"1\" cellpadding=\"4\" class=\"tborder\">
<tr>
<td class=\"thead\" colspan=\"2\"><strong>Rezultatul testului!</strong></td>
</tr>
<tr>
<td class=\"tcat\">Felicitari ".$mybb->user['username']."! Ai acumulat un numar de $scor puncte.</td>
</tr>";
if($scor <= 4) { 
	echo "
	<tr>
	<td class=\"trow1\">ai fost repartizat in clasa Cercetasi</td>
	</tr>";	 
	$db->update_query("users", array("usergroup"=>'9'), "uid={$mybb->user['uid']}"); 
	}
	else if ($scor <= 8 && $scor > 4) {
	echo "
	<tr>
	<td class=\"trow1\">ai fost repartizat in clasa Viperini</td>
	</tr>";	 
	$db->update_query("users", array("usergroup"=>'8'), "uid={$mybb->user['uid']}");
	}
	else if ($scor <= 10 && $scor > 8) { 
	echo "
	<tr>
	<td class=\"trow1\">ai fost repartizat in clasa Astropufi</td>
	</tr>";	 
	$db->update_query("users", array("usergroup"=>'11'), "uid={$mybb->user['uid']}");
	}
	else {
	echo "
	<tr>
	<td class=\"trow1\">ai fost repartizat in clasa Ochi de Soimi</td>
	</tr>";	 
	$db->update_query("users", array("usergroup"=>'10'), "uid={$mybb->user['uid']}");
	}
echo "</table>
</td>
</tr>
</table> ";
	}
else
{
	error_no_permission();
	}

?>
<?php echo $footer; ?>
</body>
</html>


pe langa cele doua fisiere mai trebuie creat si un al treilea fisier global.css in acest fisier se va pune tot continutul fisierului global.css din Admin CP >>Templats & Styles >> Themes >> {tema}

fisierele se vor uploada pe server in directorul unde este instalat mybb-ul.

fisierele se pot uploada si in alta parte cu mentiunea ca va trebuie modificata linia 2 din fiecar fisiere cu numele directorului in care este instalat mybb-ul.

Observatie:
Daca fisierele au fost uploadate in alta parte decat folderul in care este instalat mybb-ul functia error_no_permission(); nu va functiona corect (nu se va putea face logare userului).
Cred ca acest neajuns se poate rezolva prin copierea fisierului member.php in locul unde s-au uploadat cele doua fisiere (nu am testat acest aspect).



Forum Jump:


Users browsing this thread: 1 Guest(s)