Jump to content

Fadion

Members
  • Posts

    1,710
  • Joined

  • Last visited

Posts posted by Fadion

  1. Poisano ure still not too clear. Are those links going to be like:

     

    <textarea cols="100" rows="10" name="url1"></textarea>
    <textarea cols="100" rows="10" name="url2"></textarea>
    <textarea cols="100" rows="10" name="url3"></textarea>
    

     

    and u need a code which parses those urls?

  2. With dreamweaver make sure u have the coding toolbar showed, by going to View >> Toolbars >> Coding. Select the code (normaly in code view :) ) and click the third icon on that toolbar which is Collapse Selection collapsedb5.jpg. To expand it again double click.

  3. make smth like:

     

    if($_GET['activelocation'])
      $activelocation = $_GET['activelocation'];
      setcookie('location', $activelocation, time()+60*60*24*30);
    } elseif(isset($_COOKIE['location'])){
           $activelocation = $_COOKIE['location']; //if the cookie is set, get the value
    } else{
           setcookie('location', 'New York, NY', time()+60*60*24*30);
    }
    

     

    So u make progressive checking. If the user has changed the location then set the cookie. If not the first then check if the cookie exists to set the location. If not any of both set the cookie to its default value.

  4. when u click a tutorial u mess the breadcrumb maybe cos u loose the the url variable 'category' which is used in the query. Just guessing anyway. Also dont forget to clean your input data, as with your current code, one can inject code as much as he likes.

     

    $category = mysql_real_escape_string($_GET['category']);
    $result = mysql_query("SELECT * FROM cats WHERE name='$category'");
    

  5. dont know of any print_l() but sure i know about print_r() which u can use to print array values. What i think is that $game is a config variable and to it are assigned site values like:

     

    $game['siteName'] = 'Game Site';
    $game['siteDesc'] = 'A very good site';
    

     

    Dont know how the script works but im sure it gets the page title from a database field. Look at the database to find a column 'title' or smth and then look at the code to find where that column is echoed.

  6. Yep as u said u can use cookies.

     

    if(isset($_COOKIE['location'])){
          $location = $_COOKIE['location']; //if the cookie is set, get the value
    } else{
          setcookie('location', 'new york', time()+60*60*24*30); //set the cookie to the default value and
                                                                                    //make it expire after aprox. 1 month
    }
    

  7. The code of the first part looks good, except if(mysql_num_rows($result)!= "") that will always be true. mysql_num_rows returns 0,1,2 etc not an empty value. Anyway thats not your problem. If the link to the subforum takes the correct id then im guessing that your problem is in view_active.php which we are not able to see as its included. Basically u need to get the id from url and make a query of all the sub forums that have that parent id.

  8. Im not reviewing your code as im pretty sure uve not written it completely by yourself. If so correct me  pls. Instead ill give u a working code which i just wrote and tested. It will let the user browse for a file, verify the file, upload it and make a sql query.

     

    The form

    <form enctype="multipart/form-data" name="uploadform" method="post" action="">
      <input name="picupload" type="file" />
      <input type="submit" name="Submit" value="submit" />
    </form>

     

    The php code

    <?php
    if($_FILES['picupload']['name'] != ""){
    $path = "pics/" . basename($_FILES['picupload']['name']);
    $ext = strtolower(substr(strrchr($_FILES['picupload']['name'], '.'), 1));
    $allowedExt = array('jpg', 'png', 'gif', 'bmp');
    if(in_array($ext, $allowedExt)){
    	if(move_uploaded_file($_FILES['picupload']['tmp_name'], $path)){
    		$query = mysql_query("INSERT INTO table (path) VALUES('$path')");
    		echo "The file was uploaded successfully.";
    	} else{
    		echo "There was an error uploading the file. Please try again later.";
    	}
    } else{
    	echo "The format is not supported.";
    }
    }
    ?>

     

    U have just to modify the path and sql query to your needs. Another thing is the require_once() thing. Sure u can include a file with absolute path, but it will give u problems after uploading in a web server as u dont have the same directory structure. Use smth like include('includes/connections/test.php'). Hope this helps.

  9. Thought u needed it that way. In this case the code provided by hitman6003 is your case. Probably they crashed cos in the first it is '$i + 2' and not '$i += 2' and in the second the $i is not incremented. Anyway this code should do it:

     

    for($i=0; $i<count($id); $i += 2){
    echo $id[$i] . ' - ' . $id[$i+1] . '<br />';
    }
    

  10. Why are people so fascinated with a GD thumbnail? You can use an html image tag to do the same task.

     

    Probably because with GD one can resize and resample the thumbnail to mantain image quality and to lower a lot filesize. With your example u have a thumbnail with crisp edges and of the same filesize of the fullsize image.

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