Jump to content

Lamez

Members
  • Posts

    1,686
  • Joined

  • Last visited

    Never

Posts posted by Lamez

  1. as a novice as well, here is what I used

     

    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine On
    RewriteRule ^([A-Za-z0-9-]+)/?$ user/profile.php?user=$1 [L]
    

     

    what is say is this: it allows the string to contain numbers and letters, it uses the file under the user directory called profile.php

     

    then it takes the ?user=username, so it all comes out to site.com/username

  2. <?php
    $num = $over_num;
    $page = isset($_GET['page']) && is_numeric($_GET['page']) && $_GET['page'] >= 1 ? $_GET['page'] : 1;
    
    $per_page = $num;
    
    $count_q = mysql_query("SELECT COUNT(id) FROM home ORDER BY id DESC");
    $count_r = mysql_fetch_row($count_q);
    $count = $count_r[0];
    
    if($page > ceil($count/$per_page)) $page = 1;
    
    
    $limit_min = ($page-1)*$per_page;
    $query = mysql_query("SELECT * FROM home ORDER BY id DESC LIMIT {$limit_min}, {$per_page}");
       
    $sql = mysql_query("SELECT * FROM home ORDER BY id DESC");
    $num_rows = mysql_num_rows($sql);  
    
    $limit2 = $per_page;
    
    $q = "SELECT id FROM home";
    $r = mysql_query($q);
    $num = ceil(mysql_num_rows($r) / $limit2);
    if($num != 1)
    {
      for($i = 1; $i <= $num; $i++)
      {
        /*if($page / $limit2 != $i)*/ echo "[<a href='?p=list&page=".$i."'>Page ".$i."</a>] ";
        //else echo "[<b>".$i."</b>] ";
      }
    }
    echo "<br /><br />";
      //while($row = mysql_fetch_array($sql)){
      while($row = mysql_fetch_assoc($query)) {
      
         //echo out DB info here
    
    }
    
    $limit2 = $per_page;
    
    $q = "SELECT id FROM home";
    $r = mysql_query($q);
    $num = ceil(mysql_num_rows($r) / $limit2);
    if($num != 1)
    {
      for($i = 1; $i <= $num; $i++)
      {
        /*if($page / $limit2 != $i)*/ echo "[<a href='?p=list&page=".$i."'>Page ".$i."</a>] ";
        //else echo "[<b>".$i."</b>] ";
      }
    }
    ?>
    

  3. <?php
    ob_start();
    $img_path = "img";
    
    if(empty($_GET['s'])){
    
      //$q = mysql_query("SELECT * FROM `table_name`");
      //$r = mysql_fetch_array($q);
      $o_stat = $r['stat'];
       
      if($o_stat == (1)){
       echo '<a href="?s=in"><img src="'.$img_path.'/in_green.bmp"></a> <a href="?s=out"><img src="'.$img_path.'/out_red.bmp"></a>';
      }
      if($o_stat == (2)){
       echo '<a href="?s=in"><img src="'.$img_path.'/in_red.bmp"></a> <a href="?s=out"><img src="'.$img_path.'/out_green.bmp"></a>';
      }
      echo $o_stat;
    }else{
      if($_GET['s'] == ("in")){
        //mysql_query("UPDATE `table_name` WHERE `stat` = '1'");
    header("Location: ?");
      }
      if($_GET['s'] == ("out")){
        //mysql_query("UPDATE `table_name` WHERE `stat` = '2'");
    header("Location: ?");
      }
    }
    ?>
    

  4. I figured it out! Thank you for the suggestion on the foreach loop!

     

    code:

    <?php
    $HTML = $_POST['html'];
    $HTML = explode(" ",$HTML); 
    $result = preg_replace_callback('%\b((?:www\.|http://www\.|http://).*)\b%si', 'UpdateDB', $HTML);
    echo "<br>Final Output<br>";
    //echo $result;
    //print_r($result);
    foreach($result as $val){
    echo $val;
    }
    
    
    
    function UpdateDB($Add)
    {
    $id = md5($Add[1]);
    $url = $Add[1];
    
    //DB Con...
    
    
        $sql = mysql_query("SELECT * FROM `url_list` WHERE `url`='".$url."'");
        if (!mysql_num_rows($sql) >= 1){
           mysql_query("INSERT INTO url_list (ID, URL) values ('$id','$url')");
        }else{
          $r = mysql_fetch_array($sql);
          $id = $r['id']; 
        }
       return " <a href=\"http://links.krazypicks.com?url=$id\">Link</a> ";
    }
    ?>
    

  5. well I am always learning something new, this however is really really new to me, I can code a php page with no problem, but somethings like this are completely new to me.

     

    So you are saying to look at a foreach loop. I will do that tomorrow! Thank you very much for your time.

  6. here is an idea.

     

    create a new php page, set the images to links, and make the links like so: page.php?stat=in or out. Then create a if statement, state weather the get variable is in or out, after you stated it has been set, if the variable is in, create a query to update the database, same with out, redirect back to the previous page. Now create another if statement, ask weather in the database the user is in, echo out green in image. Same for out, I can code this for you, but it will have to wait till tomorrow.

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