Avatar billede supersquirrel Nybegynder
13. april 2007 - 15:20 Der er 5 kommentarer og
1 løsning

Upload virker ikke

Heysa..

Jeg er efter at have indsat noget i en fil der ikke har en pind at gøre med upload, stødt på et problem med upload..

Fejlene kan ses her:
http://img214.imageshack.us/img214/9256/fejljm1.png


Min kode er rimelig lang, men jeg ved ikke hvor meget i skal have så i får alle 762 linjer :D

Jeg vil nok råde jer til at bruge dreamweaver eller andet guf der har styr på linjenumre.

Here we go:



<?

require("../defs.php");

if ($_POST[action] == "login") {
    list($adminuser,$adminpass) = mysql_fetch_row(mysql_query("select adminuser,adminpass from admin;"));
    if (($_POST[adminuser] == $adminuser) && ($_POST[adminpass] == $adminpass)) {
        setcookie("adminuser",$adminuser,0);
        setcookie("adminpass",$adminpass,0);
    }
    header("location:index.php");
    exit();
}
elseif ($_GET[action] == "logout") {
    setcookie("adminuser","",0);
    setcookie("adminpass","",0);

    header("location:index.php");
    exit();
}


if (($_COOKIE[adminuser] != $adminuser) || ($_COOKIE[adminpass] != $adminpass) || ($_COOKIE[adminuser] == "")) {
    unset($_COOKIE);
    loginheader();

    print "<form action=index.php method=post>
    <input type=hidden name=action value=login>

    <center>
    BRUGERNAVN:<br>
    <input type=text name=adminuser><br><br>
    KODEORD:<br>
    <input type=password name=adminpass><br><br>
    <input type=submit value=Login>
    </center>";
    loginfooter();
}


if ($_GET[action] == "uploadphoto") {
    print "<font size=2 face=verdana>
    <form action=index.php method=post enctype=\"multipart/form-data\">
    <input type=hidden name=action value=uploadphoto2>
    <input type=hidden name=space value=$_GET[space]>
    <input type=hidden name=houseid value=$_GET[houseid]>
    Find billede: <input type=file name=userfile><br><br>
    <input type=submit value=\"Upload billede\"></form>";
    exit();
}
elseif ($_GET[action] == "uploadpdf") {
    print "<font size=2 face=verdana>
    <form action=index.php method=post enctype=\"multipart/form-data\">
    <input type=hidden name=action value=uploadpdf2>
    <input type=hidden name=nr value=\"$_GET[nr]\">
    <input type=hidden name=houseid value=$_GET[houseid]>
    Find PDF fil: <input type=file name=userfile><br><br>
    <input type=submit value=\"Upload prospekt\"></form>";
    exit();
}
elseif ($_POST[action] == "uploadpdf2") {
    $ext = split("\.",$_FILES[userfile][name]);
    $ext = strtolower($ext[count($ext)-1]);

    if ($ext != "pdf") {
        $error = "Forkert fil format";
    }
    else {
        if (!is_uploaded_file($_FILES[userfile][tmp_name])) {
            $error = "Fejl under upload";
        }
    }

    if ($error) {
        exit("Fejl: $error");
    }
    mysql_query("update houses set prospect$_POST[nr]='1' where houseid='$_POST[houseid]';");

    if ($_POST[nr] == 2) {
        $nr = "_2";
    }
    copy($_FILES['userfile']['tmp_name'],"../pdf/$_POST[houseid]$nr.pdf");

    print "<script>
    window.opener.location.reload();
    window.close();
    </script>";
    exit();
}
elseif ($_POST[action] == "uploadphoto2") {
    if ($_FILES[userfile]) {
        $ext = split("\.",$_FILES[userfile][name]);
        $ext = strtolower($ext[count($ext)-1]);

        if ((($ext != "jpg") && ($ext != "jpeg")) || (($_FILES[userfile][type] != "image/pjpeg") && ($_FILES[userfile][type] != "image/jpeg") && ($_FILES[userfile][type] != "image/jpg"))) {
            $error = "Forkert fil format - vi tillader desværre kun billeder af typen jpg/jpeg";
        }
        else {
            if (!is_uploaded_file($_FILES[userfile][tmp_name])) {
                $error = "Fejl under upload";
            }
        }
    }
    if ($error) {
        exit("Fejl: $error");
    }
    list($photoid) = mysql_fetch_row(mysql_query("select photoid from photos where houseid='$_POST[houseid]' and space='$_POST[space]';"));
    if ($photoid) {
        mysql_query("delete from photos where houseid='$_POST[houseid]' and space='$_POST[space]';");
        unlink("../images/photos/$photoid.jpg");
    }
    mysql_query("insert into photos values('','$_POST[houseid]','$_POST[space]');");
    $photoid = mysql_insert_id();
    if ($_POST[space] == 0) {
        mysql_query("update houses set mainphoto='$photoid' where houseid='$_POST[houseid]';");
    }

    $path = "../images/photos/$photoid.jpg";

    $imageInfo = getimagesize($_FILES['userfile']['tmp_name']);

    $oldwidth = $imageInfo[0];
    $oldheight = $imageInfo[1];

    $ratio = $oldwidth/400;
    $newheight = $oldheight/$ratio;
    $newheight = round($newheight);

    if (ereg("lokal.netomia",$_SERVER[HTTP_HOST])) {
        $dst = ImageCreate(400,$newheight);
    }
    else {
        $dst = ImageCreate(400,$newheight);
//        $dst = ImageCreatetruecolor(400,$newheight);
    }

//    copy($_FILES['userfile']['tmp_name'],$path);

    $src = ImageCreateFromJPEG($_FILES['userfile']['tmp_name']);

    imagecopyresized($dst,$src,0,0,0,0,400,$newheight,$oldwidth,$oldheight);
    imagejpeg($dst,$path);

    print "<script>
    window.opener.location.reload();
    window.close();
    </script>";
    exit();
}
elseif ($_GET[action] == "delphoto") {
    $photo = mysql_fetch_assoc(mysql_query("select * from photos where photoid='$_GET[photoid]';"));
    if ($photo) {
        mysql_query("delete from photos where photoid='$photo[photoid]';");
        @unlink("../images/photos/$photo[photoid].jpg");

        if ($photo[space] === 0) {
            mysql_query("update houses set mainphoto='0' where houseid='$_GET[houseid]';");
        }
    }

    header("location:index.php?action=viewhouse&houseid=$_GET[houseid]");
    exit();
}
elseif ($_GET[action] == "delprospect") {
    mysql_query("update houses set prospect$_GET[nr]='0' where houseid='$_GET[houseid]';");

    if ($_GET[nr] == 2) {
        $nr = "_2";
    }
    @unlink("../pdf/$_GET[houseid]$nr.pdf");

    header("location:index.php?action=viewhouse&houseid=$_GET[houseid]");
    exit();
}
elseif ($_GET[action] == "delwanted") {
    mysql_query("delete from wanted where wantedid='$_GET[wantedid]';");

    header("location:index.php?action=wanted");
    exit();
}
elseif ($_GET[action] == "delhouse") {
    @unlink("../pdf/$_GET[houseid].pdf");
    @unlink("../pdf/$_GET[houseid]_2.pdf");
    $res = mysql_query("select * from photos where houseid='$_GET[houseid]';");
    while ($photo = mysql_fetch_assoc($res)) {
        @unlink("../images/photos/$photo[photoid].jpg");
    }
    mysql_query("delete from photos where houseid='$_GET[houseid]';");
    mysql_query("delete from houses where houseid='$_GET[houseid]';");
    mysql_query("delete from prospects where houseid='$_GET[houseid]';");

    header("location:index.php");
    exit();
}
elseif ($_POST[action] == "changepass2") {
    if (($_POST[pass1] != $_POST[pass2]) || (!$_POST[pass1])) {
        loginheader();
        print "<b>Skift brugernavn/kodeord</b><br><br>";
        print "Fejl: du skal indtaste det samme kodeord to gange.";
    }
    else {
        setcookie("adminuser",$_POST[adminuser],0);
        setcookie("adminpass",$_POST[pass1],0);

        mysql_query("update admin set adminuser='$_POST[adminuser]',adminpass='$_POST[pass1]';");
        loginheader();
        print "<b>Skift brugernavn/kodeord</b><br><br>";
        print "Ændringerne er gemt.";
    }
    loginfooter();
}
elseif ($_GET[action] == "extract") {
    $res = mysql_query("select email from prospects where houseid='$_GET[houseid]';");
    while($p = mysql_fetch_row($res)) {
        $file .= "$p[0]\r\n";
    }

    $size = strlen($file);
    header("Content-Type: application/text/plain\n");
    header("Content-Disposition: attachment; filename=\"udtraek.txt\"\n");
    header("Content-Length: $size\n\n");
    print $file;
    exit();
}

loginheader();

if ($_GET[action] == "newhouse") {
    print "<b>Opret/rediger ejendom</b><br><br>";
    print form("index.php","newhouse2");

    if ($_GET[houseid]) {
        $house = mysql_fetch_assoc(mysql_query("select * from houses where houseid='$_GET[houseid]';"));
        print "<input type=hidden name=houseid value=$_GET[houseid]>";
    }
    if ($house[type] == "leje") {
        $checked[leje] = " checked";
        $field1 = "Årlig leje";
        $field2 = "Leje Kvm. P.a.";
    }
    else {
        $checked[salg] = " checked";
        $field1 = "Kontantpris";
        $field2 = "Afkast";
    }

    print "<table bgcolor=black cellspacing=1 cellpadding=5>
    <tr bgcolor=white>
    <td><font size=2>Kort beskrivelse</font></td>
    <td><input type=text name=shorttext value=\"$house[shorttext]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td width=100><font size=2>Beskrivelse</font></td>
    <td><textarea name=description cols=35 rows=10>$house[description]</textarea></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Adresse</font></td>
    <td><input type=text name=address value=\"$house[address]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Postnr</font></td>
    <td><input type=text name=zip value=\"$house[zip]\" size=4></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>By</font></td>
    <td><input type=text name=city value=\"$house[city]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Sagsnr</font></td>
    <td><input type=text name=casenr value=\"$house[casenr]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Kvm</font></td>
    <td><input type=text name=kvm value=\"$house[kvm]\" size=4></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Type</font></td>
    <td><font size=2>
    <select name='type' style='width: 99%'>
    <option value=>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Til salg</option>
    <option value=ejendomme>Ejendomme til eget brug</option>
    <option value=investerings>Investeringsejendomme</option>
    <option value=udenlandske>Udenlandske Ejendomme</option>
    <option value=> </option>
    <option value=>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Til leje</option>
    <option value=kontor>Kontor/Klinik</option>
    <option value=butik>Butikker</option>
    <option value=lager>Lager/Værksted</option>
    </select><br>
    <input type='radio' name='over_kat' value='salg'> Til salg&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type='radio' name='over_kat' value='leje'> Til leje
    </td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2><span id=field1>$field1</span></font></td>
    <td><input type=text name=price1 value=\"$house[price1]\" size=4></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2><span id=field2>$field2</span></font></td>
    <td><input type=text name=price2 value=\"$house[price2]\" size=4></td>
    </tr>
    </table><br><br>
    <input type=submit value=\"Gem informationer\">
    </form>

    <script language=javascript>
    function switch2() {
        if (document.getElementById('typesalg').checked == true) {
            document.getElementById('field1').innerHTML = 'Kontantpris';
            document.getElementById('field2').innerHTML = 'Afkast %';
        }
        else {
            document.getElementById('field1').innerHTML = 'Årlig leje';
            document.getElementById('field2').innerHTML = 'Leje Kvm p.a.';
        }
    }
    </script>";

    loginfooter();
}
elseif ($_POST[action] == "newhouse2") {
    if ($_POST[houseid]) {
        mysql_query("update houses set type='$_POST[type]',site='$_POST[type]',over_kat='$_POST[over_kat]',shorttext='$_POST[shorttext]',description='$_POST[description]',address='$_POST[address]',zip='$_POST[zip]',city='$_POST[city]',casenr='$_POST[casenr]',kvm='$_POST[kvm]',price1='$_POST[price1]',price2='$_POST[price2]' where houseid='$_POST[houseid]';");
    }
    else {
        mysql_query("insert into houses values('','$_POST[type]','$_POST[type]','$_POST[over_kat]','$_POST[shorttext]','$_POST[description]','$_POST[address]','$_POST[zip]','$_POST[city]','$_POST[casenr]','$_POST[kvm]','$_POST[price1]','$_POST[price2]','','','','','');");
        $_POST[houseid] = mysql_insert_id();
    }
    print "Ejendommen er gemt. <a href=index.php?action=viewhouse&houseid=$_POST[houseid]>Klik her</a> for at se informationerne.";

    loginfooter();
}
elseif ($_POST[action] == "newwanted2") {
    if ($_POST[wantedid]) {
        mysql_query("update wanted set housetype='$_POST[housetype]',companytype='$_POST[companytype]',location='$_POST[location]',pricelevel='$_POST[pricelevel]',casenr='$_POST[casenr]',kvm='$_POST[kvm]' where wantedid='$_POST[wantedid]';");
        print mysql_error();
    }
    else {
        mysql_query("insert into wanted values('','$_POST[casenr]','$_POST[housetype]','$_POST[kvm]','$_POST[location]','$_POST[companytype]','$_POST[pricelevel]');");
    }
    print "Profilen er gemt. <a href=index.php?action=wanted>Klik her</a> for at returnere til Søges profilerne.";

    loginfooter();
}
elseif ($_GET[action] == "find") {
    print "<b>Find ejendom</b>";
    print form("index.php?action=find","find2");
    print "<br>
    Søg efter: <input type=text name=q> i
    <select name=field>
    <option value=description>Beskrivelse</option>
    <option value=zip>Postnr</option>
    <option value=city>By</option>
    <option value=casenr>Sagsnr</option>
    </select>
    <input type=submit value=Søg></form><br><br><br>";


    if ($_POST[action] == "find2") {
        $res = mysql_query("select * from houses where $_POST[field] like '%$_POST[q]%' limit 0,30;");
        $title = "Søgeresultater";
    }
    else {
        $res = mysql_query("select * from houses order by houseid desc limit 0,30;");
        $title = "Senest oprettede ejendomme";
    }

    while ($house = mysql_fetch_assoc($res)) {
        $out .= "<tr><td colspan=4 height=1 bgcolor=gray></td></tr>
        <tr>
        <td><a href=index.php?action=viewhouse&houseid=$house[houseid]><img src=../images/photos/$house[mainphoto].jpg width=50 border=0></a></td>
        <td><font size=2>$house[casenr]</font></td>
        <td><font size=2>".ucfirst($house[type])."</font></td>
        <td><font size=2>$house[zip] $house[city]</font></td>
        </tr>";
    }
    print "<hr color=black><b>$title:</b><br><br>";
    if (!$out) {
        print "<i>Ingen ejendomme passede på søgningen</i>";
    }
    else {
        print "<table width=\"100%\" cellspacing=1 cellpadding=0>$out<tr><td colspan=4 height=1 bgcolor=gray></td></tr></table>";
    }

    loginfooter();
}
elseif ($_GET[action] == "viewhouse") {
    $house = mysql_fetch_assoc(mysql_query("select * from houses where houseid='$_GET[houseid]';"));

    $res = mysql_query("select * from photos where houseid='$_GET[houseid]';");
    while ($photo = mysql_fetch_assoc($res)) {
        $photos[$photo[space]] = $photo[photoid];
    }

    if ($house[type] == "salg") {
        $field1 = "Kontantpris";
        $field2 = "Afkast";
    }
    else {
        $field1 = "Årlig leje";
        $field2 = "Leje Kvm. P.a.";
    }
    if (strlen($house[description]) > 100) {
        $house[description] = substr($house[description],0,100)."..";
    }


    print "<b>Sagsnr: $house[casenr]</b><br><br>
    Type: ".ucfirst($house[type])."<br>
    Adresse: $house[address]<br>
    Postnr: $house[zip]<br>
    By: $house[city]<br>
    Kvm: $house[kvm]<br>
<!--    Beskrivelse: $house[description]<br>-->
    $field1: $house[price1]<br>
    $field2: $house[price2]<br>
    <br>

    [<a href=index.php?action=newhouse&houseid=$_GET[houseid]>Redigér oplysninger</a>] [<a href=\"java script:vrhouse();\">Slet ejendom</a>]
    <br><br>

    <a href=index.php?action=stats&houseid=$_GET[houseid]>Prospekter sendt: $house[prospectcount]</a><br>

    <br>

    <b>Billeder:</b>

    <table bgcolor=black cellpadding=1 cellspacing=0><tr>";

    for($i=0;$i<4;$i++) {
        $dellink = "<a href=\"java script:vr($photos[$i]);\">Slet</a>";
        if (!$photos[$i]) {$photos[$i] = 0;$dellink = "Slet";}
        print "<td bgcolor=white align=center valign=top><img src=../images/photos/$photos[$i].jpg width=100><br><font size=1>
        <a href=\"#\" onClick=\"window.open('index.php?action=uploadphoto&space=$i&houseid=$_GET[houseid]','Boxsettings','width=450,height=250,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,screenX=0,screenY=0');return false\">Upload</a>
        /
        $dellink</font></td>";
    }

    print "</tr></table>";

    $dellink = "<a href=\"java script:vr($photos[4]);\">Slet</a>";
    if (!$photos[4]) {$photos[4] = 0;$dellink = "Slet";}

    print "<br><br>
    <table bgcolor=black cellpadding=1 cellspacing=0>

    <tr><td bgcolor=white align=center valign=top><font size=2><b>Plantegning</b><br>
    <img src=../images/photos/$photos[4].jpg width=100><br><font size=1>
    <a href=\"#\" onClick=\"window.open('index.php?action=uploadphoto&space=4&houseid=$_GET[houseid]','Boxsettings','width=450,height=250,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,screenX=0,screenY=0');return false\">Upload</a>
    /
    $dellink</font></td>";


    $dellink = "<a href=\"java script:vr($photos[5]);\">Slet</a>";
    if (!$photos[5]) {$photos[5] = 0;$dellink = "Slet";}


    print "<td bgcolor=white align=center valign=top><font size=2><b>Kort</b><br>
    <img src=../images/photos/$photos[5].jpg width=100><br><font size=1>
    <a href=\"#\" onClick=\"window.open('index.php?action=uploadphoto&space=5&houseid=$_GET[houseid]','Boxsettings','width=450,height=250,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,screenX=0,screenY=0');return false\">Upload</a>
    /
    $dellink</font></td>";



    $dellink = "<a href=\"java script:vrpdf();\">Slet</a>";
    $prospect = "<a href=../pdf/$house[houseid].pdf><img src=../images/photos/pdf.jpg width=100 border=0></a>";
    if (!$house[prospect]) {$prospect = "<img src=../images/photos/0.jpg width=100>";$dellink = "Slet";}


    print "<td bgcolor=white align=center valign=top><font size=2><b>Prospekt</b><br>
    $prospect<br><font size=1>
    <a href=\"#\" onClick=\"window.open('index.php?action=uploadpdf&houseid=$_GET[houseid]','Boxsettings','width=450,height=250,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,screenX=0,screenY=0');return false\">Upload</a>
    /
    $dellink</font></td>";



    $dellink = "<a href=\"java script:vrpdf2();\">Slet</a>";
    $prospect = "<a href=../pdf/$house[houseid]_2.pdf><img src=../images/photos/pdf.jpg width=100 border=0></a>";
    if (!$house[prospect2]) {$prospect = "<img src=../images/photos/0.jpg width=100>";$dellink = "Slet";}


    print "<td bgcolor=white align=center valign=top><font size=2><b>Prospekt 2</b><br>
    $prospect<br><font size=1>
    <a href=\"#\" onClick=\"window.open('index.php?action=uploadpdf&nr=2&houseid=$_GET[houseid]','Boxsettings','width=450,height=250,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes,screenX=0,screenY=0');return false\">Upload</a>
    /
    $dellink</font></td>

    </tr></table>

    <script language=javascript>
    function vr(photoid){
        if (confirm (\"Vil du slette dette billede?\"))
            document.location.href='index.php?action=delphoto&houseid=$_GET[houseid]&photoid='+photoid;
    }
    function vrpdf(){
        if (confirm (\"Vil du slette denne PDF fil?\"))
            document.location.href='index.php?action=delprospect&houseid=$_GET[houseid]';
    }
    function vrpdf2(){
        if (confirm (\"Vil du slette denne PDF fil?\"))
            document.location.href='index.php?action=delprospect&houseid=$_GET[houseid]&nr=2';
    }
    function vrhouse(){
        if (confirm (\"Vil du slette denne ejendom samt tilhørende billeder, prospekt og statistik?\"))
            document.location.href='index.php?action=delhouse&houseid=$_GET[houseid]';
    }
    </script>";

    loginfooter();
}
elseif (($_GET[action] == "stats") && ($_GET[houseid])) {
    $house = mysql_fetch_assoc(mysql_query("select * from houses where houseid='$_GET[houseid]';"));

    print "<b>Sagsnr. $house[casenr] - prospekter sendt</b><br><br>
    <table width=\"100%\" bgcolor=gray cellspacing=1 cellpadding=2>";

    $res = mysql_query("select * from prospects where houseid='$_GET[houseid]' order by time desc limit 0,25;");
    while ($p = mysql_fetch_assoc($res)) {
        $date = date("j M, Y",$p[time]);
        print "<tr bgcolor=white>
        <td><font size=1>$date</font></td>
        <td><font size=1>$p[name]</font></td>
        <td><font size=1>$p[address]<br>$p[zip] $p[city]</font></td>
        <td><font size=1>Tlf: $p[phone]<br>$p[email]</font></td>
        </tr>";
    }
    print "</table><br><br>
   
    <a href=index.php?action=extract&houseid=$_GET[houseid]>Udtræk/download</a> - <a href=index.php?action=listexport&prospect=$_GET[houseid]>Overfør emails til mailing liste</a>";

    loginfooter();
}
elseif ($_GET[action] == "stats") {
    $time = time();
    $month = date("m",$time);
    $year = date("Y",$time);
    $fromtime = mktime(0,0,0,$month,0,$year);

    list($prospectmonth) = mysql_fetch_row(mysql_query("select count(*) from prospects where time>$fromtime;"));
    list($prospecttotal) = mysql_fetch_row(mysql_query("select sum(prospectcount) from houses;"));

    list($hitstotal) = mysql_fetch_row(mysql_query("select sum(hitcount) from houses;"));
    $monthyear = date("mY",time());
    list($hitsmonth) = mysql_fetch_row(mysql_query("select count(*) from hits where monthyear='$monthyear';"));
    mysql_query("delete from hits where monthyear!='$monthyear';");

    print "<b>Statistik</b><br><br>

    Prospekter sendt: $prospecttotal<br>
    Denne måned: $prospectmonth<br><br>

    Visninger: $hitstotal<br>
    Denne måned: $hitsmonth<br><br><br>

    <b>Top besøg:</b>
    <table width=\"100%\">";
    $res = mysql_query("select * from houses order by hitcount desc limit 0,5;");
    while ($house = mysql_fetch_assoc($res)) {
        list($hitsmonth) = mysql_fetch_row(mysql_query("select count(*) from hits where monthyear='$month$year' and houseid='$house[houseid]';"));

        print "<tr><td colspan=4 height=1 bgcolor=gray></td></tr>
        <tr>
        <td><a href=index.php?action=viewhouse&houseid=$house[houseid]><img src=../images/photos/$house[mainphoto].jpg width=50 border=0></a></td>
        <td><font size=2>$house[casenr]<br>$house[address]<br>$house[zip] $house[city]</font></td>
        <td align=right><font size=2>Besøg: $house[hitcount]<br>Denne måned: $hitsmonth</font></td>
        </tr>";
    }
    print "</table><br><br><br>

    <b>Top prospekt:</b>
    <table width=\"100%\">";
    $res = mysql_query("select * from houses order by prospectcount desc limit 0,5;");
    while ($house = mysql_fetch_assoc($res)) {
        list($prospectmonth) = mysql_fetch_row(mysql_query("select count(*) from prospects where time>$fromtime and houseid='$house[houseid]';"));

        print "<tr><td colspan=4 height=1 bgcolor=gray></td></tr>
        <tr>
        <td><a href=index.php?action=viewhouse&houseid=$house[houseid]><img src=../images/photos/$house[mainphoto].jpg width=50 border=0></a></td>
        <td><font size=2>$house[casenr]<br>$house[address]<br>$house[zip] $house[city]</font></td>
        <td align=right><font size=2><a href=index.php?action=stats&houseid=$house[houseid]>Prospekter sendt: $house[prospectcount]</a><br>Denne måned: $prospectmonth</font></td>
        </tr>";
    }
    print "</table>";

    loginfooter();
}
elseif ($_GET[action] == "newsletter") {
    print "<b>Nyhedsbrev</b><br><br>
    Klik herunder for at logge ind i administrationen til nyhedsbrevet.<br><br><center>

    <form action=http://liste.netomia.dk/main.php method=post target=_blank>
    <input type=hidden name=action value=login>
    <input type=hidden name=username value=bre>
    <input type=hidden name=password value=temp>
    <input type=submit value=Login></form></center>
   
    <br><br><br><b>Lister:</b><br><br>";
   
    print form("index.php","listexport");

    $res = mysql_query("select count(*) as number, catid from maillist group by catid;");
    while ($list = mysql_fetch_row($res)) {
        print "<input type=checkbox name=catid[] value=$list[1]> ".$mailcats[$list[1]]." ($list[0])<br>";
    }
    print "<br><input type=submit value=\"Overfør valgte til nyhedsbrevet\"></form><br><br><br><hr><b>Afmeld adresse</b><br><br>
    Følgende adresse kan indsættes i bunden af nyhedsbreve for at tillade afmeldelse:<br><br>http://bre.netomia.dk/?afmeld";

    loginfooter();
}
elseif (($_POST[action] == "listexport") || ($_GET[action] == "listexport")) {
    if ($_GET[prospect]) {
        $res = mysql_query("select email from prospects where houseid='$_GET[prospect]' group by email;");
    }
    else {
        foreach($_POST[catid] as $key => $catid) {
            $q .= $sep."catid='$catid'";
            $sep = " or ";
        }
        $res = mysql_query("select email from maillist where $q group by email;");
    }

    $listlink = listlink();
    $time = time();
    mysql_query("delete from addresses where listid='86';",$listlink);
    while(list($email) = mysql_fetch_row($res)) {
        mysql_query("insert into addresses values('34','86','$email','$time','','','');",$listlink);
        $count++;
    }
    mysql_query("update lists set listcount='$count' where listid='86';",$listlink);
    print mysql_error();

    print "<b>$count emails overført</b><br><br>Du kan nu klikke tilbage og logge ind i nyhedsbrev administrationen for at sende nyhedsbrev til de udvalgte email adresser.";

    loginfooter();
}
elseif ($_GET[action] == "wanted") {
    print "<b>Søges</b><br><br>
    <table bgcolor=gray width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">
    <tr bgcolor=white>
    <td><font size=1><b>Sagsnr.</b></font></td>
    <td><font size=1><b>Ejendomstype</b></font></td>
    <td><font size=1><div align=\"center\"><b>Kvm</b></div></td>
    <td><font size=1><b>Beliggenhed</b></font></td>
    <td><font size=1><b>Prisniveau</b></font></td>
    <td></td>
    </tr>";

    $res = mysql_query("select * from wanted;");
    while($w = mysql_fetch_assoc($res)) {
        print "
        <tr bgcolor=white>
        <td><font size=1>$w[casenr]</font></td>
        <td><font size=1>$w[housetype]</font></td>
        <td align=center><font size=1>$w[kvm]</font></td>
        <td><font size=1>$w[location]</font></td>
        <td><font size=1>$w[pricelevel]</font></td>
        <td nowrap>
        <a href=index.php?action=newwanted&wantedid=$w[wantedid]><img src=\"../images/edit.png\" border=0 title=Rediger></a>
        <a href=\"java script:vr($w[wantedid]);\"><img src=\"../images/delete.png\" border=0 title=Slet></a>
        </td>
        </tr>";
    }
    print "</table><br><br>
    [<a href=index.php?action=newwanted>Opret ny Søges-profil</a>]
    <script language=javascript>
    function vr(id){
        if (confirm (\"Vil du slette dette opslag?\"))
            document.location.href='index.php?action=delwanted&wantedid='+id;
    }
    </script>";

    loginfooter();
}
elseif ($_GET[action] == "newwanted") {
    print "<b>Opret/rediger \"Søges\" profil</b><br><br>";
    print form("index.php","newwanted2");

    if ($_GET[wantedid]) {
        $wanted = mysql_fetch_assoc(mysql_query("select * from wanted where wantedid='$_GET[wantedid]';"));
        print "<input type=hidden name=wantedid value=$_GET[wantedid]>";
    }

    print "<table bgcolor=black cellspacing=1 cellpadding=5>

    <tr bgcolor=white>
    <td><font size=2>Sagsnr</font></td>
    <td><input type=text name=casenr value=\"$wanted[casenr]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td width=100><font size=2>Type</font></td>
    <td><input type=text name=housetype value=\"$wanted[housetype]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Beskrivelse</font></td>
    <td><input type=text name=companytype value=\"$wanted[companytype]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Beliggenhed</font></td>
    <td><input type=text name=location value=\"$wanted[location]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Prisniveau</font></td>
    <td><input type=text name=pricelevel value=\"$wanted[pricelevel]\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td><font size=2>Kvm</font></td>
    <td><input type=text name=kvm value=\"$wanted[kvm]\" size=4></td>
    </tr>

    </table><br><br>
    <input type=submit value=\"Gem informationer\">
    </form>";

    loginfooter();
}
elseif ($_GET[action] == "changepass") {
    print "<b>Skift brugernavn/kodeord</b><br><br>";
    print form("index.php","changepass2");

    print "<table bgcolor=black cellspacing=1 cellpadding=5>

    <tr bgcolor=white>
    <td><font size=2>Brugernavn</font></td>
    <td><input type=text name=adminuser value=\"$adminuser\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td width=100><font size=2>Kodeord</font></td>
    <td><input type=password name=pass1 value=\"$adminpass\" size=19></td>
    </tr>

    <tr bgcolor=white>
    <td width=100><font size=2>Kodeord igen</font></td>
    <td><input type=password name=pass2 value=\"$adminpass\" size=19></td>
    </tr>

    </table><br>
    <input type=submit value=\"Gem ændringer\">
    </form>";

    loginfooter();
}
print "Login forside";

loginfooter();

?>
Avatar billede supersquirrel Nybegynder
13. april 2007 - 15:20 #1
Som jeg sagde - Meget lang :P
Avatar billede supersquirrel Nybegynder
13. april 2007 - 17:10 #2
Ingen der gider?
Avatar billede nixir Nybegynder
13. april 2007 - 20:55 #3
Du siger du smider noget ind fra en anden fil? Hvad er det der er kommet ekstra af kode som du mener har noget af gøre med det hele?
Avatar billede supersquirrel Nybegynder
13. april 2007 - 23:00 #4
Det jeg mener er at jeg har lavet noget nede i form, og har ikke pillet ved upload.. formulerede mig bare forkert
Avatar billede nixir Nybegynder
14. april 2007 - 13:48 #5
Okay ... Kan ikke lige overskue hvad der er gået galt, ville være en fordel hvis du havde en gammel version som virker (men bare anderledes)... Håber der er nogle eksperter der kan hjælpe...
Avatar billede supersquirrel Nybegynder
17. april 2007 - 20:43 #6
Lukker

Har fundet ud af at fejlen ligger ved hosteren.
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester