
ted_chou12
Members-
Posts
1,488 -
Joined
-
Last visited
Everything posted by ted_chou12
-
here: [code] <?php //email right format, valid? $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*"."@[a-z0-9-]+(\.[a-z0-9-]{1,})*"."\.([a-z]{2,}){1}$"; if(!eregi($regex,$email)){echo"(Invalid E-mail Address!)<br>"; $invalid = TRUE;} ?> [/code]
-
what i want to do is to pass a string from one page to another (just like my subject title) what it means is this: first php page: <?php $string = "information" ?> <a href="page2.php">click here</a> and then when the visitor clicks the hyperlink, he/she is transferred to the second page, however, i also want the string to be transferred as well so you can echo it on the second page. <?php echo $string ?> However, I dont wish to write nor create any text files, is there any suggestions? Thankyou :D
-
yeah, i quite like this feature, so the experts save the time in clicking for the thanks replies... :D
-
list directory,(list in pages)[MILLION CENTS QUESTION]
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
timmah, i dont quite understand, can you just explain it briefly to be please? -
list directory,(list in pages)[MILLION CENTS QUESTION]
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
thanks, ill let you know if i have trouble combining them. -
below is the list directory code, but how should i list them in pages? for example, i want to have ten text files listed on one page, and the next ten on the second page, tell me if it is going to be too complicated, then i will forget about it thankyou :D Edited: oh yeah, if possible, is it possible to list the file in terms of their last modification time, eg. latest goes first thanks again [code] <table bgcolor="#FAEBD7" width="100%"> <tr bgcolor="#D2B48C" align=center width="100%"><td align=center><font face="arial" size=4><b>ID</b></td><td align=center width=30><font face="arial" size=4><b>Thread Con.</b></td><td align=center width="40%"><font face="arial" size=4><b>Thread Name</b></font></td><td align=center width=30><font face="arial" size=4><b>Views</b></font></td><td align=center width=30><font face="arial" size=4><b>Replies</b></font></td><td align=center width="20%"><font face="arial" size=4><b>Thread Strarted By</b></font></td><td align=center width="30%"><font face="arial" size=4><b>Thread Started On</b></font></td><td align=center width="20%"><font face="arial" size=4><b>Last Commented</b></font></td></tr> <?php $namearray = array("forum"); // File names you want to exclude $extarray = array("xml","jpg","php","css","bmp","png","html"); //extension you want to exclude $files = array(); if ($handle = opendir(".")) { while (false !== ($file = readdir($handle))) { if($file != "." && $file != ".."){ if (filetype($file) == "file" || filetype($file) == "dir"){ $filearray = explode(".", $file); $files[$filearray[0]] = $filearray[1]; } } } closedir($handle); } foreach($files as $name => $ext){ if(in_array($name, $namearray, false) || in_array($ext, $extarray, false)){ } else { foreach(@file("$name.txt") as $v){list($topic,$category,$number,$datetime,$name,$username,$message,$threadicon) = explode("#",$v);} $counteraa = file_get_contents("topic$number-counter.php"); if (!file_exists("topic$number-counter.php")){$counteraa = 0;} $repliesaa = file_get_contents("topic$number-replies.php"); if (!file_exists("topic$number-replies.php")){$repliesaa = 0;} $lastposteraa = file_get_contents("topic$number-lastposter.php"); if (!file_exists("topic$number-lastposter.php")){$lastposteraa = $name;} echo "<tr><td valign=center align=center bgcolor=\"#FFDEAD\">$number</td><td valign=center align=center><img src=\"../smilies/$threadicon.gif\"></td><td align=left valign=center bgcolor=\"#FFDEAD\"><a href=\"../viewtopic.php?id=$category/topic$number\"><font color=\"#A0522D\"><b>$topic</b></font></a></td><td align=center>$counteraa</td><td align=center>$repliesaa</td><td align=center bgcolor=\"#FFDEAD\">$name</td><td align=center>$datetime</td><td align=center bgcolor=\"#FFDEAD\">$lastposteraa</td></tr>"."\n";} } ?> </table> [/code]
-
[SOLVED] Capitalizing first word of a string
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
what if my string is: directory($_SERVER['PHP_SELF']) do I have to set anything or put quotation marks? because it doesn't seem to work like this: $string = echo "directory($_SERVER['PHP_SELF'])"; -
[SOLVED] Capitalizing first word of a string
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
last thread on the left? I cant seem to find it. -
[SOLVED] Capitalizing first word of a string
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
many thanks -
for example: the original string is "test" what i want it to turn to is "Test" is there any easy way to do this? Thankyou
-
[SOLVED] problem with form (radio buttons) and php
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
opps, i found out why... because i didn't put the radio buttons inside the form tags... NOBODY LAUGHS :-[ -
[SOLVED] problem with form (radio buttons) and php
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
Sorry, ive tried posting the whole page up, but it doesn't seem to work, I think is too long. Can you work with this alone? My apologies... -
I cant seem to get the value of the radio buttons in the form into the php string, here is what ive got: <input type="radio" name="threadicon" value="1"><img src="tests/1.gif"> <input type="radio" name="threadicon" value="2"><img src="tests/2.gif"> <input type="radio" name="threadicon" value="3"><img src="tests/3.gif"> and the php if(isset($_POST['Submit'])){ $threadicon = $_POST['threadicon'];} is there any error?
-
nope , this one is not the same as the one yesterday, I want to achieve the name of the directory this time, because i want to show it on my navigator. The other one was problem with listing the files in the folder.
-
can anyone give me suggestions on this please?
-
as for me, $_SERVER['PHP_SELF'] would give you /forum/folder/test.php and dirname($_SERVER['PHP_SELF']) would give you /forum/folder is there any possibility if i want the folder part of the string and nothing else? Thanks
-
1 + 2 = 3 (add up of infinite text counter files)
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
:D, haha, yeah, i was kind of exaggerting, thankyou for solving my problem by the way! -
1 + 2 = 3 (add up of infinite text counter files)
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
i have infinite number of files in a folder, and each of those txt files has a number, what i want is add all of those numbers together, so far, this is what ive got $namearray = array("forum"); // File names you want to exclude $extarray = array("xml","jpg","php","css","bmp","png","html"); //extension you want to exclude $files = array(); if ($handle = opendir(".")) { while (false !== ($file = readdir($handle))) { if($file != "." && $file != ".."){ if (filetype($file) == "file" || filetype($file) == "dir"){ $filearray = explode(".", $file); $files[$filearray[0]] = $filearray[1]; } } } closedir($handle); } foreach($files as $name => $ext){ if(in_array($name, $namearray, false) || in_array($ext, $extarray, false)){ } else { foreach(@file("homework/$name.txt") as $v){list($topic,$category,$number,$datetime,$name,$username,$message) = explode("#",$v);} $repliesaa = file_get_contents("topic$number-replies.php")."\n";} it lists out the txt files but i am having trouble adding the numbers up, can anyone give me some ideas -
1 + 2 = 3 (add up of infinite text counter files)
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
but thanks for everyone's active participation!! :D -
1 + 2 = 3 (add up of infinite text counter files)
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
opps :-[ sorry... -
Here, i have to string: $figure_1 = 1 $figure_2 = 2 does php work with simple + symbol? eg. $figure_1 + $figure_2 == 3 does this work?
-
thanks for sharing! :)
-
difference between ereg_replace() and str_replace()
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
thankyou!!! :D -
problem with listing root directories (UN~SOLVED)
ted_chou12 replied to ted_chou12's topic in PHP Coding Help
thankyou, i will have a try on it :)