Jump to content

thibo1025

Members
  • Posts

    118
  • Joined

  • Last visited

Posts posted by thibo1025

  1. Ok forget about what I did...My new code is this:

    <?php$dir = getcwd();$dirsep = "/";$handle = opendir($dir);while (false !== ($file = readdir($handle))) {	if($file != "." && $file != ".." && $file != "index.php"){		echo "<a href='".$file."'>";		echo $file;		echo "</a><br />\n";	}}?>

    but I would like to add something to it, for this I want to know how to get the file's type (as jpeg html etc...) in the php code in order to use it afterwords.

  2. how could I make a page so that I have my page showing the files in a directory.in it I hope I can do various things depending on the type of file it is, and for so I would like to know the methods to show the content of the directory and to read the file type.


  3. Try it like this, the if($_GET


    ) statement is not understood as you think it should by php:You must ask if the variable exist for the browser, this is what isset(variable) dose.

    <?phpif (isset($_GET

    )){	$page=$_GET

    ;	include ($page.php);}else{	include ('indexhome.php');}?>

    I hope I helped you.

  4. justsomeguy > Thanks a lot I was stuck on it for days... Ican't beleive I didn't see that stupid error.andersmoen > Did you try-it like this?

    <?php$con = mysql_connect("localhost","username","password");if (!$con){die('Could not connect: ' . mysql_error());}mysql_select_db("database", $con);function bbcode($tekst){// Alignment of a text:$tekst = str_replace("[center]", "<div align='center'>", $tekst);$tekst = str_replace("[/center]", "</div>", $tekst);$tekst = str_replace("[left]", "<div align='left'>", $tekst);$tekst = str_replace("[/left]", "</div>", $tekst);$tekst = str_replace("[right]", "<div align='right'>", $tekst);$tekst = str_replace("[/right]", "</div>", $tekst);//So for spaceing you will need something like this :$tekst = str_replace(array("\r\n", "\n", "\r"), '<br>', $tekst); //To create a link of the type [url=http://www.w3schools.com/]W3schools[/url]$tekst= str_replace("[url=","<a  location='blank' href='",$tekst);$tekst= str_replace("]","' >",$tekst);$tekst= str_replace("[/url]","</a>",$tekst);// If You Want to add an image too:$tekst= str_replace("[img=","<img src='",$tekst);$tekst= str_replace("]","' />",$tekst);// Underline, bold and Italic text:$tekst= str_replace("[b]","<strong>",$tekst);$tekst= str_replace("[/b]","</strong>",$tekst);$tekst= str_replace("[i]","<i>",$tekst);$tekst= str_replace("[/i]","</i>",$tekst);$tekst= str_replace("[u]","<u>",$tekst);$tekst= str_replace("[/u]","</u>",$tekst);// Set the color of a text:$tekst= str_replace("[color=","<font color='",$tekst); //closing this tag is set for [url]$tekst= str_replace("[/color]","</a>",$tekst);return $tekst;}$result = mysql_query("SELECT * FROM table ORDER BY `id` DESC LIMIT 0, 10");while($row = mysql_fetch_array($result)){echo "<div style='color: black; background-color: lightgreen; padding: 2px; border: 1px solid lightgreen;'>";echo "<div style='width: 70px; float: left;'>";echo "<a href='mailto:".$row[email]."'>".$row[navn]."</a>";echo "</div>";echo "<div style='width: 68px; float: right;'>";echo $row[dato];echo "</div>";echo "<br />";echo "<br />";$kommentar = bbcode($row[kommentar]);echo $kommentar;echo "</div>";echo "<br />";echo "<br />";}mysql_close($con);?>

    Thibo_1025

  5. I have anotther question ,I just want to make sure php dosen't switch by doing this:' -> \' and \ -> \\and I want than the text to be writen in a new file...my code to do so is this:

    function fix($texte) {$texte = str_replace('<','<',$texte);$texte = str_replace('>','>',$texte);$texte = str_replace('"','\"',$texte);$texte = str_replace('\'', '\\\'',$texte);$texte = str_replace('\\', '\\\\',$texte);$texte = str_replace('amp;','&',$texte);return $texte;}//etc...$fh = fopen("my_page.htm", 'w') or die("It didn't work!');fwrite($fh,"".fix($ftexte."");fclose($fh);//$texte is already set above but he content of it dosen't matter...

  6. the porblem is that the <center> tag is depreciated by W3C.You might as well do this:

    <html><head>	<title>your title here</title>	<style type=text/css>#centered {text-align: center;}A:link {	COLOR: #003399; TEXT-DECORATION: none}A:visited {	COLOR: #0066CC; TEXT-DECORATION: none}A:active {	COLOR: #0066CC}A:hover {	COLOR: #0066CC; TEXT-DECORATION: overline underline}BODY {	SCROLLBAR-FACE-COLOR: #ffffff; SCROLLBAR-HIGHLIGHT-COLOR: #ffffff;	SCROLLBAR-SHADOW-COLOR: #0066CC; SCROLLBAR-3DLIGHT-COLOR: #0066CC;	SCROLLBAR-ARROW-COLOR: #0066CC; SCROLLBAR-TRACK-COLOR: #ffffff;	SCROLLBAR-DARKSHADOW-COLOR: #ffffff; BACKGROUND-COLOR: #ffffff}</STYLE><script LANGUAGE="JavaScript"><!--function newImage(arg) {	if (document.images) {		rslt = new Image();		rslt.src = arg;		return rslt;	}}}// -->	</SCRIPT>	<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD><div id="centered"><table width="755" border="0" cellpadding="0" cellspacing="0">  <!--DWLayoutTable-->  <tr>	<td height="131" colspan="4" valign="top"><img src="welcome.jpg" width="750" height="115"></td>  </tr>  <tr>	<td width="9" height="2"></td>	<td width="179"></td>	<td width="31"></td>	<td width="536"></td>  </tr>  <tr>	<td height="454"> </td>	<td valign="right"><TABLE border="1" cellpadding="3" cellspacing="0" style="border-collapse: collapse; border-style: solid; border-width: 1; padding-left: 4; padding-right: 4; padding-top: 1; padding-bottom: 1" bordercolor="#999999" width="100%" id="AutoNumber4" bgcolor="#E6EDF7">		<!--DWLayoutTable-->		<TR>		  <TD width="100%" bordercolor="#E6EDF7"> <div align="center"><strong><font size="1" face="Verdana, Arial, Helvetica, sans-serif">:.			  Navigation .:</font></strong></div></td>		</TR>		<TR>		  <TD bordercolor="#E6EDF7"> <TABLE border="0" cellpadding="3" cellspacing="0">			  <!--DWLayoutTable-->			  <TR>				<TD width="163" height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="28" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="24" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="28" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="25" valign="top"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			  <TR>				<TD height="19"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">:.				  <a href="#">Link</a></font></TD>			  </TR>			</TABLE></TD>		</TR>	  </TABLE></td>	<td> </td>	<td valign="top"><table width="100%" height="429" border="1" cellpadding="3" cellspacing="0" bordercolor="#666666" bgcolor="#FFFFFF">		<!--DWLayoutTable-->		<tr>		  <td width="526" height="452"><font size="1.5" face="Verdana, Arial, Helvetica, sans-serif">This			is a free template provided by <a href="http://www.enhancedesign.tk" target="_blank">Enhancedesign</a>			there is no required link back to our site but we would appriciate			you keeping the "design by enhancedesign" at the bottom			of the page. You can edit and use this however you want. If by some			chance you want to give this template away at your site please leave			a link to enhancedesign because it is not your work your giving away			other than that enjoy :) </font></td>		</tr>	  </table></td>  </tr>  <tr>	<td height="17"></td>	<td></td>	<td></td>	<td><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">©		2003 yoursite.com design by <a href="http://www.enhancedesign.tk" target="_blank">enhancedesign</a></font></div></td>  </tr></table></div></body></html>

    But the center tag is more practicle tho...Have fun!!

  7. I want to do a OnChange function which displays text underneath the box.

    <table border="0"><tr><td><select name="name" onchange="function_one()"><option value="0"></option><option value="1">some text</option><option value="2">some text</option><option value="3">some text</option></select></td><td><sciprt language="javascript"><!-- This is where I want a text to be dispalyed considering the value chosen form the select --></script></td></tr></table>

    Now is it more clear? ( excuse me if I was not clear)

  8. yes but the problem is that if I do that it wont goall the way on the right. U see what I want to do is to have two divs of 20 an 80 percent each and there should be no space in between them.

  9. I nead to be able to sort text otomatikally using a select:

    <select name='name' onchange='text(this)'><option></option><option value="1">something</option><option value="2">something</option></select>

    what kind script should I make after this ,

    <script language='javascript'>function text(x) {var x = new Array();	x[1] = "some text";	x[2] = "some text";/* What do I put here? */}</script>

    in order to make the text show?

  10. There are two problems in your answers first of all , the idea of the "margin: 0;" dosent change anything (my classes 1 and 2 were only for the examples). and the idea of Cronthenoob should work but I would prefer to keep my percentages...

  11. Ok I'm used to the old style of setting pages(with tables) and I am getting to learn how to use the newstyle (using divs and positions).my code is this

    <div class="1">Somethings</div><div class="2">Something else</div>

    And this page is linked to an outer page of CSS in which the code should look like this.

    div.1 { height: 30px; float: left; width:20%;}div.2 { height: 30px; float: right; width: 80%;}

    my problem is tha when di this, there is a space between the cells. and I cannot get rid of it could you help me out please.

  12. I haven't been using my database the past few daysand i forgot my password ...how could i reset it or reset my compleate MySQL database.

  13. I created a form that will send information to my database but in various steps so the information send in the first step might be too long for example:I have a variable $v and i do not want it to be longer than 10 characters. my code looks like this.

    <form action='?' method='post'><input name='v' type='text' /><input type='submit' /></form><?include('function_count.php');$v = $_REQUEST['v'];count($v,$w); //Where $w would be the numbr of characters of $v.if($w > 10){die(that info is too long!)}else{/*rest of the page*/}?>

    My question is infortunately what should contain the 'funtion count()' in function_count.php.

  14. How can I make a line break appear in an external sheet (for example page.htm) using fopen as this way?

    <?phpfopen("page.htm", 'a') or die("can't open file");$txt = $one.$br.$two;$one = "line one";$br = /* what shall I put here */;$two = "line two";fwrite($fh, $txt);fclose($fh);?>

    Thx.

  15. ok this seams perfect only can I do instead

    <?php$read = "yourfilename.htm";$count = count($read);$lines = $count - "1";echo "There are $lines lines in $read.";?>

    because it is counting one line to much... so can you tell me if this is the way to fix it?

  16. Actually what I want is simpler than that (well I think). What I want to count is the number of lines in the source of the file for example

    <html><head><title></tilte></head><body><p>hello</p></body></html>

    contains 9 or 10 lines and that is the number I want to be able to show.

  17. how with a php tag show the number of coding lines that are in an other sheet?It is rather important for me to know this. If you could help me out for this it would be nice thank you

  18. is it possible to use the include tag like an iframe?What I mean is that I want to create links that will chrage a page in my include tag with something like this:

    <html><head><title></title></head><body><a onClick="$page = 1.html">1 </a><a onClick="$page = 2.html">2 </a><?php include($page); ?></body></html>

×
×
  • Create New...