Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Posts posted by Lamez

  1. sure.

     

    $q = mysql_query("SELECT * FROM videos ORDER BY id DESC");
    while($f = mysql_fetch_assoc($q)){
      echo $f['id']."<BR>";
    }
    
    

     

    I'm not sure if that is what you are looking for. That while loop returns an array names $f.

  2. I started when I was about 15, creating my own website in PHP, for no reason really. I would download code of the internet and take a look at it, and try to reproduce it. I then eventually became to the point where I could write code on my own without looking. I am now to the point where I can write clean, efficient code, I am now learning OOP. I figured it was time. I am 19 now. Oh, and this forum helped me out tons with my problems, I mean tons! PHP was my first language,  I now C, C++,  and Java. I do think learning a different language does help you grasp the concept in beginner programmers.

  3. 1.OpenID, if I add it to my website, will I be able to gather data such as email, first name, last name, etc.

     

    2.I am leaning OOP in PHP and I am trying to make a mysqli class, I'm not very good at it. Maybe you guys can help me here is what I have so far. Am I doing okay?

     

    <?php
    class database{
    	var $mysqli;
    	function __construct($host, $user, $pass, $db){
    		$this->mysqli = new MySQLi($host, $user, $pass, $db);
    	}
    	function query($query){
    		return mysqli_query($this->mysqli, $query);
    	}
    	function fetchAssoc($query){
    		return mysqli_fetch_assoc(mysqli_query($this->mysqli, $query));
    	}
    	function numRows($query){
    		return mysqli_num_rows(mysqli_query($this->mysqli, $query));
    	}
    	function delete($table, $where){
    		return $this->query("DELETE FROM $table WHERE ".$where);
    	}
    }
    ?>
    

  4. I have actually seen a free script out there that detects adult images, what you could do is have that analyze the images uploaded if one is found to be an adult image, have the website email you and you can login and take a look at it, and approve it or delete it.

     

    I would do a search for you, but I am at work and I am afraid something naughty will result in my quest for this script.

  5. A Trojan Horse is a virus that attaches itself to other programs that are known to NOT be harmful, and then when the program is executed, the Trojan horse starts doing whatever it was programmed to do. 

     

    The best thing to do is when you start seeing your mouse move again, unplug yourself from the internet. Doing so by, unplugging your ethernet cable, unplugging external wireless receivers, or somehow disconnecting yourself through hardware, not software. That way if you do have a intruder they don't know you are disconnecting them.

     

    If the mouse has stopped moving, they are accessing you over the internet, and you need to remove any software that allows direct access to your computer. (Any remote desktop protocols: RDP's, Logmein, VNC, etc.)

     

    If the mouse still is moving, it might be something interfering with your wireless mouse, as mentioned above. Remove the wireless receiver.

     

    If the mouse has stopped moving, you have found your problem.

     

    If the mouse is still moving, chances are they you have some sort of playful virus (I doubt it, since most viruses want to be incognito). It could be faulty mouse drivers, or improper mouse drivers. If you are on a laptop, it might be you accidentally touching the track pad while using your other mouse or something of that nature.

  6. Hmm, something like this?

     

    		if(is_array($_POST['del'])){
    			foreach($_POST['del'] as $id){
    				mysql_query("DELETE FROM ".TBL_ADMINS." WHERE id = '$id'");
    			}
    		}else
    			mysql_query("DELETE FROM ".TBL_ADMINS." WHERE id = '$id'");
    

  7. I have a multiple checkbox page. I have handled these before, well. However, this time I am getting a strange error.

     

    Here it is:

    Warning: Invalid argument supplied for foreach() in C:\wamp\www\TheSportZone Store\admin\manageAdmin.php on line 10

     

    Here is Line 10:

    foreach($_POST['del'] as $id){

     

    Entire foreach body:

    		foreach($_POST['del'] as $id){
    			mysql_query("DELETE FROM ".TBL_ADMINS." WHERE id = '$id'");
    		}
    

     

    Any ideas? I have done this before, as such, and it worked well.

  8. Lol I like how this was posted on May 6th. So you are still not a noob ? Learning takes time.

    Here is how I validate emails:

    function validEmail($email){
    return filter_var($email, FILTER_VALIDATE_EMAIL);
    }
    

     

    Good ol' one liners.

  9. I'm more or less getting a logic error, so I cannot provide any syntactical errors.

     

    The function in question is suppose to take two variables and compare them. I also have a boolean variable to see if I care about the case of the variables. However if I do something like this:

     

    compare("NAME", "name", false);

    The function returns false.

     

    Here is the function:

    function compare($var1, $var2, $caseMatters){
    if(!$caseMatters && !is_numeric($var1) && !is_numeric($var2)){
    	strtolower($var1);
    	strtolower($var2);
    }
    return md5($var1) === md5($var2);
    }
    

     

    Any thoughts?

  10. I revised my functions like so:

    function startTime($min){ //Starts the time clock (TC), should only be used in the loginAdmin and updateTime functions.
    $min *= 60;
    if(!isset($_SESSION['~TC:Min']) || $_SESSION['~TC:Min'] != $min)
    	$_SESSION['~TC:Min'] = $min;
    //$_SESSION['~TC:Time'] = time() + $_SESSION['~TC:Min'];
    updateTime();
    }
    function updateTime(){
    //startTime($_SESSION['~TC:Min']); //No need to do the same thing twice. Resets the clock per page.
    $_SESSION['~TC:Time'] = time() + $_SESSION['~TC:Min'];
    }
    function expiredTime(){//True if time has expired; false otherwise.
     return time() > $_SESSION['~TC:Time'];
    }
    

     

    Then I forgot to refresh the page, so it works great now!

  11. Okay, so I printed out the timestamps. I am doing something wrong:

     

    Here is time(): 1272660826

    Here is $_SESSION['~TC:Time']: 1.6926659444736E+30

    I got that large number after I refreshed the page a couple times. Any suggestions?

  12. add "/files/". to name.

    like so

    $name = "/files/".$_FILES['filename']['name'];
    

     

    or wait do this instead:

       $name = $_FILES['filename']['name'];
       $folder = "/files/".$_FILES['filename']['name'];
       move_uploaded_file($_FILES['filename']['tmp_name'], $folder);
    

     

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