Forum

> > Off Topic > JavaScript HLP
ForenübersichtOff Topic-ÜbersichtEinloggen, um zu antworten

Englisch JavaScript HLP

14 Antworten
Zum Anfang Vorherige 1 Nächste Zum Anfang

alt JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Zitieren
hello guys , i need help whit this..

when I click a button, this sum "max clicks + 1" when it reaches 5, this fails and stops.

Spoiler >

alt Re: JavaScript HLP

Waldin
User Off Offline

Zitieren
Idk what this is, but is this an type misstake?(line 10)
1
maxclicks = maxclick + 1;
It should be...?
1
maxclicks = maxclicks + 1;

alt Re: JavaScript HLP

Waldin
User Off Offline

Zitieren
1
if (maxclicks < 5) {
If maxclicks value is lower than 5...
1
maxclicks = maxclick + 1;
maxclicks value is maxclick (null?) + 1

alt Re: JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Zitieren
@user Waldin:

1
2
3
4
5
6
7
8
9
10
11
12
13
function gen(){
     var maxclicks = "";
     var msclicks = 0;
     if (maxclicks < 5) {
          var obt = document.getElementById("hue")
          var pri = repeater();
          var seg = repeater();
          var ter = repeater();
          var ptm = pri + "-" + seg + "-" + ter;
          obt.innerHTML = ptm;
          maxclicks = msclicks + 1;
     }
}

send me a mp

alt Re: JavaScript HLP

ohaz
User Off Offline

Zitieren
Your maxclicks Variable is a string. So when you add 1 to it, it'll be maxclicks == "1111" instead of maxclicks == 4. Initialise it with 0 instead. Also, apparently the gen function is called every time you do something, so you should initialise the maxclicks variable outside of the function or it will be reset every time you call the function.

alt Re: JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Zitieren
so , i have new problem.

how i can show points of users ?

1
<li><a href="./points.php">Points $points["user_id"]</a></li>

IMG:https://i.imgur.com/VIkKiOy.png

alt Re: JavaScript HLP

Yates
Reviewer Off Offline

Zitieren
If it's PHP then echo it:
1
<?= $points["user_id"] ?>
1
<?php echo $points["user_id"]; ?>
Depending on your PHP version. But I honestly hope you're not using PHP 5.4 or below.

Also:
1
2
3
4
5
6
7
8
9
10
11
12
var maxclicks = 0;
var obt = document.getElementById("hue");
function gen() {
	if (maxclicks < 5) {
		var ptm = repeater() + "-" + repeater() + "-" + repeater();

		obt.innerHTML = ptm;
		maxclicks++;
	} else {
		alert("nope.");
	}
}
Seeing as you are only overwriting the inner HTML of the element
hue
it's best to call
document.getElementById()
once instead of each time. It only saves like half a millisecond but still

And to be honest you would be better disabling the click of the element instead of it still calling the function each time.
2× editiert, zuletzt 21.07.16 09:27:01

alt Re: JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Zitieren
now this not change..

1
<li><a href="./stats.php">Points <?php echo (!isset($points));?></a></li>

on my database . Points = 5
but on my web only show 1 for all users...
IMG:https://i.imgur.com/q4U6Fj8.png

IMG:https://i.imgur.com/tQfQtc0.png

alt Re: JavaScript HLP

Yates
Reviewer Off Offline

Zitieren
Is your password a text? Oh my please no. Fix that asap.

Why are you using isset? Change your database structure and give
points
a default value of 0 then you should never have to unless you use the same code for another database table, which is highly unlikely.

Show us your code which requests the point count.
1× editiert, zuletzt 21.07.16 23:18:32

alt Re: JavaScript HLP

Yates
Reviewer Off Offline

Zitieren
One does not simply select an encryption in the database, you have to create on in your code upon registration. Google for encryption types and pick the best one, SHA is pretty much used everywhere - pick the latest stable version.

• Edit: I recommend anyone in wishing to actually help back off - the OP ignores all recommendations and is only willing to accept copy/paste code and not figure things out for himself. Feel free to try it if you still want to.
1× editiert, zuletzt 22.07.16 09:55:22
Zum Anfang Vorherige 1 Nächste Zum Anfang
Einloggen, um zu antwortenOff Topic-ÜbersichtForenübersicht