Jump to content

marcus

Members
  • Posts

    1,842
  • Joined

  • Last visited

Posts posted by marcus

  1. What corbin did you can just do:

     

    <form name="submit" method="post" action="page.php" onSubmit="Submitted(submit)">
    <textarea name="textbox" cols="30" rows="14"></textarea>
    <br><input type="submit" value="Submit">
    </form>
    

  2. Fill in your own stuff:

     

    <?php
    
    function checkLogIn(){
    if(isset($_SESSION[email]) && isset($_SESSION[password])){
    	if(LogIn($_SESSION[email],$_SESSION[password])){
    	return true;
    	}else{
    	return false;
    	}
    }else{
    return false;
    }
    }
    
    
    function LogIn($email,$pass){
    $email = mysql_real_escape_string($email);
    $pass = mysql_real_escape_string($pass);
    
    if($email && $pass){
    //email and password are set
    	$sql = "SELECT * FROM `yourtable` WHERE `email`='$email'";
    	$res = mysql_query($sql) or die(mysql_error());
    
    		if(mysql_num_rows($res) > 0){
    		//email exists
    
    			$sql = "SELECT * FROM `yourtable` WHERE `email`='$email' AND `password`='$pass'";
    			$res = mysql_query($sql) or die(mysql_error());
    
    				if(mysql_num_rows($res) > 0){
    				//success logged in
    				}else {
    				//failure: email and password combination are incorrect
    				}
    
    		}else {
    		//failure: email does not exist
    		}
    }else {
    //failure: email/pass is/are not set
    }
    
    
    
    }
    
    
    $logged_in = checkLogIn();
    ?>
    

  3. $path = "/home/path/to/your/folder";
    
    $handle = @opendir($path) or die("Unable to open $path");
    
    echo "<table border=0 cellspacing=3 cellpadding=3>\n";
    $x=1;
    echo "<tr>\n";
    while($file = readdir($handle)){
    echo "<td><img src=\"$file\"></td>\n";
    
      if($x == 5){
      echo "</tr><tr>\n";
      $x=0;
      }
    $x++;
    }
    echo "</tr>\n";
    echo "</table>\n";
    
    closedir($handle);
    

  4. $fetch = "SELECT `password` FROM `tbl_users` WHERE (username='$username1')";
    $password2 = mysql_query($fetch);
    
    if($password == $password2) {
    

     

    CHANGE TO:

     

    $fetch = "SELECT `password` FROM `tbl_users` WHERE `username` ='$username1'";
    $pass2 = mysql_query($fetch) or die(mysql_error());
    $pfet = mysql_fetch_assoc($pass2);
    $password2 = $pfet['password'];
    
    if($password == $password2){
    

  5. I'm still getting the wrong image. I'm trying to get image "6", but I keep getting "4"

     

    I also believe that the variable is NOT passing threw the username function.

     

    I've tried returning the username value inside the function but it's blank.

  6. I don't want the braces, and the variable inside the username function is not passing correctly.

     

    Username function does: [puts image on administrative level][link to profile]

     

    I'm getting:

     

    [frozenpic][link to profile]

     

    Therefore the username isn't in existence.

  7. I'm trying to make it so:

     

    [profile=username] replaces with username(username)

     

    username() is a function I have that links the "username" to that profile

     

    $string = "[profile=marcus;]";
    
    echo "Before: $string<br>\n";
    echo "After: ";
    echo preg_replace("[profile=(.*?);]",username("\\1"),$string);
    

     

    I get:

     

     

    Before: [profile=marcus;]

    After: [marcus]

     

     

    The after statement is producing a link to that profile with an image. The image identifies the user's level, the link is correct.

     

    How would I remove the brackets on the start and the end of "[marcus]" ?

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