Jump to content

aseaofflames

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Posts posted by aseaofflames

  1. Thanks for that. Works great now.

     

    One other thing. I have set a background colour for a DIV through CSS and I want to be able to echo into the DIV and make it auto extend. Is this possible?

     

    put the php code inside of the <div>

  2. 1. How can i prevent message "Cannot create a file" to show whenever the code is executed. Meaning it shows when i execute it once, then when i put the name and source there is no problem.

     

    you should prevent the code from executing unless a post has been sent

     

    if(!isset($_POST['nazwa'])) exit;

     

    2. If you look at the last line, only the file name will print, is there a way that the user will be able to click on that file? Like in html using href option. Meaning i want some option that will read the file name from $_POST['nazwa'] and then it will allow the user to click on it.

     

     echo "<a href=\"".$filename."">".$filename."</a>"; 

     

    3. Is there a way that i can upload many files at once? Like 5 files at once, or something and you can save each one with different name and source?

     

    Loops

     

  3. your loop is completely wrong.

     

    $filterentries = mysql_fetch_assoc($selectentries);

    fetches the first row and then the next if it is called again...and so on...

     

    change it to

     

    while($filterentries = mysql_fetch_assoc($selectentries)) {

     

    and remove

    $arr=array("$title" );
    
    foreach ($arr as $value)
    {

     

    should work (not tested)

     

    aseaofflames

  4. have you tried putting the onmouseout in the first span?

     

    also:

    restoreme(this,'images/off1.gif');"

     

    the this would refers to the span object, not the img object.

     

    the return false; is also misplaced, it should be the last statement in the onmouseover and onmouseout functions.

     

    working code:

    
    <div class="code"><script type="text/javascript">
    function ShowText(id) {
    document.getElementById(id).style.display = 'block';
    }
    function HideText(id) {
    document.getElementById(id).style.display = 'none';
    }
    function replaceme(which,img) {
    document.getElementById(which).src = img;
    }
    function restoreme(which,img) {
    document.getElementById(which).src = img;
    }
    
    </script>
    
    <style type="text/css">
    <!--
    .box {
    background-color: #504D6F;
    border: 1px solid #FFF;
    height: 100px;
    width: 200px;
    padding: 5px;
    }
    -->
    </style>
    <span onmouseover="ShowText('answer1'); replaceme('img','images/on.gif'); return false;" onmouseout="HideText('answer1'); restoreme('img','images/off1.gif'); return false;" >
    <img src="images/off1.gif" id="img" style="position:relative; left:200px; top:200px; width:200px; height:100px;"></span>
    <span id="answer1" class="box" style="display:none;">text info</span></div>
    
    </body>
    </html>
    

    Demo: http://www.reactionwebdesign.com/demos/singlepage/imagebox.html

     

    for your second question, in order to change the position of the box, you must tweak the css ( try adding top, left)

     

     

  5. Try to integrate your forum into your site a little better, there are no links back and it's not styled to your site theme.

     

    There is a link back, it's the My Account link in the menu (on the forum). I will try to make it easier to find.

     

    To add Media you have to first link your Flickr, YouTube, or MetaCafe account. Then click sync. (you must have media on your Flickr/YouTube/MetaCafe account in order to add it)

     

    If you used the flickr account tester, it has no media uploaded to flickr, so there was nothing to add.

  6. you could use ajax

     

    first assign the id 'content' to your <span> (<span id="content" contenteditable="true">)

     

     

    function addcontent() {
    
    //path to php script to handle post
    var path = "PATH_TO_PHP_SCRIPT.php"
    //get contents of editable text
    var content = document.getElementById("content").innerHTML;
    
    var ajaxRequest;  // The variable that makes Ajax possible!
    
    try{
    	// Opera 8.0+, Firefox, Safari
    	ajaxRequest = new XMLHttpRequest();
    } catch (e){
    	// Internet Explorer Browsers
    	try{
    		ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
    	} catch (e) {
    		try{
    			ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
    		} catch (e){
    			// Something went wrong
    			alert("Your browser broke!");
    			return false;
    		}
    	}
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
    
    	if(ajaxRequest.readyState == 4){
    		var r = ajaxRequest.responseText;
    		document.getElementById("content").innerHTML="";		
    
    	}
    }
    var php = "content="+content;
    ajaxRequest.open("POST", path, true);
    ajaxRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    ajaxRequest.setRequestHeader("Content-length", php.length);
    ajaxRequest.setRequestHeader("Connection", "close");
    ajaxRequest.send(php);
    }

     

    the above code send a post to PATH_TO_PHP_SCRIPT.php (you can change this).  And then clears the text box.

     

    The contents of your span are in $_POST['content'] on PATH_TO_PHP_SCRIPT.php;

     

     

  7. For those of you who do not want to sign up for an account, use:

    username: tester

    password: guest2009

     

    If you sign up for an account, The beta activation code  (the code to convert you account to Beta Tester status) is phpfreaks.

     

  8. I am working on a site that allows you to display all of your media in one place (without reuploading). It currently works with media uploaded to Flickr, YouTube, and MetaCafe.

     

    I am in need of Beta Testers. Please test for errors, security vulnerabilities, and ease of use. I could also use some suggestions on how to set up the page that displays the media.

     

    http://www.mediachief.net

  9. this code solves #1 and #2. For #3 i think we need to get the loop to run an extra time.

     

    <?php
    echo "<table>";
    echo "<b><th>Symbol</th> <th>Market Price</th> <th>Change</th> <th>Change %</th> <th>Open</th> <th>High</th> <th>Low</th> <th>Previous Close</th> <th>Volume</th> <th>52 Week Low</th> <th>52 Week High</th></b>";
    $fo=fopen("symbols.txt","r"); 
    while ($line = fgets($fo))  {   
      $arr[] = str_replace(array('_','&'),array('',''),trim($line));   
      if (count($arr) >= 50) {   
    
        $url= "http://in.finance.yahoo.com/d/quotes.csv?s=".trim(implode("+", $arr))."&f="."sl1c1p2ohgpvjk";
    
        $handle = fopen($url, "r");
        while (($data = fgetcsv($handle, 1000, ",")) !== FALSE)
        {
            echo "<tr>";
            foreach($data as $d)
                echo "<td>$d</td>";
            echo "</tr>";
        }
        fclose($handle);
        
        $arr = NULL;      
      }
    
    }
    echo "</table>";
    ?>

  10. try this:

    <?php
    function parse_bbcode($input)
       {
    
    preg_match_all('/\[code\](.*?)\[\/code\]/is',$input, $code)
    
    foreach($code[0] as $cur) {
    
    $input = str_replace($cur[0],htmlspecialchars($cur[0]),$input);
    
    }
    
       $bb_replace = array(
          '/\[img\](.*?)\[\/img\]/is',
          '/\[b\](.*?)\[\/b\]/is',
          '/\[i\](.*?)\[\/i\]/is',
          '/\[u\](.*?)\[\/u\]/is',
          '/\[url\=(.*?)\](.*?)\[\/url\]/is',
          '/\[url_blank\=(.*?)\](.*?)\[\/url_blank\]/is',
          '/\[textarea\](.*?)\[\/textarea\]/is',
          '/\[url\](.*?)\[\/url\]/is',
          '/\[url_blank\](.*?)\[\/url_blank\]/is',
          '/\[quote\=(.*?)\](.*?)\[\/quote\]/is',
          '/\[quote\](.*?)\[\/quote\]/is',
          '/\[code\](.*?)\[\/code\]/is',
          '/\[color\=(.*?)\](.*?)\[\/color\]/is',
          '/\[size\=(.*?)\](.*?)\[\/size\]/is'
          );
       $bb_replacements = array(
          '<img src="$1" alt="$1" />',
          '<span style="font-weight: bold;">$1</span>',
          '<span style="font-style: italic;">$1</span>',
          '<span style="text-decoration: underline;">$1</span>',
          '<a href="$1">$2</a>',
          '<a href="$1" target="_blank">$2</a>',
          '<textarea>$1</textarea>',
          '<a href="$1">$1</a>',
          '<a href="$1" target="_blank">$1</a>',
          '<span class="quote">$1 said:<span>$2</span></span>',
          '<span class="quote">quote:<span>$1</span></span>',
          '<code>$1</code>',
          '<span style="color:$1;">$2</span>',
          '<span style="font-size:$1;">$2</span>'
          );
       return preg_replace($bb_replace,$bb_replacements,$input);
       }
    ?>
    

  11. you forgot the onblur javascript events

     

    change:

    <tr>
                <td><input name="your_name" type="text" id="your_name" size="30" /></td>
              </tr>
              <tr>
                <td>Company Name</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="company_name" type="text" id="company_name" size="30" />
                </label></td>
              </tr>
              <tr>
                <td>Phone</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="phone" type="text" id="phone" size="30" />
                </label></td>
              </tr>
              <tr>
                <td>Email</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="email" type="text" id="email" size="30" />
                (REQUIRED)</label></td>
              </tr>
              <tr>
                <td>Confirm Email</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="emailconfirm" type="text" id="emailconfirm" size="30" />
                </label></td>
              </tr>
              <tr>
                <td height="48" valign="bottom">Comments</td>
    
              </tr>
              <tr>
                <td><label>
                  <textarea name="comments" id="comments" cols="35" rows="6"></textarea>
                  <br />
                </label></td>
              </tr>
    

     

    to

     

    <tr>
                <td><input name="your_name" type="text" id="your_name" size="30" /></td>
              </tr>
              <tr>
                <td>Company Name</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="company_name" type="text" id="company_name" size="30" />
                </label></td>
              </tr>
              <tr>
                <td>Phone</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="phone" type="text" id="phone" onblur="MM_validateForm('phone','','NisNum');return document.MM_returnValue" size="30" />
                </label></td>
              </tr>
              <tr>
                <td>Email</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="email" type="text" id="email" size="30" onblur="MM_validateForm('email','','RisEmail');return document.MM_returnValue" />
                (REQUIRED)</label></td>
              </tr>
              <tr>
                <td>Confirm Email</td>
    
              </tr>
              <tr>
                <td><label>
                  <input name="emailconfirm" type="text" id="emailconfirm" size="30" onblur="MM_validateForm('emailconfirm','','NisEmail');return document.MM_returnValue" />
                </label></td>
              </tr>
              <tr>
                <td height="48" valign="bottom">Comments</td>
    
              </tr>
              <tr>
                <td><label>
                  <textarea name="comments" id="comments" cols="35" rows="6"></textarea>
                  <br />
                </label></td>
              </tr>
    

     

    :)

  12. i don't know know if you just typed it wrong on here, but

    if (strlen(stristr($chatsrt, $needle))>0) {

    should be

    if (strlen(stristr($chatstr, $needle))>0) {

     

    and for the second method why are there two foreach statements?

     

    also in the foreach $chastr should be $chatstr

     

     

  13. psuedocode  :)

     

    $name = post variable name (i.e. <input name="name">)

    $email = post variable email

    $feedback = post variable name

     

    $toaddress = 'feedback@example.com';

     

    if shop is in variable feedback then $toaddress = 'retail@example.com'

    else if delivery is in variable feedback then $toaddress = 'fulfillment@example.com';

    else if bill is in variable feedback then  $toaddress = 'accounts@example.com';

     

    check if variable emailis valid (some string + @ + some string + . + some string)

    if email is not valid show error message and quit.

     

    set mail subject, body, and from address

     

    send mail to $toaddress with subject $subject body $mailcontent and from address $fromaddress

     

    display html page saying that content was submitted.

     

    by the way 'retail@example'.com; should be 'retail@example.com';

  14. gosh, so harsh. I am trying to allow file downloads from a music hosting site (mediamaster.com) they already allow users to stream the same files I want to allow downloads of. I guess it could be considered leaching, but they already offer a java program that allows users to do this. I was just trying to recreate the program in php so it could be used anywhere with internet access.

  15. you haven't initilized the ajax variable:

     

    var http;  // The variable that makes Ajax possible!
    
    try{
    	// Opera 8.0+, Firefox, Safari
    	http = new XMLHttpRequest();
    } catch (e){
    	// Internet Explorer Browsers
    	try{
    		http = new ActiveXObject("Msxml2.XMLHTTP");
    	} catch (e) {
    		try{
    			http = new ActiveXObject("Microsoft.XMLHTTP");
    		} catch (e){
    			// Something went wrong
    			alert("Your browser broke!");
    			return false;
    		}
    	}
    

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