Jump to content

alen

Members
  • Posts

    64
  • Joined

  • Last visited

    Never

Posts posted by alen

  1. I'm trying to setup apache2 with an old version php. But there's this one error that I can't seem to figure out.

     

    httpd.exe: Syntax error on line 486 of C:/Server/apache/conf/httpd.conf: Cannot load C:/Server/php/sapi/php4apache2.dll into server: The module could not be found.

     

    I'm 110% certain that php4apache2.dll is in that directory. What could be wrong?

  2. I made this simple guestbook script which stores everything in a file. I would have used a sql database, but I don't have one. Anyway .. I need to sort the entries. The newest entry comes first.

     

    You can find my script at;

     

    http://anigma.sitees.com/Guestbook/index.phps

    http://anigma.sitees.com/Guestbook/lagre.phps (lagre=save)

     

    and you can test my script here;

     

    http://anigma.sitees.com/Gjestebok/index.php

     

    Any idea on what I can do? I know how to sort it with MySQL, but I think it's not quite the same.

  3. <?php
    error_reporting(0);
    $filnavn = $_GET['var'];
    $filendelse = '.php';
    if (!$filnavn) { 
    $filnavn = 'default'; 
    }
    $filnavn = 'include';
    
    if (file_exists($filnavn)) {
    include $filnavn . $filendelse;
    } else {
    include "404.php";
    }
    if (!eregi("^((.*)/)", $filnavn)) {
      include $filnavn . $filendelse;
    }
    else {
      include "404.php";
    }
    ?>

     

    This must be wrong. Couldn't you just help me out a little. Give me a jumpstart?

  4. What about this,

     

    <?php
    error_reporting(0);
    $filnavn = $_GET['var'];
    $filendelse = '.php';
    if (!$filnavn) {
    $filnavn = 'default';
    }
    if (!eregi("^((.*)/)", $filnavn))  {
      include $filnavn . $filendelse;
    }
    else {
      include "404.php";
    }
    ?>

     

    It works fine, but when I go to index.php?var=unknownpage I doesn't include 404.php.

     

    How can I use file_exists() here? I use if (!eregi("^((.*)/)", $filnavn)) so people can't access other folders.

  5. This is my include script:

     

    <?PHP                   
    $incpath = "include";
    $default = "index"; 
    $getarray = "side"; 
    $filendelse = "php";
    
    if (isset($_GET[$getarray]))
    {
        include_once ("$incpath/".$_GET[$getarray].".$filendelse");
    }
    else
    {
        include_once ("$incpath/$default.$filendelse");
    }        
    ?> 

     

    It works like this, I have a index.php file in the include folder and a index.php file in the public_html folder. When I enter localhost I get the content of index.php in the include folder since index.php in the public_html folder includes the index file in the include folder. And I have some other links in the include folder too, and I can easily change to another link with http://localhost/index.php?id=name - But let's say I don't have a file named hello.php in the include folder. How can I make the script automatically open a file called 404.php then?

     

    Best regards

    Your friendly neighbour Alen!

  6. Hi there!

     

    I have this simple include script,

     

    <?PHP                   
    $incpath = "include";
    $default = "index"; 
    $getarray = "side"; 
    $filendelse = "php";
    
    if (isset($_GET[$getarray]))
    {
        include_once ("$incpath/".$_GET[$getarray].".$filendelse");
    }
    else
    {
        include_once ("$incpath/$default.$filendelse");
    }        
    ?> 

     

    Well, you can probably see what it does. The links are as simple as this, index.php?side=page - how can I make it be something like this, index.php?side=test&id=whatever or something like that... How can I play with this script? Are there any guides or something on the net which explains include basics? And I donæt mean php.net

  7. It didn't actually do what I wanted to.. But here's my solution:

    [code]
    <?
    error_reporting(E_ALL ^ E_NOTICE);

    mysql_connect("localhost","nancy","blabla");

    mysql_select_db("nancy");

    if(!isset($_GET["cmd"]))
    {
      $result = mysql_query("select * from news order by id");
     
      while($r=mysql_fetch_array($result))
      {
          $title=$r["title"];
          $id=$r["id"];
       
    echo "<p>endre nyheter:</p>";
          echo "<a href='edit.php?cmd=edit&id=$id'>$title</a><br/>";
        }
    }
    ?>
    <?
    if($_GET["cmd"]=="edit" || $_POST["cmd"]=="edit")
    {
      if (!isset($_POST["submit"]))
      {
          $id = $_GET["id"];
          $sql = "SELECT * FROM news WHERE id=$id";
          $result = mysql_query($sql);       
          $myrow = mysql_fetch_array($result);
          ?>
     
          <form action="edit.php" method="post">
      <table>
    <tr>
          <td>tittel:</td>
    <td><input type="text" name="title" value="<?php echo $myrow["title"] ?>" size='40'></td>
    </tr>
    <tr>
    <td>forfatter:</td>
    <td><input type="text" name="author" value="<?php echo $myrow["author"] ?>" size='40'></td>
    </tr>
    <tr>
          <td>tekst:</td>
    <td><textarea name="news" cols='30' rows='5'><? echo $myrow["news"] ?></textarea></td>
    </tr>
    <tr>
    <td></td><br>
          <td><input type="hidden" name="cmd" value="edit"><input type="submit" name="submit" value="endre"></td>
    </tr>
    </table> 
          </form>

    <? } ?>
    <?
      if ($_POST["submit"])
      {
          $title = $_POST["title"];
      $news = $_POST["news"];
      $author = $_POST["author"];
     
      $sql = "UPDATE news SET title='$title',news='$news',author='$author' WHERE id=$id";

          $result = mysql_query($sql);
          echo "query finished.";
    }
    }
    ?>
    [/code]

    It works fine. But when I echo "query finished", I can see the "endre nyheter" and the link to the news item. I want query finished. to come on a own page. How would I manage to do that?

  8. i made a code that's supposed to update the news when i submit.

    here is the structure of the code, http://anigma.sitees.com/edit.txt

    when i enter the "endre" button, it only returns to the main edit.php site.

    what's wrong here?
×
×
  • 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.