Jump to content

Grodo

Members
  • Posts

    74
  • Joined

  • Last visited

    Never

Everything posted by Grodo

  1. Hello Everyone, At las, another PHP issue (its just like the black plague). I am trying to practice good web coding technique and stay away from the dread iframes. (Just like the bogey monster under your bed when you were 5, but hidden in cyberspace =/ ) So here is an overview of what i am trying to do. Values are sent to the Picture Window using a function. Corresponding values trigger images to show up in the Picture Window dynamically. When the user clicks on pic3 the value is sent to the Picture window; this displays a larger image of "pic 3" is shown in the Picture Window. The variable passed corresponds to the images the user clicked on. For example the user click on pic3 a value of pic3-large.jpg is sent to the getPicture function which displays a larger image in that window. General layout of the function is written below. The question that I have is how can I capture the user clicks to send a value to the function getPicture($image)? My next question is how can I get pic3-large.jpg to show up in the pic3 table, while keeping all other parts static? The table id for the picture viewer is picture_view. I could use an iframe but I rather do this in PHP. Since the support for iframes is rather buggy; and really isn’t a cross browser solution. Here is a picture to better explain what im trying to do and below it is some code. Always Thanks, Grodo // Function to receive the string x and display the corresponding image Function getPicture($image) { // Echos html code that will set the image Echo ‘<img src=”somedirecotry/” + $image>’ } //Html table code for pic3 <table id="Table_01" width="791" border="0" cellpadding="0" cellspacing="0" bgcolor="#cc9999" style="padding-left: 7;"> <tr> <td colspan="5" id="picture_view">This is the picture viewer!</td> </tr> </table>
  2. Hello fellow PHP Freaks, Im having a hard time converting the following tree menu script to read nodes from a text file, rather then a database. This script works perfectly and is exactly what i am looking for, however it relies on query's from a MySQL database (I don't know how to set one up is the real problem). I would like to keep the feature where you can pass a parameter through the script and its expands the corresponding folder. If some one could help me convert this script to read data from a text file; or show me how to setup a MySQL database that would be awesome. Here is the demo of the script im trying to convert / learn how to operate. http://www.myiosoft.com/products/EasyFree/easyphptree/demo/ and is also available for download here: http://www.myiosoft.com/products/EasyFree/easyphptree/easyphptree.zip I have also posted the code for the .php file that is located in the zip file. <? session_start(); error_reporting(E_ALL); // error_reporting(0); // ******************************************************** // ************************ EasyPHPtree ******************* // *********************************************** MyioSoft // ************************** http://www.myiosoft.com/ // // **************************** // Edit Your Myqsl Server Data // **************************** // Server data myio.net $Myqsl["Server"]="localhost"; $Myqsl["User"]="user"; $Myqsl["Pass"]="pass"; $Myqsl["DB"]="dbase"; $Myqsl["Table"]="table"; $install=0; //In order to Create a Tree Example run once with $install=1; then return to $install=0; // // ************************************************************************************** // In order to Create a Tree Example run once with $install=1; then return to $install=0; // ************************************************************************************** $nodes=500; $groups=9; if($install==1){ $Description=""; $CreateUser=""; $CreateDate=""; $ModifyDate=""; $LastVisit=""; $PublicUse=0; $MyqslTable=$Myqsl["Table"]; @mysql_connect($Myqsl["Server"],$Myqsl["User"],$Myqsl["Pass"]) or Die ("<div align=center><font color='red'><b>Error! <br>Cannot make MySQL server connection.</b></font></div>"); mysql_select_db($Myqsl["DB"]); $sql="DROP TABLE IF EXISTS $MyqslTable"; mysql_query($sql); $sql="CREATE TABLE IF NOT EXISTS `$MyqslTable` ( `ID` bigint(20) NOT NULL auto_increment, `Name` varchar(255) NOT NULL default '', `Description` text NOT NULL, `CreateUser` bigint(20) NOT NULL default '0', `CreateDate` datetime NOT NULL default '0000-00-00 00:00:00', `ModifyDate` datetime NOT NULL default '0000-00-00 00:00:00', `LastVisit` datetime NOT NULL default '0000-00-00 00:00:00', `Parent` bigint(20) NOT NULL default '0', `PublicUse` tinyint(1) NOT NULL default '0', PRIMARY KEY (`ID`))"; mysql_query($sql); srand((double)microtime()*1000000); for ($i=1;$i<=$nodes;$i++){ if ($i>$groups){ $parcat=rand(1,100); }else{ $parcat=0; }; $sql="INSERT INTO $MyqslTable(ID,Name,Description,CreateUser,CreateDate,ModifyDate,LastVisit,Parent,PublicUse) VALUES (Null,'Easy $i','$Description','$CreateUser','$CreateDate','$ModifyDate','$LastVisit','$parcat','$PublicUse')"; mysql_query($sql); } print "Created Tree with ".$nodes." nodes in ".$groups." groups"; } // // ************ // HTML OUTPUT // ************ // register_globals = Off compatibility if ($_GET) {foreach (array_keys($_GET) as $var){$$var=strip_tags($_GET[$var]);}} ?> <HEAD><TITLE>Easy PHP Tree</TITLE></HEAD> <BODY> <table cellspacing="0" cellpadding="0" width="750" border="0"> <tr> <? // benchamrk (optional) start time $timeparts = explode(" ",microtime()); $starttime = $timeparts[1].substr($timeparts[0],1); ?> <td width="200" valign="top"><?=MakeTree($Page,$Name,$Myqsl); ?></td> <? // benchamrk (optional) end time $timeparts = explode(" ",microtime()); $endtime = $timeparts[1].substr($timeparts[0],1); $totaltime=bcsub($endtime,$starttime,6); ?> <td valign="top" align="left" width="550"> <div align="center"> <h1>Easy PHP Tree</h1><h2>This is a page for the node</h2> <h1><?=$Name; ?></h1> <h2> Tree with <?=$nodes; ?> nodes in <?=$groups; ?> groups <br>build in <?=$totaltime; ?> sec</h2> <a href="http://myiosoft.com">MyioSoft</a> </div> </td> </tr> </table> </BODY></HTML> <? // // ******************************** // EsayPHPtree functions (73 lines) // ******************************** function MakeTree(&$Page,&$Name,$Myqsl){ $MyqslTable=$Myqsl["Table"]; @mysql_connect($Myqsl["Server"],$Myqsl["User"],$Myqsl["Pass"]) or Die ("<div align=center><font color='red'><b>Error! <br>Cannot make MySQL server connection.</b></font></div>"); mysql_select_db($Myqsl["DB"]); $usage="PublicUse=0 Or PublicUse=1"; $result=mysql_query("SELECT * FROM ".$MyqslTable." WHERE ".$usage." Order by Name"); if(@mysql_num_rows($result)==0 ) {return "<div align=center>No Folders Available</div><br><br>";} while($Folder0=list($ID,$Name,$Description,$CreateUser,$CreateDate,$ModifyDate,$LastVisit,$Parent,$PublicUse)=mysql_fetch_array($result)){$table[$Parent][$ID]=$Name; $partable[$ID]=$Parent; $Folder[$ID]=$Folder0; }; unset($Folder0); $levels=TreeLevels(0,$table,0); if(!isset($Folder[$Page]["Name"])) {$Folder[$Page]["Name"]="Home";} $Name=$Folder[$Page]["Name"]; if($Page==0){ if(!isset($_SESSION["expandtree"])) {$_SESSION["expandtree"]=1;} $_SESSION["expandtree"]=-$_SESSION["expandtree"]; if($_SESSION["expandtree"]<0) { $levelexpand=1; } else { $levelexpand=100000; } $results="<img src='folderopen.gif' width='20' height='20'><span style='height: 20px; font: 11px Arial, Helvetica; font-weight:bold;'> <a href='?Page=0'>Home</a></span><br>"; $results.=TreeExpand(0,$table,$partable,$Folder,$Page,0,$levelexpand); }else{ $results="<img src='folder.gif' width=20 height=20><span style='height: 20px; font: 11px Arial, Helvetica;'> <a href='?Page=0'>Home</a></span><br>"; $ID=$Page; $results.=TreeNodes($ID,$table,$partable,$Folder,$Page,$levels); $_SESSION["expandtree"]=1; } return $results."<br><br>"; } function TreeLevels($Parent,$table,$level){ $_SESSION["levels"][$Parent]=$level; while(list($key,$val)=each($table[$Parent])){if (isset($table[$key])){TreeLevels($key,$table,$level+1); } } return $_SESSION["levels"]; } function TreeNodes($ID,$table,$partable,$Folder0,$Page,$levels){ $rez0=""; $imgfolder0="<img src='folder.gif' alt='' width='20' height='20'> <span style='height: 20px; font: 11px Arial, Helvetica; '>"; $imgfolder1="<img src='folderopen.gif' alt='' width='20' height='20'> <span style='height: 20px; font: 11px Arial, Helvetica; font-weight:bold;'>"; if(isset($table[$ID])) { $imgwidth="<img src='tr.gif' width='".(($levels[$ID]+1)*10)."' height='1' alt=''>"; $lisd=$table[$ID]; $ID0=$ID; $fiplevel=$levels[$ID]; while(list($key,$val)=each($lisd)){ if($Page==$key){ $rez0.=$imgwidth.$imgfolder1."<a href='?Page=".$Folder0[$key]["ID"]."'>".$Folder0[$key]["Name"]."</a></span><br>"; } else { $rez0.=$imgwidth.$imgfolder0."<a href='?Page=".$Folder0[$key]["ID"]."'>".$Folder0[$key]["Name"]."</a></span><br>"; }}} $res=""; while ($ID!=0) { $fip=$partable[$ID]; $fiplevel=$levels[$fip]; $fiplist=$table[$fip]; $imgwidth="<img src='tr.gif' width='".(($fiplevel+1)*10)."' height='1' alt=''>"; $rez=""; while(list($key,$val)=each($fiplist)){ if($Page==$key){ $rez.=$imgwidth.$imgfolder1."<a href='?Page=".$Folder0[$key]["ID"]."'>".$Folder0[$key]["Name"]."</a></span><br>".$rez0; } else { $rez.=$imgwidth.$imgfolder0."<a href='?Page=".$Folder0[$key]["ID"]."'>".$Folder0[$key]["Name"]."</a></span><br>"; } if($ID==$key) { $rez.=$res; $res="";} } $res.=$rez; $ID=$partable[$ID]; } return $rez; } function TreeExpand($Parent,$table,$partable,$Folder0,$Page,$level,$levelexpand){ $list=$table[$Parent]; $width=($level+1)*10; $result=''; while(list($key,$val)=each($list)){ if($level<$levelexpand) { $result.="<img src='tr.gif' width='".$width."' height='1'><img src='folder.gif'><span style='height: 20px; font: 11px Arial, Helvetica;'> <a href='?Page=".$Folder0[$key]["ID"]."'>".$Folder0[$key]["Name"]."</a></span><br>"; } if (isset($table[$key])){ $result.=TreeExpand($key,$table,$partable,$Folder0,$Page,$level+1,$levelexpand); } } return $result; } ?> Once again thank you for all your efforts, Grodo
  3. I just used css to format the images into rows of 4
  4. My new code but still no luck someone please help for ($x = $start; $x < ($start + $thumb_row); $x++ ) { $item = preg_split('/;/', rtrim($a_images[$x]), 2); $class = $x == $currentPic ? 'thumbnail_center' : 'thumbnail'; $out .= "\n<style type='text/css'>.img{opacity:1;filter:alpha(opacity=100)} a:hover img{filter:xray}</style> <a href='$path?directory=$path_to_images$auto_url&currentPic=$x' class='thumbnail'> <img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='$class'></a>"; for ($check =0; $check < $thumb_row; $check++) { if ($check=4) $out = $out + "<br>"; if ($check= $out = $out + "<br>"; }
  5. * Bump * The reason why i need it in a variable is because that variable then is passed into a templete html file
  6. I have read over through the post but im still confused on how to input that into a variable.... This is what i came up with $i = 0; if ($i == 0) echo "<tr>"; echo "Image Goes Here" if (++$i == $max_imagerow) { echo "</tr>"; $i=0; } what would be the best way to put it into one.
  7. Thanks pocobueno1388 ill look over the post and let you know how the development is comming along
  8. Hello, Once again I come to the PHP Freaks community for help. I have spent serveral weeks trying to figure out how to do this. Attached below is code for a function that outputs images in a row. However I am tring to find a way so that it would output 5 images and then drop a line and continue to do this untill all the images have been displayed. The variable which the output is stored in is named $out (towards the bottom). The variable $thumb_row is the total number of images that are allowed to be displayed. Here is an illustration of what I am trying to do the X is an image. XXXXX XXXXX XXXXX XXXXX Thank you, Grodo function my_filmstrip($thumbnail_dir, &$template, $a_images, $currentPic, $thumb_row, $path_to_images) { global $path; global $auto_url; // get size of $a_images array... $number_pics = count($a_images); // do a little error checking... if ($currentPic > $number_pics) $currentPic = 0; if ($currentPic < 0) $currentPic = 0; if ($thumb_row < 0) $thumb_row = 1; if ($thumb_row > $number_pics) $thumb_row = $number_pics; if ($currentPic >= $thumb_row) { $start = $currentPic - $thumb_row + 1; } else { $start = 0; } $out = ''; for ($x = $start; $x < ($start + $thumb_row); $x++ ) { $item = preg_split('/;/', rtrim($a_images[$x]), 2); $class = $x == $currentPic ? 'thumbnail_center' : 'thumbnail'; if ($number_pics > 4) $out .= "\n<style type='text/css'>.img{opacity:1;filter:alpha(opacity=100)}a:hover img{filter:xray}</style><a href='$path?directory=$path_to_images$auto_url&currentPic=$x' class='thumbnail'><img src='$path_to_images/$thumbnail_dir/".$item[0]."' class='$class'></a>"; } $template = str_replace("<THUMBNAIL_ROW>",$out,$template); }
  9. This code is unfinished and still in its planning stage it will not compile. Im just tring to find a method on how I can read a string and replace a number. This scripts purpose is to capture the vistors Referer ID and proccess it. If the referer ID does exist then the script adds 1 to the number at the end of the line. If the Referer ID does not exist it adds it to the database with a counter value of 1. Here is an example how the text file will be formated. yahoo.com,1 google.com,3 somepage.org,9 As of now im completely lost on how to parse the string and add 1 to the ending number. As Always Thanx Grodo <% ' ////////////////////////////////////////////////////////////////// ' // ' // ' //Based of Rafeeq's array function ' // rafeeqce@myiris.com ' // ' // ' // Example: myarray=file("c:\mysongs.list") ' // ' ////////////////////////////////////////////////////////////////// Function File(filename) Dim fso,ts,data Const ForReading = 1 Set fso = CreateObject("Scripting.FileSystemObject") Set ts = fso.OpenTextFile(filename, ForReading) reDim data(0) i=-1 While not ts.AtEndOfStream i=i+1 Redim Preserve data(i) data(i)=ts.ReadLine Wend ts.Close File=data End Function %> <% 'Read Data from the file data=File("refer.txt") 'Get the size of the Array iArraySize = (UBound(data) - LBound(data)) + 1 'Get the reffering URL RefURL = Request.ServerVariables("HTTP_REFERER") 'Check if the person was referred by a page or not (e.g. bookmark) IF Len(RefURL) = 0 THEN 'The person was not referred by a page InsertIntoID = 1 ELSE 'The person was referrd by a page 'Check if the URL already is in the database 'if it is get the URL's value 'if not set InsertIntoID = 0 for (i = 0; i < iArraySize + 1 ; i++) { if data(i) = RefURL then datalocation = i // This is just for testing response.write("Exists on line" & i ) ELSE InsertIntoID = 0 END IF } End if 'If InsertIntoID = 0 then the URL is a new URL IF InsertIntoID = 0 THEN 'Insert new url with count = 1 ELSE 'Add 1 to the counter END IF %>
  10. with java use my code <script language="javascript" type="text/javascript"> <!-- function popit(url) { newwindow=window.open(url,'name','height=350,width=350'); if (window.focus) {newwindow.focus()} return false; } // --> </script> <a href="javascript:popit('http://www.domain.com/yay/woo/pop.html')">POP IT</a>
  11. Due to my ISP provider being lame they intercept all error messages ;-x and tell me to call customer support. Any ways I do not know what wrong here and why does this not work. <html> <head> <title>Newsletter System</title> <% qstr = Request.QueryString("unsubscribe") If qstr = "" then %> <html> <body> Some Html Code </body> </html> <% else Set unsubscribe = Server.CreateObject("Persits.MailSender") unsubscribe.Host = "mail.xxx.com" unsubscribe.From = qstr unsubscribe.AddAddress "info@xxx.com", unsubscribe.Subject = "UNSUBSCRIBE" unsubscribe.Body = "" unsubscribe.Send response.write ("Email" & qstr & " has been removed from the database") end if %>
  12. Thank You! Kind of new to this Now I can go on and expand my knowledge!
  13. index.php?section4 Just wondering what the term for the ?section4 was. Like the same is it a query? I just want to read more into this
  14. premiso always picking on me Eh I need to get better at this stuff
  15. You forgot to escape your quotes here try this $h1 = 4; $h2 = 5; if ($h1 == 4){$color1="green";} if ($h2 == 5){$color2="yellow";} print '<table><tr>'; print '<td bgcolor="'.$color1.'">$h1</td>'; print '<td bgcolor="'.$color2.'">$h2</td>'; print '</tr></table>';
  16. problem with iframes is that most people have them disabled if anything ill just do a timed java redirect
  17. Well I found out it is possible I just cant get the code to work with my service. ini_set (user_agent, "Your Name Here"); ini_set (default_socket_timeout, "3"); error_reporting(0); $theurl="http://www.xxxx.com/promo.asp?8329"; $filestring=file_get_contents("$theurl") ; $filestring = str_replace("../images/", "www.xxxx.com/images/", $filestring); echo "$filestring";
  18. HMMMM =/ lOOKS like im goign to have to Java redirect then how ever im gonna try to figure this out
  19. hmmmm Ill give it a try see what i can do... The fopen urls will not work because i got shared
  20. Hello! Hello Again! Im tring to include an .asp page into a .php page how ever it is not working. include("http://www.xxxx.com/index.asp"); After some googleing research I have found out that there were some problems with this. I have been unsuccessful on finding a redemy for this curse. I have read some people using data scraping methods to extract the data; but they never left any code behind. If any one could point me in the right direction that would be great! This is the error I keep getting Warning: main() [function.main]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /home/xx/public_html/phpharvest.php on line 198 Warning: main(http://www.xxx.com/SearchResults.asp?Cat=377) [function.main]: failed to open stream: Success in /home/xx/public_html/phpharvest.php on line 198 Warning: main() [function.include]: Failed opening 'http://www.xx.com/SearchResults.asp?Cat=377' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/xx/public_html/phpharvest.php on line 198 Thank You Grodo
  21. Now all I got is an error in my Java code hahahha but this not what this section is for so Topic Solved! Thank YOu so much those ; are tricky they are like ninjas with their stealth secrets!
  22. Hello Again! I guess the PHP and Javascript are not playing nicely =( I recieve the error Parse error: parse error, unexpected T_ECHO in phpharvest.php on line 205 for some reason it does not like the echo. Any help will be greatly appreciated! Thank You Grodo $jpop = "<script language=javascript type=text/javascript> function successlaunch(url) { newwindow=window.open(url,name,height=800,width=500,toolbar=no,titlebar=no,statusbar=no,locationbar=no,menubar=no,scrollbars=1); if (window.focus) {newwindow.focus()} javascript:successlaunch(passed.html); </script>" echo($jpop);
  23. Thanx clearstatcache and Dead Evil! Everything works!
  24. make an few if statments if ($filetype==.mov) $directory='movies'; if ($filetype==.jpg) $directory='pictures'; if ($filetype==.wav) $directory='sounds';
  25. What are you tring to make the script do?
×
×
  • 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.