Jump to content

Cagecrawler

Members
  • Posts

    247
  • Joined

  • Last visited

    Never

Posts posted by Cagecrawler

  1. My knowledge of flash is basically nonexistant but I believe you can make a call to a url and get the output?  What you'd basically need to do is an AJAX call but using flash instead of javascript.  Have your swf call the php script, every second maybe, and the script would output whatever you needed to know in a form you can then parse in flash.

     

    You might want to look up something called AMFPHP - not sure what it does but I heard that it is good for working with Flash and PHP.

     

    The tutorial below is for a Flash-based email form, but it gives you the basics:

    http://www.kirupa.com/developer/actionscript/flash_php_email.htm

  2. That'll hit errors (you've used commas instead of periods). Try this:

    while($row2=mysql_fetch_array($exec2,MYSQL_BOTH))
                            {               
                               echo'<tr>';
          
                      
                               echo"<td width=100 align=center>".substr('$row2[datePosted]',0,10)."</td>";
                   
    }

     

  3. You can do it 2 ways.  Either limit the sql query to 20 results and have multiple queries, or have some sort of counter that increases each time the loop is executed.  When it gets to 20 (or a multiple thereof), include the headings.

     

    <?php
    $i = 0;
    while($array = mysql_fetch_array($query))
    {
        if(fmod($i,20) == 0)
        {
            //echo heading
        }
        //echo current line
    }
    ?>
    

  4. Simply encrypt the input at login and compare the hashes.  It's probably easier to use a hash function such as md5 or sha1 for this.  Simply execute the function, then compare.

    <?php
    $password = sha1($_POST['password']);
    $id = mysql_real_escape_string($_POST['id']);
    
    $sql = "SELECT * FROM user WHERE id= '$id' and password = '$password'";
    ?>
    

     

     

  5. When dealing with directories on the server, you need to use \ instead of /.

    $cwd = $cwd."/".$filedir."/";

    should be

    $cwd = $cwd."\\".$filedir."\\";

     

    Also,

    <form action="<?=$PHP_SELF?>" method="post">

    should be (unless your server supports short tags):

    <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">

     

    EDIT:

    Your filedir isn't being passed to the second page.  You can pass it via a hidden input in your form:

    <input type="hidden" name="filedir" value="<?php echo $filedir;?>">

    or add it as a GET:

    <form action="<?php echo $_SERVER['PHP_SELF']."?value=$filedir";?>" method="post">

  6. You need to create a table called buddies.  Use the following SQL or use phpMyAdmin:

     CREATE TABLE `dowmodsc_pico`.`buddies` (
    `ID` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
    `userID` INT NOT NULL ,
    `buddyID` INT NOT NULL
    ) ENGINE = InnoDB 
    

     

    You can then insert buddies using the following SQL query:

    INSERT INTO buddies (userID,buddyID) VALUES ('1','2');

    Where userID and buddyID relate to the relevant userid from the users table.

     

  7. <?php
    function loveLogged($admin)
    {
    $query = mysql_query("SELECT * FROM ". MEMBER_TBL ." WHERE `username` = '".$_SESSION['username']."' AND `password` ='".$_SESSION['password']."'"));
    if(mysql_num_rows($query > 0)
    {
    	//User is logged in.
    	if($admin == true)
    	{
    		//Test for admin
    		$user = mysql_fetch_array($query);
    		if($user['user_level'] = ADMIN)
    		{
    			//User is an admin
    			return true;
    		}
    		else
    		{
    			//User isn't an admin.
    			return false;
    		}
    	}
    	else
    	{
    		//User doesn't need to be admin.
    		return true;
    	}
    }
    else
    {
    	//User isn't logged in.
    	return false;
    }
    }
    
    ?>
    

  8. You want something like this:

    <?php
    function adminCheck()
    {
        $query = mysql_query("SELECT * FROM ". MEMBER_TBL ." WHERE `username` = '".$_SESSION['username']."' AND `password` ='".$_SESSION['password']."'"));
        if(mysql_num_rows($query > 0))
        {
            //User is logged in correctly
            $user = mysql_fetch_array($query);
            if($user['user_level'] = ADMIN) 
            {
                //User is an admin.
                return true;
            }
            else
            {
                //User isn't admin.
                return false;
            }
        }
        else
        {
            //User isn't logged in correctly.
            return false;
        }
    }
    ?>
    

  9. You're declaring session_start() more than once.  This can happen if you have it in multiple files and then include them together in the same file.  Either put it in a completely separate file and use require_once() to ensure it doesn't get repeated or only use it in the final file (ie. the one the user views).

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