Jump to content

piano0011

Members
  • Content count

    180
  • Joined

  • Last visited

Community Reputation

0 Neutral

About piano0011

  • Rank
    Advanced Member

Recent Profile Visitors

122 profile views
  1. I understand, I was trying to get it to work first before substituting it with the ?
  2. I have listened and in my other forum, I did mention that my database is working. I know that we all have our own unique ways to set up variables but I do understand how to get it to work with my database. I am not copying and pasting but am a visual learning and therefore learns thing when other people are showing contents, such as on the youtube videos. I just find it easier to learn that way. I have also read some stuff from stackoverflow but they mentioned that isset is mainly used to see if a variable is set such as in a form? I should use session to determine if a session exists or not? Besides, I have no prior computer skills so I need to find ways to learn from scratch and tried to make effort to learn..
  3. I just saw your comment just then... maybe I should change the || to &&.. That is weird.... I changed it to && and it does work but just wondering how come it is working in the tutorial? My apologies, he made a mistake in the video.. he forgot to check to see if it is an empty string
  4. Okay... because I am trying to follow this tutorial on how to set up a forum but I am stucked at around the 13:23 mins mark. When I tested the page at the end of that video segment, it is always saying that I am not logged in even though that I am.. I will attach the two latest files, which I think should be working hand in hand below. It should take me to the create_topic.php page. It seems that the $_GET variable is not picking up the cid <?php include_once 'header.php'; if (!isset($_SESSION['u_uid'])) { header("Location: index.php?view_category=notlogin"); exit(); } else { include_once 'includes/dbh.php'; $cid = $_GET['cid']; $logged = " <a href='create_topic.php?cid=".$cid."'>Click here to create a topic</a>"; $sql = "SELECT id FROM categories WHERE id= '".$cid."' LIMIT 1"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL error'; } else { mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $resultCheck = mysqli_num_rows($result); if ($resultCheck >0) { $sql2 = "SELECT * FROM topics WHERE category_id='".$cid."' ORDER BY topic_reply_date DESC"; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql2)) { echo 'SQL error'; } else { mysqli_stmt_execute($stmt); $result2 = mysqli_stmt_get_result($stmt); $resultCheck2 = mysqli_num_rows($result2); if ($resultCheck2 > 0) { $topics .= "<table width='100%' style='border-collapse: collapse:'>"; $topics .= "<tr><td colspan='3'><a href='forum.php'>Return to Forum Index</a>".$logged."</td></tr>"; $topics .= "<tr style='background-color: #dddddd:'><td>Topic Title</td>><td width='65' align='center'>Replies</td><td width='65' align='center'>Views</td></tr>"; $topics .= "<tr><td colspan='3'><hr></td></tr>"; while ($row = mysqli_fetch_assoc($result2)) { $tid = $row['id']; $title = $row['topic_title']; $views = $row['topic_views']; $date = $row['topic_date']; $creator = $row['topic_creator']; $topics .= "<tr><td><a href='view_topic.php?cid=".$cid."&tid=".$tid."'>".$title."</a><br /><span class='post_info'>Posted by: ".$creator." on ".$date."</span></td><td align='center'>0</td><td align='center'>".$views."</td></tr>"; $topics .= "<tr><td colspan='3'><hr /></td></tr>"; } $topics .= "</table>"; } else { echo "<a href='header.php'>Return to the Forum page</a>"; echo "<p> There are no topics in this Category yet.".$logged."</p>"; } } }else { echo "<a href='header.php'>Return to the Forum page</a>"; echo "<p> You are trying to view a catebory that does not exists yet.</p>"; } } } // This is the second file called create_topic.php <?php include_once 'header.php'; if ((!isset($_SESSION['u_uid'])) || ($_GET['cid'])) { header("Location: index.php?create_topic=notlogin"); exit(); } $cid = $_GET['cid']; ?> <!DOCTYPE html> <html> <head> <title></title> </head> <body> <form action="create_topic_parse.php" method="POST"> <label>Topic Title</label> <br></br> <input type="text" name="topic_title" size="98" maxlength="150"> <br></br> <label>Topic Content</label> <br></br> <textarea name="topic_content" rows="5" cols="75"></textarea> <br></br> <br></br> <input type="hidden" name="cid" value="<?php echo $cid; ?>"> <input type="submit" name="topic_submit" value="Create Your Topic"> </form> </body> </html>
  5. Hey guys! I have seen on the internet a couple of ways to write the following statement but the latter one looks a bit weird with that extra opening ( before !isset, which way is the norm here? if (isset($_POST['room']) || ($_POST['cottage']) || ($_POST['villa'])) { } but I have seen somewhere that you can also write if ((!isset($_POST['submit'])) || ($_GET['u_uid']))
  6. piano0011

    buttons not aligning at the center

    I can get my php form to process the timer result and insert the record into the database but when I add the header function, it keeps taking me to the header function instead of showing the timer. My guess is that because it is processing the php first, it is doing this. I just like to know if I can have a header function it this is the case? <?php include_once 'includes/dbh.php'; $timer = 60; $time = $_POST['time']; $user_uid = 'piano0011'; $sql = "UPDATE primerlevel_tests SET time_achieved = ? WHERE user_uid = ? "; $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql)) { echo 'SQL error'; } else { mysqli_stmt_bind_param($stmt, "ss", $time, $user_uid); mysqli_stmt_execute($stmt); } header("Location: update.php?countdown=success"); exit(); ?> <style type="text/css"> div.timer { text-align: center; margin: 15% auto; } #msg { color: red; } </style> <html> <head> <script type="text/javascript"> var timer = <?php echo $timer ?>; // 1 minute timer.... var min = 0; var sec = 0; var active = 1; function startTimer() { if (active==0) return; if (timer == 0) timer = <?=$timer?> ; timer--; min = parseInt(timer/60); sec = parseInt(timer%60); if(timer < 1) { $timer = 0; min = 0; sec = 0; document.getElementById("msg").innerHTML = "You have to start again" ; document.getElementById("time").value = "00:00:00"; active = 1; return; } else { if (min < 10) min = '0'+min; if (sec < 10) sec = '0'+sec; document.getElementById("msg").innerHTML = "" ; document.getElementById("time").value = "00:" + min.toString() + ":" + sec.toString(); } setTimeout(function() { startTimer(); }, 1000); } function stop() { if (min + sec > 0) { alert("Thank you for completing the test. You finished the test at: " + min.toString() + ":" + sec.toString()); document.form1.submit(); active = 0; } } </script> </head> <body> <div class="timer"> <h1>Welcome to Timertrone.</h1> <br> <form name='form1' action='' method="post"> Time left: <input type="text" name="time" id="time" value=""> </form> <span id="msg"></span> </br> <button name="start" onclick="startTimer()">Start</button> <button name="stop" onclick="stop()">Stop</button> </div> </body> </html> It only works if I get rid of the // header("Location": update.php?countdown=success");
  7. piano0011

    buttons not aligning at the center

    Ok.. i will take a look and also, will the above work and is it good practice to use a separate page for the javascript code? As in <script src="">?
  8. piano0011

    buttons not aligning at the center

    I might have asked this before but should I be storing the value: 00:00:00 as time or timestamp? I guess timestamp is for date where you have the days as well but for time, it is just time? and I don't have to explode and remove the : to store it I guess?
  9. piano0011

    horizontal line not showing at the right place

    I just tried it above the h2 tag as follows, without the position property but it looks like this:
  10. piano0011

    buttons not aligning at the center

    Barand, why did you use a form name="form1" because I can't see this in any of the functions? Apologies... I see it..
  11. piano0011

    buttons not aligning at the center

    ok.... that explains it because if the value of the timer is not checked or input in the form, there will always be an error... I think... My apologies Barand, I can't believe I posted in different places.. I must have overlooked! In your code, can I add a submit buttons and a form tag ? I will try to see if that will process the variables in php with a form tag.. You guys should make some video tutorials as some people may be more of a visual learner.... but thanks!
  12. Hey guys! I am trying to add some horizontal rules to the following code and there should be one right before my second h2 tag (which is located at the end of the code) but it is showing a bit lower instead as shown below;... do I have to use position relative to move it, is this a common practice for this element? while ($row = mysqli_fetch_assoc($result)) { echo '<div class="update_heading">'; echo '<b><h2>Below are your premium membership information for Level 1</b></h2>'; echo '</div>'; echo '<br></br>'; echo '<div class="update_text">'; echo '<h3>'; echo 'Your premium membership subscription plan A is: <div class="information">'.$row['subscriptionplan'].'</div>'; echo '<br></br>'; echo 'Your premium membership date of subscription for subscription plan A is: <div class="information"> '.$row['subscriptionplandate'].'</div>'; echo '<br></br>'; if ($row['feesmonthly'] === null) { echo 'Your premium membership fee for subscription plan A is: <div class="information"> $'.$row['feesyearly'].'</div>'; } else { echo 'Your premium membership fee for subscription plan A is: <div class="information"> $'.$row['feesmonthly'].'</div>'; } echo '<br></br>'; if ($row['paid'] == 0) { echo 'Your premium membership payment status for subscription plan A is: <div class="information"> Not paid </div>'; } else { echo 'Your premium membership payment status for subscription plan A is: <div class="information">Paid</div>'; } echo '<br></br>'; echo 'Your premium membership expiry date for subscription plan A is: <div class="information">'.$row['expirydate'].'</div>'; echo '<br></br>'; echo 'Your premium membership paid by date for subscription plan A is: <div class="information">'.$row['paidbydate'].'</div>'; echo '<br></br>'; if ($row['emailreminder'] == 0) { echo 'You have <div class="information">no overdue fees </div> for subscription plan A'; } else { echo 'You have <div class="information"> overdue fees </div> for subscription plan A'; } echo '<br></br>'; if ($row['activate'] == 0) { echo 'You <div class="information">need to activate</div> your premium membership for subscription plan A'; } else { echo 'You <div class="information">have already activated</div> your premium membership for subscription plan A'; } echo '<br></br>'; echo '<br></br>'; echo '</h3>'; echo '</div>'; echo '<hr>'; echo '<div class="update_heading2">'; echo '<b><h2>Below are your premium membership information for Level 2</b></h2>'; echo '</div>';
  13. piano0011

    buttons not aligning at the center

    I think I forgot to change the stop button type to button as well. When I changed both buttons type to buttons, then it does work but I am not sure why my isset function is always showing as error? I am trying to add another button for the user to submit it for the timer result to be processed but it is showing as undefined index: <?php if (!isset($_POST['submit'])) { header ("Location: update.php?countdown2=error"); } else { $timer = 60; $result = $_POST['timer']; echo $result; } ?> <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="style.css"> <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet"> </head> <body> <script> var timer = <?php echo $timer ?>; // 1 minute timer.... var min = 0; var sec = 0; function startTimer() { min = parseInt(timer/60); sec = parseInt(timer%60); if(timer<1) { document.write("You have to start again!"); } document.getElementById("time").innerHTML = + min.toString() + ":" + sec.toString(); timer--; setTimeout(function() { startTimer(); }, 1000); } function stopTimer() { alert("Thank you for completing the test. You finished the test at: " + min.toString() + ":" + sec.toString()); var result = document.getElementById('time').innerHTML; document.getElementById('input').value = result; // window.location.href = "update.php"; } </script> <form> <div class="timer"> <h1>Welcome to Timertrone.</h1> <br></br> <form action="" method="POST"> <b>Time Left: </b> <span class="timer_display" id="time"> ...</span> <input type="text" name="timer" id="input"> <h1 id="buttons"></h1> <button type="button" name="start" onclick="startTimer()">Start</button> <button type="button" name="stop" onclick="stopTimer()">Stop</button> <button type="submit" name="submit" >Submit</button> </form> </div> </div> </body> </html>
  14. piano0011

    buttons not aligning at the center

    I tried using stopTimer for my button and also changed the function to stopTimer. It almost work but the time does display in the input box but only momentarily. I tried to echo it into the php but it says undefined index <?php $timer = 60; $result = $_POST['timer']; echo $result; ?> <!DOCTYPE html> <html> <head> <title></title> <link rel="stylesheet" type="text/css" href="style.css"> <link href="https://fonts.googleapis.com/css?family=Lobster" rel="stylesheet"> </head> <body> <script> var timer = <?php echo $timer ?>; // 1 minute timer.... var min = 0; var sec = 0; function startTimer() { min = parseInt(timer/60); sec = parseInt(timer%60); if(timer<1) { document.write("You have to start again!"); } document.getElementById("time").innerHTML = + min.toString() + ":" + sec.toString(); timer--; setTimeout(function() { startTimer(); }, 1000); } function stopTimer() { alert("Thank you for completing the test. You finished the test at: " + min.toString() + ":" + sec.toString()); var result = document.getElementById('time').innerHTML; document.getElementById('input').value = result; // window.location.href = "update.php"; } </script> <form> <div class="timer"> <h1>Welcome to Timertrone.</h1> <br></br> <form action="" method="POST"> <b>Time Left: </b> <span class="timer_display" id="time"> ...</span> <input type="text" name="timer" id="input"> <h1 id="buttons"></h1> <button type="button" name="start" onclick="startTimer()">Start</button> <button type="submit" name="stop" onclick="stopTimer()">Stop</button> </form> </div> </div> </body> </html>
  15. piano0011

    music fonts required

    I tried to have a look at other programs such as raw etc but i guess most of these programs only open svg files and not movie files... i triex movie makers, but don't have other movie editors.. are there any free editors that support both movies and svg? Maybe i have to save that picture as something else like a gif? I think movie makers only support gif or png ect
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.