Forum

> > Off Topic > JavaScript HLP
Forums overviewOff Topic overviewLog in to reply

English JavaScript HLP

14 replies
To the start Previous 1 Next To the start

old JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Quote
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 >

old Re: JavaScript HLP

Waldin
User Off Offline

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

old Re: JavaScript HLP

Waldin
User Off Offline

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

old Re: JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Quote
@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

old Re: JavaScript HLP

ohaz
User Off Offline

Quote
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.

old Re: JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Quote
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

old Re: JavaScript HLP

Yates
Reviewer Off Offline

Quote
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.
edited 2×, last 21.07.16 09:27:01 am

old Re: JavaScript HLP

RedizGaming
GAME BANNED Off Offline

Quote
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

old Re: JavaScript HLP

Yates
Reviewer Off Offline

Quote
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.
edited 1×, last 21.07.16 11:18:32 pm

old Re: JavaScript HLP

Yates
Reviewer Off Offline

Quote
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.
edited 1×, last 22.07.16 09:55:22 am
To the start Previous 1 Next To the start
Log in to replyOff Topic overviewForums overview