
htmlstig
Members-
Posts
36 -
Joined
-
Last visited
Never
Profile Information
-
Gender
Not Telling
htmlstig's Achievements

Newbie (1/5)
0
Reputation
-
never mind iv added $title=""; before the while loop so that it resetes the variable to NULL. Many Thanks
-
cheers joel that kind of works but......... is there a way of stopping adding to the variable as if i have 2 events on one day and 1 on the next day the second day is showing all 3 events as its still adding to the variable
-
sorry if i have posted this in the wrong place, wasnt sure wether to post here or mysql. I have made a php calendar, and i am now wanting it to show if there is an event on that day and if so show it in a tool tip. the tool tip is populated by what is in the title="" of the link so i need my events to be shown in there. I have figured out how to show the event but now i am stuck on how to show all events if there is more than one one that day, how i have set it seems to only the second event, probably as the second variable overwrote the first variable. this is the code i have at the minute .............. $result = mysql_query("SELECT * FROM events WHERE day='$day_num' AND month='$fullmonth' AND year='$year'") or die(mysql_error()); $rows= mysql_num_rows($result); if ($rows !="false"){ while($rowout = mysql_fetch_array($result)) { $todayis = $rowout['day'] ."-". $rowout['month'] ."-". $rowout['year'] ."<br>"; $title= $rowout['event'] ."<br><br>";} $firstl = "<a href='' title='". $todayis . $title ."'>"; $lastl = "</a>";} else {$firstl = ""; $lastl = "";} then to display the day and links ................. <td><? echo $firstl; ?><? print $day_num; ?><? echo $lastl; ?></td> could some one be so kind and help me write it so that it displays all events? here is a link to the calendar, incase its needed. http://www.scripttesting.htmlstig.com/calendar/index.php Many thanks Carl
-
[SOLVED] sub domain availability script trouble modifying
htmlstig replied to htmlstig's topic in PHP Coding Help
not to worry iv figured it out i changed it to <form action="<?php echo $PHP_SELF; ?>" method="post"> <input name="sub" type="text">.htmlstig.com<br> <input name="" type="submit"> </form> <? $hostname = "".$_POST['sub'].".htmlstig.com"; $hosts = gethostbynamel($hostname); if (is_array($hosts)) { if (count($hosts) == 1){ echo "Sub Domain Taken"; } elseif (count($hosts) > 1){ echo "Sub Domain Available"; } } ?> thanks anyway -
[SOLVED] sub domain availability script trouble modifying
htmlstig posted a topic in PHP Coding Help
hi all i found this script on the net that will check if a domain name exists or not by checking the domains IP <? $hostname = "htmlstig.com"; $hosts = gethostbynamel($hostname); if (is_array($hosts)) { echo "Host ".$hostname." resolves to:<br><br>"; foreach ($hosts as $ip) { echo "IP: ".$ip."<br>"; } } else { echo "Host ".$hostname." is not tied to any IP."; } ?> but i want to check subdomains of htmlstig.com instead so i modified it to <form action="<?php echo $PHP_SELF; ?>" method="post"> <input name="sub" type="text">.htmlstig.com<br> <input name="" type="submit"> </form> <? $hostname = "".$_POST['sub'].".htmlstig.com"; $hosts = gethostbynamel($hostname); if (is_array($hosts)) { echo "Host ".$hostname." resolves to:<br><br>"; foreach ($hosts as $ip) { echo "IP: ".$ip."<br>"; } } elseif ($hostname == ".htmlstig.com"){ echo "Enter Sub-Domain To Check"; } else { echo "Host ".$hostname." is not tied to any IP."; } ?> but i found that if the subdomain doesnt exist instead of returning a blank ip it returns 2 ips and if it does exist it returns 1 ip. now i have figured that out i want to modify it so that if it returns 2 ips it displays a messige and if it returns 1 ip it returns a different message. I presume i would use count() but dont know how to implement it. the script so far can be seen at http://htmlstig.com/availability.php hope someone can help. Cheers **EDIT** sorry i forgot to mention that for testing purposes support.htmlstig.com is a valid subdomain -
sorted cheers when the link wasnt first or last it worked so i will have to make sure it adds a space at the begining and end of the message before it sends to the database
-
i havnt done it both at same time they are both ways i have tried it I would disagree, either way the processing is there. But storing it in it's raw form allows for any type of manipulation. That is just my 2cents though. Do it when it is coming out of the DB. Not going in. @OP, why it does not work I do not know, could be that you were double using it/using it wrong. It could also be that you put the link at the end IE: "This text link will not be processed http://www.link.com" because there is no ending space, as the regex uses the space to determine the end of a link. How to avoid this, I am not sure. You can always just append a space to the comment variable and that would solve that issue. Same if the link is at the beginning of the string. Like I said, not perfect yeah the links i tried were first and last ill try it again so that the links arnt first or last
-
for some reason it didnt work i tried it before it sends to database and when getting it from database ... this is how i had it before sending to database //get details from submitted form $name=$_POST['name']; $email=$_POST['email']; $website=$_POST['website']; $comment=$_POST['comment']; //remove any html,php,javascript e.t.c from comment $comment = trim($comment); $comment = strip_tags($comment); //convert urls to links $replace = array('~\shttp://(.+?)\s~', '~\swww\.(.+?)\s~'); $replaceWith = array(' <a href="http://$1">http://$1</a> ', ' <a href="http://www.$1">www.$1</a> '); $comment = preg_replace($replace, $replaceWith, $comment); getting from database <?php $comment = $row['comment']; $replace = array('~\shttp://(.+?)\s~', '~\swww\.(.+?)\s~'); $replaceWith = array(' <a href="http://$1">$1</a> ', ' <a href="http://$1">$1</a> '); $comment = preg_replace($replace, $replaceWith, $comment); ?> then where i wanted the comment i put <? echo $comment; ?>
-
its because you have an else followed by an else .... if you find else { ?> <a href="signmeup.php>"><img src="../images/signmeup.gif" border="0"></a> Sign up or Register to be able to contact us.<br><br> and change else to elseif ($_SESSION['Name'] ="")
-
you need to add <? before $sqlcomments = "SELECT * from buyercomments where Status=1 and BuyerID=".$_REQUEST['BuyerID']. " order by AddedDate desc"; $resultcomments= mysql_query($sqlcomments); if (@mysql_num_rows($resultcomments)!=0){
-
hi i have made a simple guestbook and before it sends the message to the database i have used trim($comment) and strip_tags($comment) so that it removes all php,html etc coding as the spammers were all using html for their links instead of just starting http:// the downside to that is that people can no longer post links so i was wondering is it possible to use php so where ever someone starts with http:// or www it converts that url to a link? if so how? cheers
-
many thanks that works great
-
hi all sorry if this is in wrong place. i am making a simple knowledge base script and i have basicly got it working how i want it im just trying to make it "look" better now. on the main kb page i have a list of all categories with a little sub title underneath them, i have them going down in a list. does anyone know how i could get it to show in 2 collums? this is the code im using at the moment <?php include "admin/config.php"; $result = mysql_query("SELECT * FROM faqcategories ORDER BY category") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { print "<tr> <td width=\"30\" valign=\"middle\"><img src=\"images/notepad.png\" width=\"23\" height=\"18\" /></td> <td valign=\"bottom\"><li class=\"category\"><strong><a href=\"sub.php?category_id=$row[id]&cat_name=$row[category]\">$row[category]</a></strong><br><span class=\"sub\">$row[sub]</span></li></td> </tr>"; } mysql_close($link); ?> the admin/config.php has the connections to mysql so they arnt needed in the code. cheers
-
have you gave the div that the image is in an auto height? that will make the div stretch to whatever is in it.
-
change the % to something smaller or larger then depending where you want it or you could change the % to a px