Jump to content

play_

Staff Alumni
  • Posts

    717
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by play_

  1. I also have a feeling that you capitalized the N on 'Name' on this line by accident:
    $result = mysql_query('SELECT * FROM blogs WHERE [b]Name[/b]=sada');

    i tend to do that alot.

    maybe it's just 'name' ?

    I also just noticed that you started a table inside the while loop.
    [code]while($row = mysql_fetch_array($result))
      {
      echo '<table border=10 width=400 cellpadding=0 cellspacing=3>[/code]


    but you close the table [i]after[/i] the while loop
    [code]  }
    echo '</table>';[/code]

    probably not what you want.
    You are opening/starting a bunch of tables, and not closing them.
  2. I have an array and i`d like to make a dropdown from that array

    [code]$pages = array("Home" => "home.html", "About" => "about.html", "Crew" => "crew.html");
    $arraysize = count($pages);
    for($i = 0; $i <= $arraysize; $i++) {
    foreach($key as $value) {
    echo '<option value="$key">$value</option>';
    }
    }[/code]

    That's what i have, but it isn't working. any ideas?
  3. Probably not the right forum, sorry.

    Say i have this site:
    http://example.com/

    The main logo image, is located in http://example.com/images/logos/

    Anyone using firefox can right-click the image and select 'view image', opening the image in the browser with the full url on the address bar, like so:
    http://example.com/images/logos/someimage.jpg

    so if the person deleted 'someimage.jpg' from the address bar, he will be in "http://example.com/images/logos/" viewing all of its contents.

    How can i stop that? i set chmod to 711, but then index.php will give me this error:
    [quote]Warning: opendir(./images/logos/): failed to open dir: Permission denied in /hsphere/local/home/me/example.com/includes/classes.php on line 13
    Could not open directory for main image selection.[/quote]

    classes.php is where i have the script to open and select a random image from the logos folder.


    I would post my actually site here, but then people could navigate through my files, and i'd rather not let that happen.
    I will gladly PM it if needed.

    Thank you.
  4. On top of a page, i have this:

    <a href="#?page=home" onclick="getData('home.html', 'newseditor')">Home</a>

    This will open the page "home.html" into a textarea so the client can edit it from his browser.

    Then i have the form, followed by

    [code]if(isset($_POST['submit'])) {

    $editted = $_POST['page_to_edit'];
    $fp = fopen($filename, "w") or die ("Could not open $filename. Make sure the file exists.");
    fwrite($fp, $editted);
    fclose($fp);
    }[/code]

    The problem is here:
    $filename = $_GET['page'];


    So when he clicks
    <a href="#?page=home" onclick="getData('home.html', 'newseditor')">Home</a>

    i need to get the variable 'home', but it won't do it.

    So, how can i make php know which file is it going to write to?

    Thank you.
  5. K.
    the problem is this:  /dev/
    for the rest of this post, let's assume $str  = '/dev/'

    so i try replacing the / with --- for testing purposes.

    it wont work still. before i even send $str to the database, i replace the / with --- and i still get errors.


    [code]function escape_data($data) {
    global $dbc;
    $data = preg_replace('"/"', '----', $data);
    if (ini_get('magic_quotes_gpc')) {
    $data = stripslashes($data);
    } return mysql_real_escape_string(trim($data), $dbc);
    }[/code]

    thats what i use to sanitize data. i put every input in the escape_data function you see above.

    so if i submit /dev, it will show up as ---dev
    if i submit dev/, it will show up as dev--

    but if i submit /dev/ i get the internal server error. even though it changes / to --- before even putting it on the db
  6. I cannot figure out what is wrong.

    Problem:
    Made a typical blog entry thing. I type the message and submit.
    However, when i enter this line:
    [b]# /dev/input/event[/b] i get a 500 Internal Server error.
    [b]"/dev/input/mice"[/b]  also gives me the same error

    but [b]"ZAxisMapping" "4 5"[/b] works. so it's not quotes. it's got something to do with the slashes, i would assume.

    Another thing: it only happens on my rented server(redhat). on my localhost(windows), it works fine.



    Here is the function i use to sanitize input data:
    [code]//function for escaping and trimming data
    function escape_data($data) {
    global $dbc;
    if (ini_get('magic_quotes_gpc')) {
    $data = stripslashes($data);
    } return mysql_real_escape_string(trim($data), $dbc);
    }[/code]

    Any thoughts?
    Thanks  :)


    ps: just to kill the curiosity, those lines are in my xorg.conf file. i want to post my xorg.conf in my site in case i need it in the future. (but obviously can't post because i get that error)
  7. Thanks Obsidian.
    I can't get it to work on my code though.

    Here's a sample line:
    [code]&lt;</font><font color="#0000bb">f</font><font color="#007700">&gt;<br>&lt;</font><font color="#0000bb">f</font><font color="#007700">&gt;</font><font color="#ff8000">// news query | display the news&gt;[/code]

    The < and > actually got replaced by &lt; and &gt; (its from a highlight_string() function).
    So if i used
    [code]preg_match('|&gt;l(.*)|&lt;', $text, $match);[/code]
    should do it right? because i can't get it to
  8. I know there is a sister site to this, ajaxfreaks.com, but that site is not as active as this one.
    So, since we already have Javascript/HTML/CSS forums, why not add Ajax to php freaks too? Perhaps blend it with the Javascript forums, so it's Javascript/Ajax, CSS, HTML.
×
×
  • 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.