Jump to content

radox

Members
  • Posts

    31
  • Joined

  • Last visited

    Never

Posts posted by radox

  1. Hello!

     

    I have a rewrite rule that's working great, I just need to direct it to SSL and tried a bunch of combinations with no luck

     

    Here's what I have so far for the .htaccess file sitting in the /profile/ folder:

    RewriteEngine on
    RewriteCond %{REQUEST_URI} !profile\.php
    RewriteCond %{REQUEST_URI} /([^/]+)/([^/]+)/([^/]+)
    RewriteRule !\.(gif|jpg|png|css)$ profile.php?shopid=%2&shop=%3

     

    http://www.domain.com/profile/123/shop-name

     

    should redirect to

     

    https://www.domain.com/profile/123/shop-name

     

    I'm sure this is a quick one for someone..thanks!

     

     

  2. Hello All!

     

    I'm looking for a regular expression (regexp) to check for valid html input. I have a textarea where I allow the end user to input html markup. Does such an expression exist? ...or do I have to exclude all characters that I wouldn't allow (ie. semi-colon, parentheses, etc).

     

    Thanks in advance!

  3. I got it:

     

    select y.year, a.make, m.model, p.part 
    from auto_year  y
    join auto_model m using(model_id)
    join auto_make  a using(make_id)
    join auto_part  p using(part_id);

     

    Thanks!

  4. I'm racking my brain trying to figure out how to join 4 different tables. Please help!

     

    Here's my tables:

     

    auto_year

    ---------------

    year_id

    model_id

    part_id

    year

     

    auto_model

    ---------------

    model_id

    make_id

    model

     

    auto_make

    ---------------

    make_id

    make

     

    auto_part

    ---------------

    part_id

    part

     

    I would like the output to be: year, make, model, part

     

    You can see that:

    auto_year and auto_part can be joined using part_id

    auto_model and auto_make can be joined using make_id

     

    I can't figure out how to tie these together using model_id

     

    Hope I'm making sense. Maybe I'm missing something and there's a better way??

    Many thanks!!

  5. Your code and html display is all wrong.

     

    The "file" input will return a $_FILES array

     

    Here's some code play with:

     

    $image='';

                $imagedest='unix or windows path';

    $tmp_name=$_FILES['Pic']['tmp_name'];

    $image_type=explode('/',$_FILES['Pic']['type']);

    $fulldest=$imagedest.$image;

     

    if(isset($_FILES['Pic'])&&$_FILES['Pic']['name']!=''){

    if(preg_match('/\\.(jpg|gif|jpeg|bmp)$/i',$image)){

    if(move_uploaded_file($tmp_name,$fulldest)){

    echo 'file uploaded';

    }

    }

    }

     

    You have to create the imagedest path on your server. You're not storing the image in the db, only the filename.

    Then, when you want to display the image, you need to pull the path and have your html in proper form.

     

    Not:

    echo "<td class=BorderMeRed>".$row["Pic"]."</td>"; 

     

    This:

    echo '<td class=BorderMeRed><img src="'.$row['Pic'].'</img></td>'; 

     

    PS. Please learn the difference between a single and double quote.

  6. Here's the solution:

     

    //open xml files

    $xmlperfile = 'file.xml';

     

    //open personal xml file for processing

    $perfp = fopen($xmlperfile, "r") or die("Could not open file");

    $perdata = fread($perfp, filesize($xmlperfile)) or die("Could not read file");

     

    //create xml parser and extract personal data

    $xmlperparser = xml_parser_create();

    xml_parser_set_option($xmlperparser, XML_OPTION_CASE_FOLDING, 0);

    xml_parser_set_option($xmlperparser, XML_OPTION_SKIP_WHITE, 1);

    xml_parse_into_struct($xmlperparser,$perdata,$pervals,$perindex);

    xml_parser_free($xmlperparser);

     

    //close both xml file reads

    fclose($perfp);

     

     

    $tipcat=0;

    foreach($pervals as $element){

    if($element['level']==6){

    if($element['tag']=='Title'){

    $pertiptitle[$tipcat][]=$element['value'];

    }

    if($element['tag']=='Content'){

    $pertipcontent[$tipcat][]=$element['value'];

    }

    }

    if($element['tag']=='Category'&&$element['type']=='close'){

    $tipcat++;

    }

    }

  7. I'm using xml_parse_into_struct to get all my elements, but now I need to group them. For example, here's the XML

     

    <categories>

                <category id="12345">

          <title>category title 1</title>

          <tips>

              <tip id="0">

                  <title>hello world</title>

                  <content>some content</content>

              </tip>

              <tip id="1">

                  <title>foo</title>

                  <content>foo content</content>

              </tip>

            </tips>

        </category>

        <category id="7890">

        <title> category title 2</title>

            <tips>

              <tip id="2">

                  <title>another tip title</title>

                  <content>blah blah</content>

              </tip>

              <tip id="3">

                  <title>another tip title</title>

                  <content>blah blah</content>

              </tip>

     

            </tips>

          </category>

    </categories> 

     

     

    How would I just grab the tip titles for the 2nd category (7890)? Hope I'm making sense.

    I can loop through the array using foreach, but have no way to determine if a tip belongs to the 1st or 2nd category. Ideas??

     

    Please help!

     

    Thanks

  8. I have a tricky one here....

     

    I designed a page that the user can "start" and let run. Visitors can then add themselves like a registry. However, to get back to the admin panel, I put a link at the bottom that would prompt the user for "combo" to unlock the page.

     

    Example:

     

    <script type="text/javascript">
    
    function comboLock(){
    var combo=prompt('Enter Combination');
    if(combo==<?php echo $_SESSION['MM_Combo']; ?>){
    	document.location='somepage.php';	
    }
    }
    
    </script>

     

    Obviously, the above example is in NO way secure. I think this can be solved by jquery and AJAX, but I'm not familiar enough with either of them.

     

    I need this to be solved using a javascript prompt box!

     

    Please help :)

  9. There are many function to manipulate strings.

    What combined the two words in the first place?
    Why don't you just add a space right from the start?

    Need more info....


    check out:

    [a href=\"http://us3.php.net/manual/en/ref.strings.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.strings.php[/a]
  10. There are many function to manipulate strings.

    What combined the two words in the first place?
    Why don't you just add a space right from the start?

    Need more info....


    check out:

    [a href=\"http://us3.php.net/manual/en/ref.strings.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.strings.php[/a]
  11. Yes, something like that...but the raw data passes over secure http, not ftp.

    I just can't seem to find an example file or code.

    I guess there is a PHP function called "get_xml_raw" or something along those lines??

    I'm looking for any direction really.

    Thanks for your post.
  12. While I appreciate your reply, I'm looking for a response from someone that has implemented XML posting through web services like XML_RPC. I need an example file or code to get started....

    This is becoming common practice for automation between servers.

    The company has given me and XML example file and the associated XSD file.

    It's up to me to create the file on my end to intercept their transmission.
  13. I could use a little insight on XML posting.

    I have a company that would like to "post" XML data to one of my servers.
    I really don't understand this "posting" process.

    Does anyone have an example file, or snippet of code, they can send to help me understand?

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