Jump to content

NotSunfighter

Members
  • Posts

    63
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by NotSunfighter

  1.  

     

    @williamh69 Next time you make a table remember to use <td> not <div> and You need a <tr> in there

    	    if($count ==0) {
    	         echo"<tr>";
    	         }
    	

    should have been just echo "<tr> No if.

    and

    <table  border='0' align='center' cellpadding='2' cellspacing='2' width='70%'>

    Is totally out of date and  wrong.

  2. Your HTML <table> is messed up. Your missing </tr> tags and using a table in a table is not the way to go when what you want can be done using css tooltips.

    If you run your code for a simple query and post the html resulting and explain it, I or someone else could give you the needed table code. Also tell us where the cursor is to get the output.

  3. And I'd remove objects from the array like this

    	<?php 
    	$cart_items = array("pants"=>"3", "shirt"=>"4",  "shoe"=>"5", "banana"=>"13",  "hat"=>"1"); 
    	 
    	if (($key = array_search('4', $cart_items)) !== false) {
    	    unset($cart_items[$key]);
    	}
    	 
    	foreach ($cart_items as $item => $quantity){ 
    	    echo "Item name is ".$item." and he wants this amount ".$quantity."\n"; 
    	}
    	?> 
    	

  4. It looks to me that your making things harder than they should be. Here's what I would do for a cart array:

    	<?php 
    	$cart_items = array("pants"=>"3", "shirt"=>"4",  "shoe"=>"5", "banana"=>"13",  "hat"=>"1"); 
    	foreach ($cart_items as $item => $quantity){ 
    	    echo "Item name is ".$item." and he wants this amount ".$quantity."\n"; 
    	}
    	?> 
  5. What cyberRobot said and I'm not happy with the script the way it is because somewhere you need to be loading HTML for it to work and what I'm about to do does not take that into consideration:

    	<?php
    	if(isset($_POST['login'])){ 
    	    if(isset($_COOKIE['login'])){           
    	        if($_COOKIE['login'] < 3){               
    	            $attempts = $_COOKIE['login'] + 1;              
    	            setcookie('login', $attempts, time()+60*10);         
    	        }else{
    	/* Please note this is an ECHO while your using echo"<script>alert()</script>"; below */
    	            echo 'You are banned for 10 minutes. Try again later';
    	            die;          
    	        }     
    	    }else{           
    	        setcookie('login', 1, time()+60*10);
    	        die; 
    	    } 
    	/* I have include the rest of this so you have a formatted cody */
    	    $username=$_POST['username']; 
    	    $password=$_POST['password']; 
    	    if(empty($username) && empty($password)){
    	        echo"<script>alert('please enter username and password')</script>";
    	    }
    	    if(empty($username) || empty($password)){
    	        echo"<script>alert('please enter username and password')</script>";
    	    }
    	    $pass= hash('sha512', $password);
    	    $set="Lecturer";
    	    $set2='Admin';
    	    $sel="select * from $tb1 where username='$username' and password='$pass'";
    	    $result=mysqli_query($con,$sel);
    	    $row=mysqli_fetch_array($result);
    	 
    	    if($row['username']== $username && $row['password']== $pass && $row['usertype']==$set){
    	        $_SESSION["username"] = $_POST["username"];  
    	        $_SESSION['last_login_timestamp'] = time();  
    	        $_SESSION['username'] = $username;
    	        header('location:userhome.php');   
    	    }elseif ($row['username']== $username && $row['password']== $pass && $row['usertype']==$set2){
    	        $_SESSION["username"] = $_POST["username"];  
    	        $_SESSION['last_login_timestamp'] = time();  
    	        $_SESSION['username'] = $username;
    	        header('location:adminhome.php'); 
    	    }else{
    	        echo"<script>alert('not registered/approved')</script>";
    	    }
    	}
    	?> 
    	

  6. I don't see how your uploading anything. Not saying that your not, I haven't tried doing this on a site to check. But you may be better off scraping the DIV heavy code you now have for some thing else. Copy/Paste this code pen and adjust your PHP to match:

    file upload - simple JS

     

    PS- It is considered BAD manners to ask a question in two forums the same day. Ask in one and wait a day or two before going to a new forum.

  7. I know this is old, but for people coming and read this - position sticky works depending where the element is in the page hyrachy. To stick a div to the body coordinates  That div MUST exist in the body and not in another div.

    so

    <body>

    <div class="navigation">Hello</div>

     

    will work, but

    <body>

    <header>

    <div class="navigation">Hello</div>

    will not.

×
×
  • Create New...

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.