Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

xcislav

Members
  • Joined

  • Last visited

Everything posted by xcislav

  1. I've marked as solved by BrowserBugs. (i thank you for your attention & code) Answer is simple to give different forms different names in html. <input type="text" name="user1"> AND if(isset($_POST['user1']) name user $_POST[use and that's all
  2. Thanks, -- -- -- -- The task to solve the error-spamming was done by if(): var lu1=p.children[lu-1]; var lu2=p.children[lu-2] if (lu1) lu1.style.color="black"; if (lu2) lu1.style.color="black"; ... ... ... Every error-line was prevented by if. Program worked like a filter. Errors and necessary code were executed all the same. Errors weren't very harsh so program worked because of it's half code (correct one). If eliminated these error throwings.
  3. <p id="p"> <span style="text-decoration:none">A</span> <span style="text-decoration:none">B</span> <span style="text-decoration:none">C</span> <span style="text-decoration:none">D</span> <span style="text-decoration:none">E</span> <span style="text-decoration:none">F</span> <span style="text-decoration:none">G</span> <span style="text-decoration:none">H</span> <span style="text-decoration:none">I</span> <span style="text-decoration:none">J</span> </p> <script> p = document.getElementById("p"); y="a~1 b~4"; w=y.split(" "); l=w.length; for (u=0;u<l;u++) { alert(l); v=w[u].split("~"); vv=v[1]; qq=parseInt(vv); rr=qq+1; rrr=qq+2; p.childNodes[rr].style.fontWeight="bold"; p.childNodes[rrr].style.fontWeight="bold"; } </script> TypeError: p.childNodes[rr].style is undefined It alerts once. Even the loop seems not working.
  4. I've done this: http://jsfiddle.net/ctns4ep9/ It shows the task as mini-example: <p>11111</p> <p>11111</p> <p>11111</p> <p>11111</p> <p>11111</p> <p>11111</p> <script> y="a~0 b~4"; w=y.split(" "); l=w.length - 1; for (u=0;u<l;u++){ v=w[u].split("~"); qq=v[1]; document.getElementsByTagName("p")[qq].style.color="black"; document.getElementsByTagName("p")[qq-1].style.fontWeight="normal"; document.getElementsByTagName("p")[qq-2].style.color="green"; document.getElementsByTagName("p")[qq-2].style.fontWeight="bold"; } </script> TypeError: document.getElementsByTagName(...)[(qq - 1)] is undefined. Should look like: HERE y defines any line of user ~ #position: y="a~0 b~4"; It could be "a~0 b~12 c~777 sara~9998". The separation of each pair (user/loc): w=y.split(" "); THEN, in the for loop we take only a location to mark the position by emphasizing corresponding <p>'s . Consider <p>'s in unlimited numbers. But the arithmetics couldn't be done - look up at the error, and notice the first of 4 lines (it's Ok), please document.getElementsByTagName("p")[qq].style.color="black"; Isn't Ok: document.getElementsByTagName("p")[qq-1].style.fontWeight="normal"; It is qq-1 that isn't OK (or +1 or any operation). There's that error even if I assign qqq=qq+2; And then place it into square brackets [qqq] (so, "minus-indices" or "plus-indices" doesn't matter). The same error! LITERALLY "a~0 b~12 c~777 sara~9998" is: 0 12 777 9998 They are the <p> with these numbers by order to be highlighted. The task is generally to go via each user and mark it's position on <p>. How could I address them, using + or - to make shifts from their initial positions 0 12 777 9998? (it's for the dynamic game which paints [q+1] and makes normal the previous [q+0] each loop as it goes).
  5. Hi, thank you for your attention! echo $_SESSION['user'] doesn't show To test it I made test.php: <?php session_start(); echo $_SESSION['user']; ?> It shows empty page. But without session_start(): NOCK, I'm very new to this php field, to debug. I even don't know how to do it in general. So this example which I'm learning is simple and sometimes it works.
  6. $_POST can't be seen in the second part of login (after the registration part) in one-page authorization. index.php <!DOCTYPE html> <html> <h1>Register</h1> <form method="POST"> <input type="text" name="user"><br /><br /> <input type="pass" name="pass"><br /><br /> <input type="submit" name="ok1"><br /> </form> <?php session_start(); if(isset($_POST['user'], $_POST['pass'])){ require 'connection.php'; $zr++; $query = d()->prepare("INSERT INTO u (user, pass, loc) VALUES (:user, :pass, :loc)"); $query->bindParam(':user', $_POST['user']); $query->bindParam(':pass', $_POST['pass']); $query->bindParam(':loc', $zr); if($query->execute()){ $_SESSION['user'] = $row['user']; $_SESSION['pass'] = $row['pass']; header("Location: ".$_SERVER['PHP_SELF']); exit(); } else{ echo 'ERROR'; } } ?> <h1>Login</h1> <form method="POST"> <input type="text" name="user"><br /><br /> <input type="pass" name="pass"><br /><br /> <input type="submit" name="ok2"><br /> </form> <?php if(isset($_POST['user'], $_POST['pass'], $_POST['ok2'])){ require 'connection.php'; $query = d()->prepare("SELECT user, pass FROM u WHERE user=:user AND pass=:pass"); $query->bindParam(':user', $_POST['user']); $query->bindParam(':pass', $_POST['pass']); $query->execute(); if($row = $query->fetch()){ $_SESSION['user'] = $row['user']; $_SESSION['pass'] = $row['pass']; header("Location: ".$_SERVER['PHP_SELF']); exit(); } echo $_POST['user']; $us=$_SESSION['user']; echo 'user ',$us; } ?> <?php if(isset($_SESSION['user'])){ $us=$_SESSION['user']; echo '<br /> user ',$us, ' ', '<a href="logout.php">Logout</a>'; echo '<br />', '<a href="zrs.php">zero session</a>'; } else { echo '<br /> <a href="register.php">Register</a>'; } ?> </html> connection.php <?php function d(){ try{ $db = new pdo("mysql:host=localhost;dbname=tx;","root","hyuiuik"); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $db; } catch(PDOException $e){ echo 'ERROR', $e->getMessage(); } } ?> I was advised to put echo $_POST['user'] inside isset () check because of an error: That advice wasn't helpful at all. And I've returned back the echo $_POST['user'] - to see error and think of it again. I also assigned a submit button a name "ok1" and "ok2". The second submit is checked again for pressing after the second form. So the $_POST doesn't show up while the $_SESSION is ok (as the data adds to MySQL). Help me with the login+registration page please! (because I feel abashed when many files around in OS). I want to operate $_POST and $_SESSION for my the simplest game in JS. _ thanks in advance to all of you and bless you goodness!
  7. Am also an administrator (support). Just to intruduce. How could I respond because of ..in order to describe my fault? I need it to do quickly to be correctly write into a head first right impression about me. PS: I'm from native Kiev (kievan), Ukraine.
  8. The idea is simple. A key you press (a letter) appears in updated page: keyj.php: <input id='k'></input> <script type="text/javascript"> document.getElementById('k').onkeypress=function() { <?php $db=new PDO('mysql:host=localhost;dbname=test;charset=utf8','$us','$ps'); $db->exec("UPDATE TXT SET texts=k.value"); $rl=$db->query("SELECT texts FROM TXT"); print_r($rl->fetchColumn()); ?> } </script> The intention is to have text on the screen via print_r. I successfully used it in another php to exchange information with MySQL and users screen (worked). Here - the more you type and the more k.value is the more text will be on screen (just from server). Unfortunately something went wrong.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.