-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
what about create an Dynamic Image to show the results <?php $row['votes'] = 0; //mysql stuff returns $row['votes'] $im = imagecreatetruecolor(150, 30); $bgc = imagecolorallocate($im, 255, 255, 255); $tc = imagecolorallocate($im, 0, 0, 0); imagefilledrectangle($im, 0, 0, 150, 30, $bgc); imagestring($im, 1, 5, 5, "the votes are .{$row['votes']}.. ", $tc); header("Content-Type: image/jpeg"); imagejpeg($im); ?> <img src="www.mysite.com/votes.php"> of course your need to clean it up...
-
welcome does the topic solved button exist anymore ? woohoo my 4,500 post!
-
i assume you mean output from an SQL database and send the results via email.. if so read up on mail() and mysql
-
very true MD5 does have collisions but for a collision between two integers your need a massive amount of records.. But what your saying is a very valid point
-
should be holiday_hotel LIKE '%".$keyword."%' note the quotes $holiday_result = mysql_query("SELECT * FROM holidays WHERE holiday_id='$keyword' OR holiday_hotel LIKE '%".$keyword."%' OR property_area='$keyword' OR property_city='$keyword' OR property_postcode='$keyword' OR property_price='$keyword' OR property_status='$keyword'",$db);
-
Can you post the code you have.. as it should start http://
-
seams to work on my pc.. when you hover over a link.. whats the path?
-
infact their was but the forum converted it to [/url] as it wasn't posted in a code tag, the reason you can't open the file is because you need link to them via the web link not the file link i guess you could do this <?php function dirList ($directory, $startpath) { $results = array(); $handler = opendir($directory); while ($file = readdir($handler)) { if ($file != '.' && $file != '..') { $nextDir = $directory."/".$file; $results[] = preg_replace('%^'.preg_quote($startpath).'/%', '', $nextDir); if(is_dir($nextDir)) { $results = $results + dirList($nextDir, $startpath); } } } closedir($handler); return $results; } $results=$_POST['results']; $dir = dirname(__FILE__);//"c:\php"; $files = dirList($dir, $dir); foreach ($files as $file) { echo "<a href=\"$file\" title=\"$file\">$file</a><br>"; } ?>
-
User content from sql table - igoogle type thing
MadTechie replied to Alexhoward's topic in PHP Coding Help
also please use code tags (the # button) -
welcome Regular expressions can be a pain but also fun and VERY useful.. but becareful dont forget about str_replace its faster for simple replacments
-
you need lazyness on the color and strike "/\[(color|Color|COLOR)=\"(.*?)\"\](.*?)/","/\[\/(color|Color|COLOR)\]/", and "/\[(strike|Strike|STRIKE)\](.*?)/","/\[\/(strike|Strike|STRIKE)\]/", final code <?php //require_once "class.bbcode.php"; $bb =new BBcode; $bb->bbSettings(array("bbenabled" =>0,"allowflash" =>true)); $s ="[color=\"red\"][size=\"16\"]Hey[/size] [strike]um[/strike][/color] [b]Name[/b],\n\n"; $s .="<br>How are [u][b][i]you[/i][/b][/u]; \n\n"; print $bb->bbDisplay($s); class BBcode { function bbSettings($array =false){ $this->bbCodeEnabled =$array['bbenabled']; $this->bbFlashEnabled =$array['allowflash']; $this->bbHyperlinkEnabled =$array['allowlinks']; $this->bbImagesEnabled =$array['allowimages']; } function bbDisplay($str){ $bulktext =explode(" ",$str); foreach($bulktext as $word) $phrase[] =preg_replace($this->BBcode,$this->BBstyle,$word); return implode(" ",$phrase); } var $BBcode =array( "/\[[bb]\](.*)/","/\[\/[bb]\]/", "/\[[uu]\](.*)/","/\[\/[uu]\]/", "/\[[ii]\](.*)/","/\[\/[ii]\]/", "/\[(strike|Strike|STRIKE)\](.*?)/","/\[\/(strike|Strike|STRIKE)\]/", "/\[(color|Color|COLOR)=\"(.*?)\"\](.*?)/","/\[\/(color|Color|COLOR)\]/", "/\[(size|Size|SIZE)=\"(\d+)\"\](.*?)/","/\[\/(size|Size|SIZE)\]/", ); var $BBstyle =array( "<span style='font-weight:bold;'>\\1","</span>", "<span style='text-decoration:underline;'>\\1","</span>", "<span style='font-style:italic;'>\\1","</span>", "<span style='text-decoration:line-through;'>\\2","</span>", "<span style='color:\\2;'>\\3","</span>", "<span style='font-size:\\2pt;'>\\3","</span>" ); var $BBReference =array("b","u","i","strike","color","colour"); } ?> infact you should use it on BUI as well
-
or even <?php if (preg_match('/\[size="(\d+)"\](.*?)\[\\\\size\]/', $data, $regs)) { $vars = $regs[0]; } print_r($vars); ?>
-
do mean like this ? <?php $data = '[size="12"]this is my test[\size]'; $newdata = preg_replace('/\[size="(\d+)"\](.*?)\[\\\\size\]/', '<span style=\'size:"\1";\'>\2</span>', $data); echo $newdata; ?>
-
Use Like $desc = $_POST['Desc']; "SELECT * WHERE Desc LIKE %".$desc."%";
-
what are you trying to do? what you stuck on? why would you group them ?
-
well the only thing i can think of would be a cookie.. you can't grab a file from te client PC.. that would be a security risk for all users on the web.. you could have them upload a file..
-
to use the OR try this '/\[(size|Size|SIZE)=50\]/' Oh and FYI this post should of been posted here
-
try this $ID = $_GET["ID"]; $UserResult = mysql_query("SELECT * FROM tblUsers WHERE md5(UserID)='".$ID."' ")or die (mysql_error()); you need the qutoes as your dealing with a string
-
whats that surpose to do!!! also use the parameter /i to ignore case instead of trying to cover case versions (on color) heres a simple BB to html code snip your need to remove the extra - as if i didn't add them it will look messedup on this forum <?php // A simple FAST parser to convert BBCode to HTML // Trade-in more restrictive grammar for speed and simplicty // // Syntax Sample: // -------------- // [-img]http://phpfreaks.com/images/deadrats.gif[-/img] // [-url="http://phpfreaks.com"]phpfreaks[-/url] // [-mail="webmasterphpfreaks.com"]Webmaster[-/mail] // [-size="25"]HUGE[-/size] // [-color="red"]RED[-/color] // [-b]bold[-/b] // [-i]italic[-/i] // [-u]underline[-/u] // [-list][-*]item[-*]item[-*]item[-/list] // [-code]value="123";[-/code] // [-quote]John said yadda yadda yadda[-/quote] // // Usage: // ------ // <?php include 'bb2html.php'; ?> // <?php $htmltext = bb2html($bbtext); ?> function bb2html($text) { $bbcode = array("-<", "->", "[-list]", "[-*]", "[-/list]", "[-img]", "[-/img]", "[-b]", "[-/b]", "[-u]", "[-/u]", "[-i]", "[-/i]", '[-color="', "[-/color]", "[-size=\"", "[-/size]", '[-url="', "[-/url]", "[-mail=\"", "[-/mail]", "[-code]", "[-/code]", "[-quote]", "[-/quote]", '"]'); $htmlcode = array("<", ">", "<ul>", "<li>", "</ul>", "<img src=\"", "\">", "<b>", "</b>", "<u>", "</u>", "<i>", "</i>", "<span style=\"color:", "</span>", "<span style=\"font-size:", "</span>", '<a href="', "</a>", "<a href=\"mailto:", "</a>", "<code>", "</code>", "<table width=100% bgcolor=lightgray><tr><td bgcolor=white>", "</td></tr></table>", '">'); $newtext = str_replace($bbcode, $htmlcode, $text); $newtext = nl2br($newtext);//second pass return $newtext; } ?>
-
think of MD5 as one-way you can't undo it, its mainly used for passwords, for example just say md5("helloworld") = "ABCDE123458" Now i can't convert ABCDE123458 back to helloworld but i can re-create ABCDE123458 using helloworld now in your example i assume you have an ID in the database ie 1,2,3,4 etc and your passing the ID via get but hashing it first.. now what you can do is MD5 the field ID and then compare ie "SELECT * from `table` where MD5(ID) = {$_GET['ID']};"; so instead of un-MD5-ing your MD5 your existing results to match! make sense ?
-
change $dir = "http://www.adworld-online.com/images/banners/"; to $dir = dirname(__FILE__)."images/banners/"; assuming the script is on the top level
-
i would do this in CSS (google CSS menus) you could then build the CSS via php pulling the items from a sql table
-
try this <?php if($session->logged_in) { $sub = "submit.php"; }else{ $sub = "submit2.php"; } $types = array("jpg","gif","png","swf"); $dir = "http://www.adworld/online.com/images/banners/"; foreach($types as $type) { if(file_exists($dir.$username ."_banner.".$type)) { echo "<a href=\"http://www.adworld-online.com/$sub?user=$username\"><img src=\"http://www.adworld-online.com/images/banners/". $username ."_banner.".$type."\" width=\"600\" height=\"110\"><br />"; } } ?>
-
try something like this <?php $Sql = "SELECT * FROM `prod_listing` WHERE Product_ID = '$id'"; $picresult = mysql_query($Sql); ?> <table width="30%" border="0" cellpadding="1" cellspacing="0" bordercolor="#FFFFFF"> <?php $t = 4; $c = 4; while ($row=mysql_fetch_array($picresult)) { ?> <tr> <td height="32"><img name="" src="<?php echo $row["Product_picurl"];?>" alt=""></td> <?php if($c == 0) { $c=$t; echo "<\tr><tr>"; } $c--; } //end of loop ?> </tr> </table>
-
Okay.. just had a thought while making my coffee.. do you mean you wish to append the field descr to the selection thats submitted so the post will be for example "8 x 4 Colour" (thats all i can think of) if so try <?php echo $row['descr'];?> <select name="type" class="formnames" id="type" style="color:#999999"> <option selected="selected" value="<?php echo $row['descr'];?> Colour">Colour</option> <option value="<?php echo $row['descr'];?> B&W">B & W</option> <option value="<?php echo $row['descr'];?> Sepia">Sepia</option> </select> <?php echo $symbol ;?><?php echo $row['price'];?>