Jump to content

john_jack

Members
  • Posts

    77
  • Joined

  • Last visited

Posts posted by john_jack

  1. var file1 is declared inside javascript, if you try console.log(file1) it should work .

    when you call Response.Write("file1=" + file1) this is an ASP call which cannot access the variable File1 (which is a javascript variable)

    Good luck

  2. on the second screenshot the Enable/disable checkbox is not checked .you should also verify your api-login and transactionkey make sure they are both correct.

    i assume you already have a woocommerce account linked to your credit card / bank account .

  3. Take a look at Media queries https://www.w3schools.com/css/css_rwd_mediaqueries.asp these are what you need to make your style reshape it self when on a small resolution , that can also fix your image size problem .(you gonna have to write your proper css that you want to be executed on each @Media query)

    for the font problem theres already an existing css file somewhere in the website which overrides your current css  .

    using !important; in css  to override the previous css .

  4. <?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

    • Like 1
  5. 9 minutes ago, Panta said:

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

    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

     

  6. 56 minutes ago, Panta said:

    success: function() { // Success message $('#success').html("<div class='alert alert-success'>"); $('#success > .alert-success').html("<button type='button' class='close' data-dismiss='alert' aria-hidden='true'>&times;") .append("</button>"); $('#success > .alert-success') .append("<strong>Your message has been sent. </strong>"); $('#success > .alert-success') .append('</div>'); //clear all fields $('#loginForm').trigger("reset"); }

    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 

    1 hour ago, Panta said:

    if($ck->rowCount() > 0){ header('location:../user.html'); } else{ header('location:../inde.html');}

    with :

     if($ck->rowCount() > 0){
        echo "1";
          }
         else{  echo "0";}

     

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

  8. 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="https://fonts.googleapis.com/css?family=Ubuntu" 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;
    						
    						
    
    			
    					  	 
    					
        }
      };
      xhttp.open("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;
    }
    
    ?>

     

  9. If you want to use Javascript, here's the aproach :

    replace the following :

    10 hours ago, danjesama said:

    echo '<td data-sort-initial="Descending"><a href="delete.php?id=' . $row['id'] . '">Delete</a></td>';

    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;
           }
        };
        xhttp.open("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 https://www.w3schools.com/xml/ajax_intro.asp

    Goodluck

     

  10. let me answer your questions first :

    1) Can the "videos" folder be set to private where no one can go to www.mysite.com/videos 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 .

×
×
  • Create New...