| | |
| Stránka: 1 z 1
| [ Príspevkov: 11 ] | |
Autor | Správa |
---|
Registrovaný: 11.02.07 Prihlásený: 07.10.09 Príspevky: 40 Témy: 15 Bydlisko: Košice | Napísal Tomik: 29.10.2007 22:32 | |
|
Ahoj chcem jednu radu,mam shoutbox a ked niekto pošle link je to dost nepriehladne chcem vediet nejaký spqsob ako docielit toto:
Ked niekto pošle link vyzerá to takto:(prikla)
Kód: http://www.pcforum.sk/posting.php?mode=newtopic&f=71
A chcel by som docielit niečo také:
LINK
Dakujem vopred
|
|
Registrovaný: 30.05.06 Prihlásený: 08.10.14 Príspevky: 1756 Témy: 35 Bydlisko: BA - WESTSIDE | Napísal p360t: 30.10.2007 7:40 | |
|
http://www.regularnivyrazy.info/prevede ... odkaz.html
Kód: $pattern = "((http://)|(www\.))([^ ]+[^,. ])"; $replacement = '<a href="http://$3$4">$2$3$4</a>'; // prípadne '<a href="http://$3$4">LINK</a>' $string = eregi_replace($pattern, $replacement, $string);
_________________
A. S. Tanenbaum píše: The terms LF, MF, and HF refer to low, medium, and high frequency, respectively. Clearly, when the names were assigned, nobody expected to go above 10 MHz, so the higher bands were later named the Very, Ultra, Super, Extremely, and Tremendously High Frequency bands. Beyond that there are no names, but Incredibly, Astonishingly, and Prodigiously high frequency (IHF, AHF, and PHF) would sound nice. |
|
Registrovaný: 11.02.07 Prihlásený: 07.10.09 Príspevky: 40 Témy: 15 Bydlisko: Košice | Napísal autor témy Tomik: 30.10.2007 18:53 | |
|
Čawko a vedel by si to zakodit do tohot scriptu?
Kód: <?php define('ADMIN_PASS', '*******');
function strip_chars($var) { return trim(str_replace("\r", NULL, htmlspecialchars(stripslashes(strip_tags($var)), ENT_QUOTES))); }
function bbcode($var) { $var = preg_replace('/http:\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%%&\/~\+#])?/i', '<a href="$0">$0</a>', $var); $var = preg_replace('(\[b\](.+?)\[\/b\])is', '<b>$1</b>', $var); $var = preg_replace('(\[i\](.+?)\[\/i\])is', '<i>$1</i>', $var); $var = preg_replace('(\[u\](.+?)\[\/u\])is', '<u>$1</u>', $var); return trim($var); }
if (isset($_POST['password'])) { $password = md5($_POST['password']); if ($password == md5(ADMIN_PASS)) { setcookie('password', $password); } } else { $password = isset($_COOKIE['password']) ? $_COOKIE['password'] : NULL; } if (isset($_GET['admin']) && $_GET['admin'] == 'logout') { setcookie('password', ''); unset($_COOKIE['password'], $password); header("Location: ".$_SERVER['PHP_SELF']); exit; } else if (isset($_GET['admin']) && $_GET['admin'] == 'delete') { if ($password == md5(ADMIN_PASS)) { if ($file = fopen('./guestbookdb.php', 'r')) { $data = ''; while (!feof($file)) { $line = fgets($file, 4096); list($timestamp) = explode(chr(02), trim($line)); if ($timestamp == $_GET['msg']) { $data .= fread($file, filesize('./guestbookdb.php')); fclose($file); if (!$file = fopen('./guestbookdb.php', 'w')) { break; } fwrite($file, $data); fclose($file); break; } else { $data .= $line; } } } } header("Location: ".$_SERVER['PHP_SELF']); exit; } if($_SERVER['REQUEST_METHOD'] == 'POST') { $_POST = str_replace(chr(02), ' ', $_POST); $ip = $_SERVER['REMOTE_ADDR']; $name = strip_chars($_POST['name']); $subject = strip_chars($_POST['subject']); $email = strip_chars($_POST['email']); $website = strip_chars($_POST['website']); $message = str_replace("\n", "<br>", strip_chars($_POST['message'])); $message = bbcode($message); $timestamp = time(); if (!(empty($name) || empty($message))) { $file = fopen('./guestbookdb.php', 'a+'); $data = $timestamp . chr(02) . $name . chr(02) . $subject . chr(02) . $email . chr(02) . $website . chr(02) . $message . chr(02) . $ip . "\n"; fwrite($file, $data); fclose($file); } header("Location: ".$_SERVER['PHP_SELF']); exit; } ?> <html> <head> <title>Pridaj mp3 :)</title> <style type="text/css"> body { background-color: #A5C8DE; color: #FFFFFF; } td { font-family: Arial; color: #FFFFFF; font-size: 11px; font-weight: bold; } input, textarea { background-color: #A5C8DE; color: #FFFFFF; font-size: 11px; border-style: solid; border-width: 1px; border-color: #A5C8DE; } p.title { font-family: Arial; font-size: 11px; color: #FFFFFF; font-weight: bold; text-decoration: underline; } .banner { font-family: Arial; font-size: 11px; background-color: #A5C8DE; color: #A5C8DE; font-weight: bold; } .message { font-family: Arial; font-size: 11px; background-color: #A5C8DE; color: #A5C8DE; } a:link, a:visited { color: #A5C8DE; } a:hover { color: #A5C8DE; } </style> </head> <body> <?php if (isset($_GET['admin'])) { if ($_GET['admin'] == 'login') { echo "<center>\n"; echo "<p class=\"title\">Guestbook login</p>\n"; echo "<form method=\"post\" action=\"".$_SERVER['PHP_SELF']."\"><p><input type=\"password\" name=\"password\" size=\"20\" /> <input type=\"submit\" value=\"Login\" name=\"submit\" /></p></form>\n"; echo "</center>\n"; } } else { echo "<p align=\"center\" class=\"title\">Pridaj mp3 :)</p>\n"; if ($password != md5(ADMIN_PASS)) { echo "<form action=\"".$_SERVER['PHP_SELF']."\" method=\"post\">\n"; echo "<table width=\"100%\" style=\"background-color:#6695B1;\">\n"; echo " <tr>\n"; echo " <td width=\"72\">Interprét:</td>\n"; echo " <td><input type=\"text\" value=\"\" name=\"name\" style=\"width:100%;\"/></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>Size/velkost:</td>\n"; echo " <td><input type=\"text\" name=\"subject\" style=\"width:100%;\"/></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td>Link na mp3</td>\n"; echo " <td><textarea name=\"message\" rows=\"3\" style=\"width:100%;\"></textarea></td>\n"; echo " </tr>\n"; echo " <tr>\n"; echo " <td></td>\n"; echo " <td><input type=\"submit\" name=\"Submit\" value=\"Pridat mp3\"/>"; echo "</td>\n"; echo " </tr>\n"; echo "</table>\n"; echo "</form>\n"; }
if(filesize('./guestbookdb.php') == 0) { echo "<font style=\"font-family:Arial;color:#A5C8DE;font-size:11px;\">No posts found.<br></font>\n"; } else { $items = file('./guestbookdb.php'); $items = array_reverse($items); str_replace("<", "<", $items); str_replace(">", ">", $items); str_replace("\n", "<br>\n", $items); foreach($items as $line) { list($timestamp, $name, $subject, $email, $website, $message, $ip) = explode(chr(02), trim($line)); $topic = "\n<div class=\"banner\">"; $topic .= date('m/d/Y H:i:s',$timestamp) . " "; if ($email != "") { $topic .= "<a href=\"mailto:$email\">"; } $topic .= "$name"; if ($email != "") { $topic .= "</a>"; } if ($website != "") { $website = eregi_replace("^http://", "", $website); $topic .= " (<a href=\"http://$website\" target=\"_blank\">$website</a>) - "; } else { $topic .= " - "; } $topic .= "$subject</div>\n"; $topic .= "<div class=\"message\">$message</div>\n"; echo $topic; if ($password == md5(ADMIN_PASS)) { echo "<div class=\"banner\"><a href=\"".$_SERVER['PHP_SELF']."?admin=delete&msg=$timestamp\">[delete]</a> <a href=\"http://whois.sc/".$ip."\" target=\"_blank\" title=\"".$ip."\">[whois]</a></div>\n"; } echo "<br>\n"; } } echo "<br>\n"; if ($password == md5(ADMIN_PASS)) { echo "<a href=\"".$_SERVER['PHP_SELF']."?admin=logout\"><font style=\"font-family:Arial;color:#A5C8DE;font-size:11px;\">Logout</a><br></font>\n"; } } ?> </body> </html>
|
|
Registrovaný: 30.05.06 Prihlásený: 08.10.14 Príspevky: 1756 Témy: 35 Bydlisko: BA - WESTSIDE | Napísal p360t: 31.10.2007 10:19 | |
|
Ono to tam už je, ale v inej podobe. Ak si všimneš funkciu bbcode(), robí presne toto isté.
Ale ak ti to tak nejde, skús to takto:
Kód: function bbcode($var) { $var = preg_replace('/http:\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%%&\/~\+#])?/i', '<a href="$0">$0</a>', $var); $pattern = "((http://)|(www\.))([^ ]+[^,. ])"; $replacement = '<a href="http://$3$4">$2$3$4</a>'; $var = eregi_replace($pattern, $replacement, $var); $var = preg_replace('(\[b\](.+?)\[\/b\])is', '<b>$1</b>', $var); $var = preg_replace('(\[i\](.+?)\[\/i\])is', '<i>$1</i>', $var); $var = preg_replace('(\[u\](.+?)\[\/u\])is', '<u>$1</u>', $var); return trim($var); }
_________________
A. S. Tanenbaum píše: The terms LF, MF, and HF refer to low, medium, and high frequency, respectively. Clearly, when the names were assigned, nobody expected to go above 10 MHz, so the higher bands were later named the Very, Ultra, Super, Extremely, and Tremendously High Frequency bands. Beyond that there are no names, but Incredibly, Astonishingly, and Prodigiously high frequency (IHF, AHF, and PHF) would sound nice. |
|
Registrovaný: 11.02.07 Prihlásený: 07.10.09 Príspevky: 40 Témy: 15 Bydlisko: Košice | Napísal autor témy Tomik: 01.11.2007 10:27 | |
|
Som vdačný že pomáhaš
Skusil som to dat tak ako si povedal a stále ukazuje len link
Maš ešte nejaké riešenie?
|
|
Registrovaný: 30.05.06 Prihlásený: 08.10.14 Príspevky: 1756 Témy: 35 Bydlisko: BA - WESTSIDE | Napísal p360t: 01.11.2007 10:59 | |
|
A je to len čisto link, alebo odkaz s anchor textom link (tj. dá sa naň kliknúť alebo nie)?
_________________
A. S. Tanenbaum píše: The terms LF, MF, and HF refer to low, medium, and high frequency, respectively. Clearly, when the names were assigned, nobody expected to go above 10 MHz, so the higher bands were later named the Very, Ultra, Super, Extremely, and Tremendously High Frequency bands. Beyond that there are no names, but Incredibly, Astonishingly, and Prodigiously high frequency (IHF, AHF, and PHF) would sound nice. |
|
Registrovaný: 11.02.07 Prihlásený: 07.10.09 Príspevky: 40 Témy: 15 Bydlisko: Košice | Napísal autor témy Tomik: 01.11.2007 11:03 | |
|
...da sa nanho kliknut
|
|
Registrovaný: 07.03.06 Prihlásený: 23.01.11 Príspevky: 404 Témy: 2 Bydlisko: Prešov / Pr... | Napísal mylan: 01.11.2007 11:14 | |
|
On tam chce mať LINK... Takto to nahraď: Kód: $replacement = '<a href="http://$3$4">LINK</a>';
|
|
Registrovaný: 11.02.07 Prihlásený: 07.10.09 Príspevky: 40 Témy: 15 Bydlisko: Košice | Napísal autor témy Tomik: 01.11.2007 11:21 | |
|
Ja neviem prečo ale normalné to nejde,skusil som aj tvoju verziu mylan a aj p360t,a nefunguje to,vkuse je tam link
|
|
Registrovaný: 30.05.06 Prihlásený: 08.10.14 Príspevky: 1756 Témy: 35 Bydlisko: BA - WESTSIDE | Napísal p360t: 01.11.2007 11:23 | |
|
Takto uprav funkciu bbcode a už to pôjde.
Kód: function bbcode($var) { $var = preg_replace('/http:\/\/[\w]+(.[\w]+)([\w\-\.,@?^=%&:\/~\+#]*[\w\-\@?^=%%&\/~\+#])?/i', '<a href="$0">LINK</a>', $var); $var = preg_replace('(\[b\](.+?)\[\/b\])is', '<b>$1</b>', $var); $var = preg_replace('(\[i\](.+?)\[\/i\])is', '<i>$1</i>', $var); $var = preg_replace('(\[u\](.+?)\[\/u\])is', '<u>$1</u>', $var); return trim($var); }
_________________
A. S. Tanenbaum píše: The terms LF, MF, and HF refer to low, medium, and high frequency, respectively. Clearly, when the names were assigned, nobody expected to go above 10 MHz, so the higher bands were later named the Very, Ultra, Super, Extremely, and Tremendously High Frequency bands. Beyond that there are no names, but Incredibly, Astonishingly, and Prodigiously high frequency (IHF, AHF, and PHF) would sound nice. |
|
Registrovaný: 11.02.07 Prihlásený: 07.10.09 Príspevky: 40 Témy: 15 Bydlisko: Košice | Napísal autor témy Tomik: 01.11.2007 11:33 | |
|
Ja som stoho ****,ešte stále nejde no toto
|
|
| Stránka: 1 z 1
| [ Príspevkov: 11 ] | |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|