Jump to content

cordoprod

Members
  • Posts

    226
  • Joined

  • Last visited

    Never

Everything posted by cordoprod

  1. Hi.. I have a wysiwyg editor (tinymce) and use mysql database. What i want to do is: when the user submits the form i want to kind of clean the $_POST. I do not want following: - javascript (of any kind) - flash (but, from allowed pages) I am trying but can't really figure out what to do
  2. Hi. I have a page, and i want to make a tabbed panel kind of. But i want ajax, to load the page in the content. But the problem is, i include a lot of pages, and when i load the page in the content, they disappear. ajax.js: function ahah(url, target) { document.getElementById(target).innerHTML = ' <img src=\"img/icon/square-loader.gif\" title=\"Laster innhold...\" />'; if (window.XMLHttpRequest) { req = new XMLHttpRequest(); } else if (window.ActiveXObject) { req = new ActiveXObject("Microsoft.XMLHTTP"); } if (req != undefined) { req.onreadystatechange = function() {ahahDone(url, target);}; req.open("GET", url, true); req.send(""); } } function ahahDone(url, target) { if (req.readyState == 4) { // only if req is "loaded" if (req.status == 200) { // only if "OK" document.getElementById(target).innerHTML = req.responseText; } else { document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText; } } } function load(name, div) { ahah(name,div); return false; } the page where the panel is: <?PHP head("stage/Settings", "Innstillinger"); ?> <table width="98%" border="0" cellspacing="1" cellpadding="2"> <tr> <td><div class="menybar" align=center> <ul> <li><a href="user.php" onclick="load('user.php','content');return false;">Profiltekst</a></li> <li><a href="user.php" onclick="load('user.php','content');return false;">Brukerkonto</a></li> <li><a href="profilbilde.php" onclick="load('inc/sider/profilbilde.php','content');return false;">Profilbilde</a></li> <li><a href="user.php" onclick="load('user.php','content');return false;">Svarteliste</a></li> <li><a href="user.php" onclick="load('user.php','content');return false;">Slett konto</a></li> </ul> </div></td> </tr> <tr> <td style="padding-left: 15px; padding-top: 5px;"><span id="content"></span></td> </tr> </table> profilbilde.php <?PHP include("../func/connect.php"); include("../func/profil.php"); include("../func/design.php"); include("../func/general.php"); include("../func/image.php"); ?> <table width="98%" border="0" cellspacing="0" cellpadding="3"> <tr> <td class="header"><?PHP smallinfo("Her kan du endre ditt profilbilde.<br>Støttede bildeformater: jpg, gif, png"); ?></td> </tr> <tr> <td valign="top"><?PHP if($_GET['action'] == "upload") { $uploadedfile = $_FILES['uploadedfile']['tmp_name']; $uploadedfile2 = $_FILES['uploadedfile']['name']; $type = explode(".", $uploadedfile2); if($type[1] == "png" or $type[1] == "gif" or $type[1] == "jpg") { CropImage(640, 480, $uploadedfile, $type[1], "img/profil/".$_SESSION['username'].".jpg", 80); CropImage(160, 196, $uploadedfile, $type[1], "img/profil/".$_SESSION['username']."_medium.jpg", 80); CropImage(60, 74, $uploadedfile, $type[1], "img/profil/".$_SESSION['username']."_tiny.jpg", 80); header("Location: ?s=profilbilde"); } else echo "<div>Det skjedde en feil ved opplastning av profilbildet.<br>Se over at profilbildet stemmer overens med kravene.<br><br>Gjeldene format: {$type[1]}<br>Støttede formater: jpg, gif, png</div>"; } elseif($_GET['action'] == "slett") { unlink("img/profil/".$_SESSION['username']."_medium.jpg"); unlink("img/profil/".$_SESSION['username']."_tiny.jpg"); unlink("img/profil/".$_SESSION['username'].".jpg"); header("Location: ?s=profilbilde"); } else {?> <table width="118%" border="0" cellspacing="0" cellpadding="2"> <tr> <td colspan="2"><b>Ditt profilbilde</b></td> </tr> <?PHP if(file_exists("img/profil/".$_SESSION['username']."_tiny.jpg") && file_exists("img/profil/".$_SESSION['username'].".jpg")) { ?> <tr> <td width="27%"><img src="img/profil/<?PHP echo $_SESSION['username']; ?>.jpg" width="360" height="270" /></td> <td width="73%" valign="bottom"><img src="img/profil/<?PHP echo $_SESSION['username']; ?>_medium.jpg" /> <img src="img/profil/<?PHP echo $_SESSION['username']; ?>_tiny.jpg" /></td> </tr> <? } else echo "<tr><td>Du har ikke lastet opp profilbilde enda.</td></tr>"; ?> </table> <br /> <table width="90%" border="0" cellspacing="0" cellpadding="2"> <tr> <td width="34%"><b>Last opp</b></td> </tr> <tr> <td><form enctype="multipart/form-data" action="?s=profilbilde&action=upload" method="post"> <input type="hidden" name="MAX_FILE_SIZE" value="2097152" /> Bilde:<br /> <input name="uploadedfile" type="file" /> <br /> <input name="submit2" type="submit" id="submit2" value="Last opp bilde" /> </form></td> </tr> </table> <br /> <table width="90%" border="0" cellspacing="0" cellpadding="2"> <tr> <td><b>Fjern bilde</b></td> </tr> <tr> <td><form action="?s=profilbilde&action=slett" method="get"> <input name="s" type="hidden" value="profilbilde" /> <input name="action" type="hidden" value="slett" /> <input name="submit" type="submit" id="submit" value="Fjern bilde" /> </form></td> </tr> </table> <br /> <? } ?></td> </tr> </table> ask me if i'm uncertain
  3. Hi. I want to do something with my form. It's a thing for getting where we live. Like this: TEXTFIELD *hidden span which is going to appear when postal code is entered* I want to be able to add the postal code to a textfield. And then i have a hidden span which is going to appear when the postal code is entered. What is going to appear in the span is from a database: Here is my code: ajax.php if($_GET['action'] == 'bosted') { $db = new DbConnector(); $db->connect(); $sql = "SELECT * FROM postnummer WHERE postnummer='".$_REQUEST['postnummer']."'"; $fetch = $db->fetchArray($db->query($sql)); echo $fetch['fylke'].", ".$fetch['kommune']; } register.php <script language="javascript" type="text/javascript"> <!-- //Browser Support Code function ajaxFunction(){ var ajaxRequest; try{ ajaxRequest = new XMLHttpRequest(); } catch (e){ try{ ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { try{ ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e){ alert("Bytt nettleser!"); return false; } } } ajaxRequest.onreadystatechange = function(){ if(ajaxRequest.readyState == 4){ document.getElementById('postbox').text = ajaxRequest.responseText; } } ajaxRequest.open("GET", "ajax.php?action=bosted&postnummer=".$("#password").val();."", true); ajaxRequest.send(null); } //--> </script> <label> <input name="reg_postnummer" type="text" id="reg_postnummer" size="4" onChange="ajaxFunction();"> </label> <span id="postbox"></span>
  4. I have a new one.. I just want to have a form like mentioned with e.g age.. And then output it in GET form, and then visit all the results. Anyone knows how to do that?
  5. Both, kind of... I just know how to get the page... I need further help. My code so far: /** * Get a web file (HTML, XHTML, XML, image, etc.) from a URL. Return an * array containing the HTTP server response header fields and content. */ function get_web_page( $url ) { $options = array( CURLOPT_RETURNTRANSFER => true, // return web page CURLOPT_HEADER => false, // don't return headers CURLOPT_FOLLOWLOCATION => true, // follow redirects CURLOPT_ENCODING => "", // handle all encodings CURLOPT_USERAGENT => "spider", // who am i CURLOPT_AUTOREFERER => true, // set referer on redirect CURLOPT_CONNECTTIMEOUT => 120, // timeout on connect CURLOPT_TIMEOUT => 120, // timeout on response CURLOPT_MAXREDIRS => 10, // stop after 10 redirects ); $ch = curl_init( $url ); curl_setopt_array( $ch, $options ); $content = curl_exec( $ch ); $err = curl_errno( $ch ); $errmsg = curl_error( $ch ); $header = curl_getinfo( $ch ); curl_close( $ch ); $header['errno'] = $err; $header['errmsg'] = $errmsg; $header['content'] = $content; return $header; }
  6. Hi. I am making a crawler with cURL. What I want to do is to search in a DB, and get it from GET. Example: Age: 14 to 16 outputs agefrom=14&ageto=16 And then, I want to use cURL to search and get how many db lines there are in the age beetween 14 and 16, and then visit all the search result pages. Also, additional i want to see how many lines there are, and more specific if you understand.
  7. Hi guys. This might be a little tricky to understand but i'll give it my best. I am developing a news system in php and mysql. What i want is to have a (e.g) folder called plugins and on my website people can download plugins that they can add to that folder and use plugins. That could be for example emoticons, and other things. But i don't know how to make a solution so people e.g could install these. any help?
  8. I figured it out myself i obviously had to switch around the > and <.
  9. Hello. I want to display a welcome message when a user logs in. Here is my code: function welcome($timestamp) { $time = time(); if($timestamp-$time > 0 and $timestamp-$time < 86400) { return "Nice too see you again so soon."; } elseif($timestamp-$time > 86400 and $timestamp-$time < 604800) { return "Nice too see you, it's been a short while."; } elseif($timestamp-$time > 604800 and $timestamp-$time < 2629743.83) { return "Nice too see you again. It's been a long time."; } elseif($timestamp-$time > 2629743.83 and $timestamp-$time < 31556926) { return "I am glad too see you active. Long time no see......."; } else { return "Wow, you're online. It's been over a year!"; } } I have a timestamp (generated from time() and the rest is pretty obvious i guess. The cases are a day, a week, a month, a year, and so on. :-)
  10. Hi. I need some help, maybe it's very easy but i dont know how. I want to place a table (not its content) in the middle of the page. I know how to center it but not how to vertical center it so its in the middle vertically too. Any help?
  11. Sorry, a bit misunderstanding. I am making a news script in PHP and need a name for it.
  12. I need a name for a mysql based news script. It's for personal websites. Like cutenews.
  13. Output: 23:14 glenn glenn ble venn med cairoli 23:14 hei iiejijji 17:00 glenn blabla 13:59 demo lastet opp videoen Roy Abelseth (gone too soon). 17:00 cordoprod har blitt kul. It does not join the days, and the $datepart is empty.
  14. I tried something here. no success
  15. Should i use that code? I mean that isn't php? right?
  16. I think i'm on the wrong track here but something like this? <? $db = new DbConnector(); $db->connect(); $sql = "SELECT *, DATE(FROM_UNIXTIME(time)) as datepart FROM travek_feed"; $result = $db->query($sql); $lastdate=''; while($fetch = mysql_fetch_array($result)) { if ($datepart != $lastdate) { $datepart = norsk_dato($fetch['time'], false); $lastdate = $datepart; } ?> <table width="100%" border="0" cellspacing="0" cellpadding="2"> <? echo "<tr><td style=\"border-bottom: 1px solid #000000;\">$datepart</td></tr>"; ?> <tr> <td><? echo date("H:i", $fetch['time']); ?></td> <td><? echo "<a href=\"?s=user&nick={$fetch['nick']}\">".$fetch['nick']."</a> ".$fetch['action']; ?></td> </tr> </table> <? } ?>
  17. And what kind of coding is that? ???
  18. What do you mean? Can you show a bit more detailed?
  19. Do i need group by in my query?
  20. Now i saw that all 5 rows were there.. just some of them didn't match the day
×
×
  • 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.