Jump to content

php_begins

Members
  • Posts

    259
  • Joined

  • Last visited

Posts posted by php_begins

  1.     I need to see if the user has posted at least 1 post in one of these forums; 12, 9, 96, 176

        and last activity is more then six months ago, meaning they have not logged in within the last 6 months. and then print those usernames

      Given current table structure of post,thread,user and forum. This is the only way i could think of so far.Here is my complete code:

     

    $forumids='12,9,96,176';
    $getusername=mysql_query("SELECT userid from user WHERE posts >=1 AND lastactivity <='$newDate' ORDER by lastactivity") or die (mysql_error());
    if(mysql_num_rows($getusername) > 0)
    {
       $flag=1;
       while($getusername_result=mysql_fetch_assoc($getusername))
       {
          if($flag == 1)
          {
             $userid=$getusername_result['userid'];
             $flag=2;
          }
          else
          {
             $userid.=",".$getusername_result['userid'];
          }
       }
    }
    else
    {
      //Nothin
    }
    echo $userid;
          //$getpostid=mysql_query("SELECT DISTINCT post.username,post.threadid,thread.threadid,thread.forumid from post,thread WHERE post.username='$username' AND post.threadid=thread.threadid AND post.userid IN ($userid) AND thread.forumid IN ($forumids)") or die (mysql_error());
          while($getpostid_result=mysql_fetch_assoc($getpostid))
          {
    
             $postusername=$getpostid_result['username'];
             echo $postusername."<br>";
    
          }
    
    
    

  2. I have the following query where $userid is about 100,000 userids separated by commas.

     

    <?
    $getpostid=mysql_query("SELECT DISTINCT post.username,post.threadid,thread.threadid,thread.forumid from post,thread WHERE post.username='$username' AND post.threadid=thread.threadid AND post.userid IN ($userid) AND thread.forumid IN ($forumids)") or die (mysql_error());
    ?>

    can i just print all the usernames from above result separated by ';' without looping it multiple times?

     

    Could someone help me out how to do above in an efficient manner?

  3. i have had a difficult time trying to work this out.I need to do some pattern matching for certain urls and retrieve information from it.

    For example,

    $url=http://www.test.com/showpic.php?do=showpic&u=89165&a=34933

     

    if $url contains the value showpic.php,then i need to retrieve the following

    {

      $u=value of u(i.e. 89165 in this case)

      $a=value of a(i.e. 34933 in this case)

    }

    else do nothin..

     

    the format of the url will always be the same as above if it contains showpic.php

  4. thanks a lot...another useful solution i found was this:

     

    $str = 'http://www.test.com/forums/attachment/f39/6066d1267084199-official-ar-m16-m4-picture-thread-dsc00005.jpg';
    $filename = pathinfo($str, PATHINFO_FILENAME);
    $part = substr($filename, 0, strpos($filename, 'd') - strlen($filename));
    print $part;  

  5. i didnt explain it properly.

    When people click on member_test.php?pn=2  (the link would point to /test/2 in my php code)

    it would take them to member_test.php?pn=2, but in the URL it would show /test/2.

    So for them it would look like they are in test/2, but in reality it would show the page produced by member_test.php?pn=2

  6. I have pagination code in members page that has pages 1,2,3 and so on.

    /member_test.php?pn=1 where pn can be 1,2,3 etc.

     

    I need to redirect the above page such that it redirects to /test/1 , test/2 and so on..

    I have the following rule which works perfectly fine in the browser.

     

    RewriteRule ^/member_test.php?pn=(.*) /test/$1 [PT]

     

    But the content of the above redirect is always page 1. i.e it always dispays the content of member_test.php?pn=1..

    /test/1 ,test/2, test/3 always displays the  content of 1.

     

    Can you help me with the current redirect rule..

  7. I have a problem with nested forms.. when i click the submit button at the bottom of the page i want it to take to display.php and when i click the upload button on the upload form code i do not want to refresh it.

    But right now when i click on upload button it takes me to display.php.

    Can someone help me out with the code?

    <?
    include("db.php");
    include("upload.php");
    error_reporting(E_ALL ^ E_WARNING);
    ini_set("display_errors", 1);
    
    <script type="text/javascript">
    function initUpload() {
    
       /*set the target of the form to the iframe and display the status
          message on form submit.
      */
    document.getElementById('uploadform').onsubmit=function() {
    document.getElementById('uploadform').target = 'target_iframe';
        document.getElementById('status').style.display="block";
    
    }
    }
    
    //This function will be called when the upload completes.
    function uploadComplete(status){
       //set the status message to that returned by the server
       document.getElementById('status').innerHTML=status;
    }
    
    window.onload=initUpload;
    </script>
    
    <style type="text/css">
    .color
    {
       font-weight:bold;
       color:black;
    }
    </style>
    
    
    <div class="color">
    
    <body bgcolor="white">
    <center><h4><font color="blue">CREATE NEWSLETTER</font></h4></center>
    <table align="center" bgcolor="silver">
    <form action="display.php" method ="post">
    
    <tr>
       <td>Site: </td>
       <td>
       <select name="new_id">
       <option value="">=============</option>
       <?php foreach($acronym as $key=>$value){ ?>
       <option value="<?php echo $value['site_id']; ?>"><?php echo $value['acronym']; ?></option>
    
       <?php }?>
       </select>
       </td>
    </tr>
    
    <tr>
       <td> Title: </td>
       <td><input type="text" size ="40" name="newsletter_title" /></td>
    </tr><tr>
    <td>Greeting:</td>
    
    
    
    
    <td><textarea rows="10" cols="80" name="greeting" ></textarea></td>
    </tr>
    
       <td> URL Title: </td>
       <td><input type="text" size ="40" name="url_title" /></td>
    </tr>
    
    <tr>
       <td> URL: </td>
       <td><input type="text" size ="40" name="newsletter_url" />Begin url with http://</td>
    </tr>
    
    <tr>
      <td  align="center">
      <b><font color="#214754" size="3">Banners</b></font>
      </td>
    </tr>
    <tr>
       <td>Banner Image URL: </td>
       <td><input type="text" size ="40" name="banner_url1" />
       Banner Link:
       <input type="text" size ="40" name="banner_link_url1" />
       </td>
    </tr>
    <tr>
       <td>Banner Image URL: </td>
       <td><input type="text" size ="40" name="banner_url2" />
       Banner Link:
       <input type="text" size ="40" name="banner_link_url2" />
       </td>
    </tr>
    <tr>
       <td>Banner URL: </td>
       <td><input type="text" size ="40" name="banner_url3" />
        Banner Link:
       <input type="text" size ="40" name="banner_link_url3" />
       </td>
    </tr>
    <tr>
       <td>Banner URL: </td>
       <td><input type="text" size ="40" name="banner_url4" />
       Banner Link:
       <input type="text" size ="40" name="banner_link_url4" />
       </td>
    </tr>
    <tr>
      <td  align="center">
      <b><font color="#214754" size="3">Threads</b></font>
      </td>
    </tr>
    
       <select name="category1">
       <option value="">==========</option>
       <option value="registry">Registry</option>
       <option value="reviews">Reviews</option>
       <option value="classifieds">Classifieds</option>
       </select>
       </td>
    </tr>
    
    <tr>
       <td> Title: </td>
       <td><input type="text" size ="40" name="registry_title1" /></td>
    </tr>
    <tr>
       <td> Image: </td>
       <td><input type="text" size ="40" name="registry_img1" /></td>
    </tr>
    
    <tr>
       <td> URL: </td>
       <td><input type="text" size ="40" name="registry_url1" />Begin url with http://</td>
    </tr>
    <tr>
       <td height='12'></td>
    </tr>
    <tr>
       <td> Title: </td>
       <td><input type="text" size ="40" name="registry_title2" /></td>
    </tr>
    <tr>
       <td> Image: </td>
       <td><input type="text" size ="40" name="registry_img2" /></td>
    </tr>
    <td>
    <form id="uploadform" method="post"
    enctype="multipart/form-data"
    action="upload.php">
    
    <input name="file" id="file" size="27" type="file" /><br />
    <input type="submit" name="action" value="Upload" />
    <span id="status" style="display:none">uploading...</span>
    <iframe id="target_iframe" name="target_iframe" src="" style="width:0;height:0;border:0px"></iframe>
    
    </form>
    
    </td>
    
    
    <tr>
       <td> URL: </td>
       <td><input type="text" size ="40" name="registry_url2" /></td>
    </tr>
    <tr>
    <td>
    <input type="submit" name="submit" value="submit" />
    </td>
    </tr>
    </form>
    </table>
    </div>
    

  8. Hello,

    My database has a title field and some of them contain characters that are not recognized by my keyboard.

    For example,

    Crème brûlée

     

    When I retrieve and print it out it prints fine.But when i try to send them through an email using php email it does not send it.

    How can i replace thos invalid characters before sending it through email?

     

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