• Content count

  • Joined

  • Last visited

  • Days Won


john_jack last won the day on April 25

john_jack had the most liked content!

Community Reputation

6 Neutral

About john_jack

  • Rank
  • Birthday 11/16/1984

Previous Fields

  • Languages

Profile Information

  • Gender
  • Location
  1. here you can check out this tutorial ,might help you do what you ask .Tutorial
  2. <?php session_start(); //start the session for the page include("../include/db.php"); //include database file include("../include/settings.php"); //include configuration file //Check if page was entered by a submit button $email=$_POST['email']; //Get username !!FROM FORM!! $email = ereg_replace(" ", "", $email); //take away all spaces from username (if any) !!FROM FORM!! $password=base64_encode($_POST['password']); //Get name !!FROMFORM!! if (empty($email) || empty($password)) { echo "Empty fields";} else{ //check to see if the username or email allready excists $ck=$flash->prepare("SELECT * FROM `user` WHERE `email`=:email AND `password`=:password "); //get rows where the username or email address is allready registered $ck->bindParam(':email',$email); $ck->bindParam(':password',$password); $ck->execute(); //if email address allready excists if($ck->rowCount() > 0){ echo "user loged in successfully"; } else{ echo "Login or password inccorect";} } ?> use that phpand keep the alert(result); it should be clear now
  3. i believe you got gist of it, when using ajax calls, you do not use header :location instead you can echo a unique value depending on the case . and on the javascript side use if(result=="something"){do something} if(result=="somethingelse"){do somethingelse} Good luck
  4. replace that with this so you knowwhat you are doing : success: function(result) { alert(result); } and on the php side depending on what error pops up make a code : empty fields echo 0 login was succesfull echo 1 login or pass incorrect echo 2
  5. replace the "header('location:../indess.html');" with " echo '0';" all theredirections should be done on the Ajax/Js side
  6. replace that with lets say : success: function(result) { if(result=="1") { //here is where you do redirect to ../user.html using javascript check the paths window.location.assign("../user.html") } else { //error hadling show a message login or password incorrect depending on what or where you want to display them } } and replace this with : if($ck->rowCount() > 0){ echo "1"; } else{ echo "0";}
  7. Look at the Console Tab to check the Error.
  8. firstname isnt the field name it should be $_POST['email']; since you have this :
  9. maybe this was the problem ? should'nt it be "./../member/login.php;" what do you get as an error? it would help a lot Good luck
  10. i am not sure where all these variables come from or their value ,but heres what you do : when you load the page in the browser check if each the checkboxs have a different value than the other . when that is confirmed ,check the other page that receives the data from the form and try to echo the value of each checkbox to make sure the data was received properly . one last thing was $_SESSION['follow_success'] declared as an array ? if not, then it will only keep the last value received inside the loop . you should also consider a different name for each checkbox, having multiple $_post . Godd luck .
  11. you can split the page into 2 pages for example index.php : <!DOCTYPE html> <html> <link rel="stylesheet" href="style.css" type="text/css"> <link href="" rel="stylesheet"> <meta name="kontakt"> <head> </head> <body> <div class="col-md-12"> <div class="form-area"> <div id="error" style="color:#FF6633"></div> <form method="post" action="#" onsubmit="sendmail()"> <br style="clear:both"> <h3>Piši nam</h3> <div class="form-group"> <input type="text" class="form-control" name="fname" placeholder="Ime" id="idname"> <span class="error">* </span> </div> <div class="form-group"> <input type="text" class="form-control" name="email" placeholder="Email" id="idemail"> <span class="error">* </span> </div> <div class="form-group"> <input type="text" class="form-control" name="subject" placeholder="Naslov" id="idsubject"> <span class="error">* </span> </div> <div class="form-group"> <textarea class="form-control" type="textarea" placeholder="Sporočilo" id="idmessage" name="message" rows="8"></textarea> <span class="error">* </span> </div> <input type="submit" class="btn btn-primary" name="submit" value="Submit"> <!--<button type="button" name="submit" class="btn btn-primary pull-right" value="Submit">Pošlji</button>--> </form> </div> </div> <script> document.getElementById("error").display="none"; function sendmail() { event.preventDefault(); fname=document.getElementById("idname").value; email=document.getElementById("idemail").value; subject=document.getElementById("idsubject").value; message=document.getElementById("idmessage").value; //alert(fname); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("error").innerHTML = this.responseText; } };"POST", "./verify.php", true); xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xhttp.send("fname=" + fname + "&email=" + email + "&subject=" + subject +"&message=" + message); } </script> </body> </html> and a seconf page that handles the the inputs for eg : verify.php <?php // define variables and set to empty values $nameErr = $emailErr = $genderErr = $websiteErr = ""; $name = $email = $gender = $comment = $website = ""; if ($_SERVER["REQUEST_METHOD"] == "POST") { if (empty($_POST["fname"])) { echo "Vpiši ime!"; die(); } else { $name = test_input($_POST["fname"]); if (!preg_match("/^[a-zA-Z ]*$/",$name)) { echo "Dovoljene so samo črke in presledki!"; die(); } } if (empty($_POST["email"])) { echo "Vpiši email naslov!"; die(); } else { $email = test_input($_POST["email"]); if (!filter_var($email, FILTER_VALIDATE_EMAIL)) { echo "Vpišite veljaven email naslov!"; die(); } } if (empty($_POST["subject"])) { echo "Vpiši naslov sporočila!"; die(); } else { $subject = test_input($_POST["subject"]); } if (empty($_POST["message"])) { echo "Vpiši sporočilo!"; die(); } else { $message = test_input($_POST["message"]); } // email Stuff goes here here } function test_input($data) { $data = trim($data); $data = stripslashes($data); $data = htmlspecialchars($data); return $data; } ?>
  12. If you want the form error handling to be smooth and user friendly, isuggest you use javascript/ajax check this js/ajax . for the mailing part check this : .(if you are working on a local environement the mail will probably fail,you would have to tweek your php.ini but still the email received might be considered as spam) . Good luck.
  13. You can store the query results in a multidimensional array check this "example 4" you can then return the array .
  14. If you want to use Javascript, here's the aproach : replace the following : with this : echo '<td data-sort-initial="Descending"><a href="#" onclick="delete_row(' . $row['id'] . ')">Delete</a></td>'; now we will define the function delete_row(x) as a javascript function : function delete_row(x) { // this is to avoid firing the default click on the <a> element event.preventDefault(); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("errordiv").innerHTML = this.responseText; } };"GET", "delete.php?id=" + x , true); xhttp.send(); } you will have to add a <div id="errordiv"></div> in the page that displays the Rows . all you have to do now is echo the errors on the delete.php like this : <?php /* DELETE.PHP Deletes a specific entry from the 'players' table */ // connect to the database include('connect-db.php'); // check if the 'id' variable is set in URL, and check that it is valid if (isset($_GET['id']) && is_numeric($_GET['id'])) { // get id value $id = $_GET['id']; // delete the entry $result = mysql_query("DELETE FROM players WHERE id=$id") or die(mysql_error()); // redirect back to the view page echo 'the player id '.$id.' was succesfully deleted'; //header("Location: view.php"); } else // if id isn't set, or isn't valid, redirect back to view page { echo 'The id provided was empty or not Numeric '; //header("Location: view.php"); } ?> so no more redirections . keep in mind that the mysql_ functions are outdated i suggest you use PDO or Mysqli to acces your database .checkout this for more info about Ajax Goodluck
  15. let me answer your questions first : 1) Can the "videos" folder be set to private where no one can go to and see ALL the videos at once? if you have access to your Apache Configuration file you can prevent directory listing and you can also use .htaccess file to prevent that . 2) Will my page be mobile friendly? it depends on your CSS , is your template mobile friendly ? as for the easy way to share your video on your website try to upload the video on youtube and display it on the page , Good luck .