Jump to content

stefpretty

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Contact Methods

  • MSN
    stefpretty@hotmail.com
  • Website URL
    http://www.thebandcentral.com

Profile Information

  • Gender
    Not Telling

stefpretty's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I worked it out it's all good it was simply the order in which i had placed the div tag of the bottom of the page, the php include was thinking that that was part of it, and was messing up the alignments.... got it now though!
  2. Hi there guys, i have almost done the main page of my new site, i wish i was a coding genious! hence why im here asking you guys!. basically the problem is, on the main page i added a news manager, but its displaying too big than it needs to be, it's only needing to be 844px across to fit in the css template i made and also it shouldnt be that tall, also notice when you scroll down in the box it has the made by bit which used to display at the bottom of the site outside the box, http://www.prettyklicks.com i dont know if you can display the files from the directory there? if i need to alter permissions let me know the root is http://prettyklicks.teenxpats.com cheers guys <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <LINK REL=StyleSheet HREF="styles.css" TYPE="text/css" media="screen"> <script type="text/javascript" src="ufo.js"></script> <title>pretty|klicks</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <script language="javascript"> function swapImage(imgN,imgU){ if(document.images)document.images[imgN].src=imgU; } </script> </head> <body> <div id="main"> <div class="Table_01"> <div class="TOP1"> <img src="images/TOP1.gif" width="1000" height="10" alt=""> </div> <div class="TOP2"> <img src="images/TOP2.gif" width="474" height="13" alt=""> </div> <div class="PRODUCTS"> <a href="http://www.prettyklicks.com/products/" onmouseover="swapImage( 'products' , 'images/PRODUCTSON.gif' )" onmouseout="swapImage( 'products' , 'images/PRODUCTS.gif' )"> <img src="images/PRODUCTS.gif" border="none" name="products"> </a> </div> <div class="TOP5"> <img src="images/TOP5.gif" width="439" height="16" alt=""> </div> <div class="TOPMENU-3"> <img src="images/TOPMENU-3.gif" width="328" height="35" alt=""> </div> <div class="HOME"> <a href="http://www.prettyklicks.com" onmouseover="swapImage( 'home' , 'images/homeover.gif' )" onmouseout="swapImage( 'home' , 'images/HOME.gif' )"> <img src="images/HOME.gif" border="none" name="home"> </a> </div> <div class="TOP4"> <img src="images/TOP4.gif" width="84" height="35" alt=""> </div> <div class="TOP6"> <img src="images/TOP6.gif" width="149" height="32" alt=""> </div> <div class="GALLERY"> <a href="http://www.prettyklicks.dphoto.com" onmouseover="swapImage( 'gallery' , 'images/GALLERYON.gif' )" onmouseout="swapImage( 'gallery' , 'images/GALLERY.gif' )"> <img src="images/GALLERY.gif" border="none" name="gallery"> </a></div> <div class="TOP7"> <img src="images/TOP7.gif" width="228" height="32" alt=""> </div> <div class="BELOW-PRODUCTS"> <img src="images/BELOW-PRODUCTS.gif" width="87" height="25" alt=""> </div> <div class="BELOW-HOME"> <img src="images/BELOW-HOME.gif" width="62" height="12" alt=""> </div> <div class="BELOW-GALLERY"> <img src="images/BELOW-GALLERY.gif" width="62" height="6" alt=""> </div> <div class="LEFT-MARGIN"> <img src="images/LEFT-MARGIN.gif" width="73" height="742" alt=""> </div> <div class="title-bar"> <img src="images/title-bar.gif" width="844" height="96" alt=""> </div> <div class="RIGHT-TOP"> <img src="images/RIGHT-TOP.gif" width="83" height="139" alt=""> </div> <div class="BAR-1"> <img src="images/BAR-1.gif" width="844" height="9" alt=""> </div> <div class="FADER"> <embed src="imagerotator.swf" width="844" height="135" align="middle" allowscriptaccess="always" allowfullscreen="false" flashvars="file=imagerotator.xml&transition=lines&shownavigation=false&showicons=false" /> </div> <div class="RIGHT1"> <img src="images/RIGHT1.gif" width="34" height="603" alt=""> </div> <div class="CONTACT"> <a href="http://www.prettyklicks.com/contact" onmouseover="swapImage( 'contact' , 'images/CONTACTON.gif' )" onmouseout="swapImage( 'contact' , 'images/CONTACT.gif' )"> <img src="images/CONTACT.gif" border="none" name="contact"> </a></div> <div class="RIGHT-2"> <img src="images/RIGHT-2.gif" width="24" height="603" alt=""> </div> <div class="RIGHT-3"> <img src="images/RIGHT-3.gif" width="25" height="530" alt=""> </div> <div class="BAR-2"> <img src="images/BAR-2.gif" width="844" height="9" alt=""> </div> <div class="ABOUT-US-TITLE"> <img src="images/ABOUT-US-TITLE.gif" width="844" height="45" alt=""> </div> <div class="ABOUT-US-CONTENT"> <div class="about"> <div align="right"><br> <img src="images/DSC_1.jpg" alt="img" width="300" height="200" border="5" align="right" hspace="10"></img> </div> <p align="left"> pretty|klicks is a photography service which covers your modern stylish photo needs from the moment they're shot in relaxed optimal conditions to the moment they're printed and recieved in your hands. pretty|klicks has come into service due to popular demand. </p> <p align="left">Started as a hobby, but due to many compliments and popularity the hobby has become pretty|klicks</p> <p align="left">Photography that doesnt just tell any story, photography that tells your story. Not just any photo a pretty|klicks photo.</p> <br><br><br><br> <div align="left"><br><img src="images/DSC_2.jpg" hspace="10" border="5" align="left"> </div> <div align="right"><br><br> <p align="left"> Tailor made photography for your needs. It's all about you. Location, weather, objects, people, setting the scene. You choose what youy want. simple. No hassel. Just what you see in your head but better.</p> <p align="left"> Want to see whats on offer product whise? Head onto to the 'products' page by clicking <a href="http://www.prettyklicks.com/products">here</a>.</p> </div> </div> <p><br> </p> <p> </p> <p> </p> </div> <div class="BAR3"> <img src="images/BAR3.gif" width="844" height="9" alt=""> </div> <div class="NEWS-TITLE"> <img src="images/NEWS-TITLE.gif" width="844" height="40" alt=""> </div> <div class="NEWS-CONTENT"> <div class="php"> <? include("mynews.inc.php");?> </div> </div> </div> <br> <div class="bottom" align='center'> <p aligh='center'>Website owned and created by Stefan Pretty, pretty|klicks 2008-2009</p> </div> <br> </div> </body> </html> AND the included php file: <? $dir=substr(__FILE__, 0, strrpos(__FILE__, "/")+1); // load config include_once($dir."config.inc.php"); include_once($dir."FCKeditor/fckeditor.php") ; $dat=$dir."data.dat"; $templatefile=$dir."templates.inc.php"; $log=$dir."log.dat.php"; $pathtowysiwyg=$pathtoscript."wysiwyg/"; setlocale(LC_TIME, $datelang); $me= $_SERVER['PHP_SELF']; $empty=false; $now=time(); $version="1.6.4"; if (!isset($_GET['hash']) || $_GET['hash']=="") { srand($now); for ($i=0; $i<16 ; $i++) $secret.=chr(rand(60, 127)); $secret=md5($secret); $hash=md5($_SERVER['HTTP_USER_AGENT'].$now.$secret); }else $hash= $_GET['hash']; $getvars="?hash=$hash"; if (isset($_REQUEST['do'])) $do=$_REQUEST['do']; if (isset($_REQUEST['id'])) $id=$_REQUEST['id']; if (isset($_REQUEST['action'])) $action=$_REQUEST['action']; if (isset($_REQUEST['title'])) $title=$_REQUEST['title']; if (isset($_REQUEST['name'])) $name=$_REQUEST['name']; if (isset($_REQUEST['pwd'])) $pwd=$_REQUEST['pwd']; if (isset($_REQUEST['email'])) $email=$_REQUEST['email']; if (isset($_REQUEST['www'])) $www=$_REQUEST['www']; if (isset($_REQUEST['story'])) $story=$_REQUEST['story']; if (isset($_REQUEST['teaser'])) $teaser=$_REQUEST['teaser']; if (isset($_REQUEST['time'])) $time=$_REQUEST['time']; if (isset($_REQUEST['date'])) $date=$_REQUEST['date']; // ************************** functions *********************** // ************************************************************ function getkey($index, $stuff){ foreach ($stuff->data as $key => $item){ if ($item['id']==$index){ $ret=$key; break; } } return $ret; } function validemail($addr){ return eregi("^[a-z0-9]+([_.-][a-z0-9]+)*@([a-z0-9]+([.-][a-z0-9]+)*)+\\.[a-z]{2,4}$", $addr); } function jsRedirect($url){ echo "<script language=\"Javascript\" type=\"text/javascript\">\n<!--\n location.href='$url' \n//-->\n</script>"; } function clearoldadmins() { global $log, $now, $adminexpire; include($log); if (count($admins)>0){ $i=0; $fp=fopen($log, "w"); fputs($fp, "<?\n"); foreach ($admins as $line){ if ($now-$line['time']<$adminexpire) fputs($fp, "\$admins[$i]['time']=".$line[time]."; \$admins[$i]['hash']='".$line['hash']."';\n"); $i++; } fputs($fp, "?>"); fclose($fp); } } function saveposts($stuff){ global $dat; $fp=fopen($dat, "w"); foreach ($stuff as $item){ $line=$item['id']."|".$item['time']."|".$item['mode']."|".$item['title']."|".$item['story']."|".$item['teaser']."\n"; fputs($fp, $line); } fclose($fp); } function isloggedin() { global $log, $now, $adminexpire; include($log); $logged=false; if (count($admins)>0){ foreach ($admins as $line){ if ($line['hash']==md5($_GET['hash'])) $logged=true; } } return $logged; } function showmenu() { global $txtsign, $txtview, $txtadmin, $me, $getvars; echo "<div class='smtxt' style='margin-bottom:8px;'><a href='$me$getvars&do=add'>$txtsign</a> :: <a href='$me$getvars&do=view'>$txtview</a></div>"; } function emailencoder ($str){ for ($i=0; $i< strlen($str); $i++){ $n=rand(0,10); if ($n>5) $foo.="&#".ord($str[$i]).";"; else $foo.="&#x".sprintf("%X", ord($str[$i])).";"; } return $foo; } function getTemplate($tpl, $html){ $match="/<\!\-\-$tpl\-\->(.*?)<\!\-\-$tpl\-\->/s"; preg_match($match, $html, $tmp); return $tmp[1]; } if (!function_exists('str_ireplace')) { function str_ireplace ($search, $replace, $subject, $count = null) { if (is_string($search) && is_array($replace)) { trigger_error('Array to string conversion', E_USER_NOTICE); $replace = (string) $replace; } if (!is_array($search)) { $search = array ($search); } if (!is_array($replace)) { $replace_string = $replace; $replace = array (); for ($i = 0, $c = count($search); $i < $c; $i++) { $replace[$i] = $replace_string; } } $length_replace = count($replace); $length_search = count($search); if ($length_replace < $length_search) { for ($i = $length_replace; $i < $length_search; $i++) { $replace[$i] = ''; } } $was_array = false; if (!is_array($subject)) { $was_array = true; $subject = array ($subject); } $count = 0; foreach ($subject as $subject_key => $subject_value) { foreach ($search as $search_key => $search_value) { $segments = explode(strtolower($search_value), strtolower($subject_value)); $count += count($segments) - 1; $pos = 0; foreach ($segments as $segment_key => $segment_value) { $segments[$segment_key] = substr($subject_value, $pos, strlen($segment_value)); $pos += strlen($segment_value) + strlen($search_value); } $subject_value = implode($replace[$search_key], $segments); } $result[$subject_key] = $subject_value; } if ($was_array === true) { return $result[0]; } return $result; } } function paging( $pages, $pagevar="page", $ppv=10, $first ="<a href='{url}'>«««</a> ", $firsts ="««&laquo ", $prev ="<a href='{url}'>««</a> ", $prevs ="«« ", $num ="<a href='{url}'>{page}</a>", $nums ="{page}", $sep =" | ", $more ="[<a href='{url}'>...</a>]", $next =" <a href='{url}'>»»</a>", $nexts =" »»", $last =" <a href='{url}'>»»»</a>", $lasts =" »»»"){ // get URI parameters $getvars=$_SERVER['PHP_SELF']."?"; foreach ($_GET as $key => $val){ if ($key!=$pagevar){ if (isset($val) && $val!=""){ $getvars.="$key=$val&"; }else{ $getvars.="$key&"; } } } $page=(is_numeric($_GET[$pagevar])) ? $_GET[$pagevar] : 1; $page=($page>$pages) ? $pages : $page; $prevpage=($page>1) ? $page-1 : 1; $nextpage=($page < $pages) ? $page+1 : $pages; $paging=""; if ($pages>1){ // first $paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=1", $first) : $firsts; // prev $paging.=($page>1) ? str_replace("{url}", "$getvars$pagevar=$prevpage", $prev) : $prevs; // pages $ppvrange=ceil($page/$ppv); $start=($ppvrange-1)*$ppv; $end=($ppvrange-1)*$ppv+$ppv; $end=($end>$pages) ? $pages : $end; $paging.=($start>1) ? str_replace("{url}", "$getvars$pagevar=".($start-1), $more).$sep : ""; for ($i=1; $i<=$pages; $i++){ if ($i>$start && $i<= $end){ $paging.=($page==$i) ? str_replace("{page}", $i, $nums).(($i<$end) ? $sep : "") : str_replace(array("{url}", "{page}"), array("$getvars$pagevar=$i", $i), $num).(($i<$end) ? $sep : ""); } } $paging.=($end<$pages) ? $sep.str_replace("{url}", "$getvars$pagevar=".($end+1), $more) : "" ; // next $paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$nextpage", $next) : $nexts; // last $paging.=($page<$pages) ? str_replace("{url}", "$getvars$pagevar=$pages", $last) : $lasts; } return $paging; } ?> <script language="JavaScript" type="text/javascript"> function addEvent(obj, evType, fn, useCapture){ if (obj.addEventListener){ obj.addEventListener(evType, fn, useCapture); return true; } else if (obj.attachEvent){ var r = obj.attachEvent("on"+evType, fn); return r; } else { alert("Handler could not be attached"); } } function getElement(id){ var obj; if (document.getElementById){ obj = document.getElementById(id); }else if (document.all){ obj = document.all.id; } return obj; } function toggleStory(chb, id){ var obj = getElement(id); if (chb.checked){ obj.style.visibility = "visible"; obj.style.height = "450px"; }else{ obj.style.visibility = "hidden"; obj.style.height = "0"; } } </script> <? // ************************** MAIN **************************** // ************************************************************ // init $foo=file($dat); $stuff= new mdasort; $stuff->sortkeys = array(array('time','DESC')); if (count($foo)==0){ $empty=true; $nextindex=1; }else{ $i=0; foreach ($foo as $line){ $line=explode("|", rtrim($line)); if ($line[2]=="static" || ($line[2]=="dynamic" && $line[1]<$now) || isloggedin() ){ $stuff->data[$i] = array("id" => $line[0], "time" => $line[1], "mode" => $line[2], "title" => $line[3], "story" => $line[4], "teaser" => $line[5]); $i++; } } if ($i>0){ $stuff->sortkeys = array(array('id','DESC')); $stuff->msort(); $foo=current($stuff->data); $nextindex=$foo['id']+1; $stuff->sortkeys = array(array('time','DESC')); $stuff->msort(); $numposts=count($stuff->data); }else{ $numposts=0; $empty=true; } } // RSS stuff if ($rssEnable){ $info = pathinfo($_SERVER['PHP_SELF']); $info['dirname'] = ($info['dirname'] == "/") ? $info['dirname'] : $info['dirname']."/"; $url = $info['dirname'].$pathtoscript."rss.php?mndo=rss"; echo "<link rel=\"alternate\" type=\"application/rss+xml\" title=\"$rssTitle\" href=\"$url\" />"; } echo "\n\n<!-- start mynews $version -->\n\n"; echo "<table cellpadding='0' cellspacing='0' border='0' width='100%'><tr><td align='center'>"; clearoldadmins(); // admin stuff if ($do=="admin") { if ($action=="login"){ if ($name==$adminname && $pwd==$adminpwd){ include($log); $fp=fopen($log, "w"); fputs($fp, "<?\n"); $i=0; if (count($admins)>0){ foreach ($admins as $line){ fputs($fp, "\$admins[$i]['time']=".$line[time]."; \$admins[$i]['hash']='".$line['hash']."';\n"); $i++; } } fputs($fp, "\$admins[$i]['time']=".$now."; \$admins[$i]['hash']='".md5($hash)."';\n?>"); fclose($fp); jsRedirect($me.$getvars); } } if ($action=="delete" && isloggedin()){ $todel=getkey($id, $stuff); unset($stuff->data[$todel]); $stuff->msort(); saveposts($stuff->data); $do="view"; }else{ ?> <form action="<?=$me.$getvars?>" method="post" name="form2" class="smtxt"> Admin Login<br><br> <table border="0" cellpadding="0" cellspacing="2" class="smtxt"> <tr><td>Login </td><td> <input name="name" type="text" id="name" size="20"> </td></tr><tr><td>Password </td> <td><input name="pwd" type="password" id="pwd" size="20"></td> </tr><tr><td> </td><td> <input type="submit" name="Submit" value="Login"> <input name="do" type="hidden" id="do" value="admin"> <input name="action" type="hidden" id="action" value="login"> </td></tr></table> </form> <? } } if (isloggedin()){ showmenu(); if ($do=="add"){ if ($action=="save"){ $error=false; $saveit=false; if ($title=="") $error.="<br>» $txtbadtitle"; //if ($story=="") $error.="<br>» $txtbadstory"; if ($teaser=="") $error.="<br>» $txtbadteaser"; if ($date=="") $error.="<br>» $txtbaddate"; if ($error===false){ $date = explode(".", $date); $daytime = explode(".", $_REQUEST['daytime']); $daytime[0] = (is_numeric($daytime[0]) && $daytime[0] >= 0 && $daytime[0] < 24) ? $daytime[0] : 23; $daytime[1] = (is_numeric($daytime[1]) && $daytime[1] >= 0 && $daytime[1] < 60) ? $daytime[1] : 59; $time = mktime($daytime[0], $daytime[1], 0, $date[1], $date[0], $date[2]); $story = ($_REQUEST['hasstory'] == 1) ? $_REQUEST['story'] : ""; if ($id=="new"){ $index=$numposts; $id=$nextindex; $saveit=true; }else if (is_numeric($id)){ $index=getkey($id, $stuff); $saveit=true; } if ($saveit){ $stuff->data[$index]['id']=$id; $stuff->data[$index]['time']=$time; $stuff->data[$index]['mode']=$_REQUEST['mode']; $stuff->data[$index]['title']=str_replace(array("|"), array(" "), $title); if ($wysiwyg===true){ $stuff->data[$index]['teaser']=stripslashes(str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $teaser)); $stuff->data[$index]['story']=stripslashes(str_replace(array("\r", "\n", "|"), array(" ", " ", " "), $story)); }else{ $stuff->data[$index]['teaser']=str_replace(array("\r", "\n", "|"), array(" ", "<br>", " "), $teaser); $stuff->data[$index]['story']=str_replace(array("\r", "\n", "|"), array(" ", "<br>", " "), $story); } saveposts($stuff->data); $stuff->msort(); $empty=false; } $do="view"; }else echo "<div class='smtxt' style='color:#cc0000;'><b>$txterrors</b>$error<br><br><i>$txtclickback</i></div>"; }else{ if ($action=="edit"){ $post=$stuff->data[getkey($id, $stuff)]; $title= htmlentities(stripslashes($post['title']), ENT_QUOTES); if ($wysiwyg===true){ $teaser = ($post['teaser']); $story = ($post['story']); }else{ $teaser=stripslashes(str_replace("<br>", "\n", htmlentities($post['teaser'], ENT_QUOTES))); $story=stripslashes(str_replace("<br>", "\n", htmlentities($post['story'], ENT_QUOTES))); } $time=$post['time']; $mode = $post['mode']; $hasstory = (trim($story) != "") ? true : false; }else{ $title=""; $story=""; $time="notset"; $id="new"; $mode = "dynamic"; $hasstory = true; } ?> <form name="form1" method="post" action="<?=$me.$getvars?>" onSubmit="return submitForm();"> <table border="0" cellpadding="2" cellspacing="0" class="smtxt"> <tr> <td width="65">Date </td> <td> <input name="date" type="text" id="date" value="<?=date("d.m.Y", ($time=="notset") ? time() : $time);?>" style="width:100px;" maxlength="10"> [dd.mm.yyyy] <input name="daytime" type="text" id="time" value="<?=date("H.i", ($time=="notset") ? time() : $time);?>" style="width:80px;" maxlength="5"> [hh.mm] </td> </tr> <tr> <td>Mode </td> <td> <div style="float:left; padding-top:3px;"> <input name="mode" type="radio" value="dynamic" id="dynamic" style="vertical-align:-3px;" <?=($mode=="dynamic") ? "checked" : ""?>/><label for="dynamic">dynamic</label> <input name="mode" type="radio" value="static" id="static" style="vertical-align:-3px;" <?=($mode=="static") ? "checked" : ""?>/><label for="static">static</label> </div> <div style="float:right; text-align:right; font-size:10px;"> <strong>dynamic</strong> = news aren't shown when date is in future<br /> <strong>static</strong> = news are always shown </div> </td> </tr> <tr> <td>Title </td> <td> <input name="title" type="text" id="title" value="<?=$title?>" style="width:500px;" > </td></tr> <!-- Teaser --> <tr> <td valign="top">Teaser </td><td> <div class="rte"> <? if ($wysiwyg===true){ $oFCKeditor = new FCKeditor('teaser') ; $oFCKeditor->BasePath = $pathtoscript.'FCKeditor/'; $oFCKeditor->Value = $teaser; $oFCKeditor->Width = "100%"; $oFCKeditor->Height = 300; $oFCKeditor->Create() ; } else { ?> <textarea name="teaser" cols="50" rows="5" id="story" style="width:500px"><?=$teaser?></textarea> <? }?> </div> </td></tr> <!-- Story --> <tr> <td valign="top"> </td> <td> <input name="hasstory" type="checkbox" id="hasstory" value="1" <?=($hasstory === true) ? "checked" : ""?> style="vertical-align:-3px;" onChange="toggleStory(this, 'rowStory');"/> <label for="hasstory">has story</label> </td> </tr> <tr> <td colspan="2" valign="top" style="padding:0px;"> <div id="rowStory"> <table border="0" cellpadding="2" cellspacing="0" class="smtxt" width="100%"> <tr> <td width="65" valign="top">Story </td><td> <div class="rte"> <? if ($wysiwyg===true){ $oFCKeditor = new FCKeditor('story') ; $oFCKeditor->BasePath = $pathtoscript.'FCKeditor/'; $oFCKeditor->Value = $story; $oFCKeditor->Width = "100%";; $oFCKeditor->Height = 450; $oFCKeditor->Create() ; } else { ?> <textarea name="story" cols="50" rows="5" id="story" style="width:500px"><?=$story?></textarea> <? }?> </div> </td> </tr> </table> </div> <script language="JavaScript" type="text/javascript"> addEvent(window, 'load', toggleStory(getElement('hasstory'), 'rowStory')); </script> </td> </tr> <tr><td> </td><td> <input type="submit" name="Submit" value="<?=($id=="new") ? "Add" : "Save"?>"> <input name="do" type="hidden" id="do" value="add"> <input name="action" type="hidden" id="action" value="save"> <input name="id" type="hidden" id="id" value="<?=$id?>"> </td></tr> </table> </form> <? } } } // display posts if ($do=="view" || !isset($do)){ if (!$empty){ $templates = implode("", file($templatefile)); $tpl_teaser = getTemplate("TEASER", $templates); $tpl_story = getTemplate("STORY", $templates); // show full story of specific news if (is_numeric($_GET['mnid'])){ $item = $stuff->data[getkey($_GET['mnid'], $stuff)]; $item['title'] = stripslashes($item['title']); $item['teaser'] = stripslashes($item['teaser']); $item['story'] = stripslashes($item['story']); if ($wrap!==false) $item['story']=wordwrap($item['story'], $wrap, " ", 1); $match=array("{title}", "{time}", "{teaser}", "{story}", "{edit}", "{delete}", "{urltoallnews}"); if (isloggedin()){ $replace=array( $item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "<a href='$me$getvars&do=add&action=edit&id=".$item['id']."'>$txtedit</a>", "<a href='$me$getvars&do=admin&action=delete&id=".$item['id']."&page=".$_GET['page']."'>$txtdelete</a>", "$me$getvars&page=".$_GET['page']); }else $replace=array($item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "", "", "$me$getvars&page=".$_GET['page']); $tmp = str_replace($match, $replace, $tpl_story); ob_start(); eval("?>".$tmp."<?"); $tmpparsed = ob_get_contents(); ob_end_clean(); $html .= $tmpparsed; echo stripslashes($html); // show all news }else{ $i=1; $from=(is_numeric($_GET['page'])) ? (($_GET['page']-1)*$ppp)+1 : 1; foreach($stuff->data as $item){ if ($item['id']!=0 && $i>=$from && $i< ($from+$ppp) ){ $item['title'] = stripslashes($item['title']); $item['teaser'] = stripslashes($item['teaser']); $item['story'] = stripslashes($item['story']); $hasstory = (trim($item['story']) != "") ? true : false; if ($wrap!==false) $item['story']=wordwrap($item['story'], $wrap, " ", 1); $match=array("{title}", "{time}", "{teaser}", "{story}", "{edit}", "{delete}", "{urltofullstory}"); if (isloggedin()){ $replace=array( $item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "<a href='$me$getvars&do=add&action=edit&id=".$item['id']."'>$txtedit</a>", "<a href='$me$getvars&do=admin&action=delete&id=".$item['id']."&page=".$_GET['page']."'>$txtdelete</a>", ($hasstory === true) ? "$me$getvars&mnid=".$item['id']."&page=".$_GET['page'] : "" ); }else{ $replace = array($item['title'], strftime($dateformat, $item['time']), $item['teaser'], $item['story'], "", "", ($hasstory === true) ? "$me$getvars&mnid=".$item['id']."&page=".$_GET['page'] : "" ); } $tmp = str_replace($match, $replace, $tpl_teaser); ob_start(); eval("?>".$tmp."<?"); $tmpparsed = ob_get_contents(); ob_end_clean(); $html .= $tmpparsed; } $i++; } echo stripslashes($html); $numpages=(fmod($numposts,$ppp)>0) ? floor($numposts/$ppp)+1 : ($numposts/$ppp); echo "<div class='smtxt'><br>"; echo paging($numpages); echo "</div><br>"; } } } // closing table tags echo "</td></tr><tr class='smtxt'><td align='center' class='smsmall' height='20' valign='bottom'>"; if (!isloggedin()) echo "<a href='$me$getvars&do=admin'>$txtadmin</a> - "; else echo "<a href='$me'>$txtlogout</a> - "; ?>
  3. [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: unlink(photo/15.jpg): No such file or directory in /home/fsuk/public_html/bla/delphoto.php on line 9[/quote] thts the error message am i using the ulin incorrectly? heres the coe of line 9: [code]   unlink('photo/'.$_SESSION['photo']);[/code] it also does it when uploading with the upload form as befor eit uploads it deletes the old pic frst so im thinkin its my syntax of unlink..... heres error message [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--] Warning: unlink(http://fsuk.t1hosting.co.uk/bla/photos/15.jpg): No such file or directory in /home/fsuk/public_html/bla/changephotoparse.php on line 28[/quote] and code of line 28 [code]unlink('http://fsuk.t1hosting.co.uk/bla/photos/'.$_SESSION['photo']);[/code] thanks please get back to me asap also my permissions are fine
  4. HAHAHA forgot this.... oops [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]if (!empty[!--coloro:red--][span style=\"color:red\"][!--/coloro--]($POS[!--colorc--][/span][!--/colorc--]T['user']) [/quote] the under slash!!! sorted now thaks for all your help for the now!!! lol till i hit another problem making this site!!!
  5. right tht was tres helpful! however i relaised at first my storage space ofr passwords was to short so thts why it didnt match but i increased storage size and get this now but logging in still dont work ill paste m y most recent cod i got this too btw... [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]password from db = 5d3e010eb98f9eaf295662fd60773c04 md5'd password given = 5d3e010eb98f9eaf295662fd60773c04[/quote] recent login script: [code]<?php   session_start();   include ('db.php');   if (!empty($POST['user']) && !empty($_POST['pass'])) {     $user = trim($_POST['user']);     $pass = md5($_POST['pass']);   } else {     $error = "Invalid Username or Password";     echo $error;     include ('login.html');exit();   }   $sql = "SELECT * FROM band WHERE username = '$user' AND `password` = '$pass'";   $result = mysql_query($sql) or die(mysql_error());   if ($result) {     $user = mysql_fetch_assoc($result);          $_SESSION['userid'] = $user['id'];     $_SESSION['username'] = $user['username'];     $_SESSION['email']= $user['email'];     $_SESSION['prov'] = $user['prov'];     $_SESSION['name'] = $user['name'];     $_SESSION['style'] = $user['style'];     $_SESSION['hist'] = $user['hist'];     $_SESSION['infl'] = $user['infl'];     $_SESSION['open'] = $user['open'];     $_SESSION['photo'] = $user['photo'];     $_SESSION['webs'] = $user['webs'];       echo "<html><head><title>Welcome Back</title></head><body>Welcome back ".$_SESSION['name']."  <a href=\"settings.php\">Click here</a> to view your current settings.</body></html>";      } else {     $error = "Invalid Username or Password";     echo $error;     include 'login.html';exit();   }       ?>[/code]
  6. thanks i'll just go test that ye i do cos its for the next thing it does when i add it which is displays profile cheers man
  7. taht would make my sessions invalid look.. [code]<?php session_start(); header("Cache-control: private"); $user = $_POST['user']; $pass = $_POST['pass']; include('db.php'); // checkin if the user exists $sql_user_check = "SELECT * FROM band WHERE username='$user'"; $result_name_check = mysql_query($sql_user_check); $usersfound = mysql_num_rows($result_name_check); // if user not found, note that and end if ($usersfound < 1) {     $error = "User $user not found."; // if user does exist, continue with processing } else {     // checking if passwords match $sql = "SELECT * FROM band WHERE username='$user'"; if ($result = mysql_query($sql)) {   $user = mysql_fetch_assoc($result);   if (md5($pass) != $user['password']) {     $error = "Invalid password.  Try again.";   } else {     echo "success";   }     // if do match, let in and pass on info to session variables     } else {         $_SESSION['userid'] = $user_info['id'];         $_SESSION['username'] = $user_info['username'];         $_SESSION['email'] = $user_info['email'];         $_SESSION['prov'] = $user_info['prov'];         $_SESSION['name'] = $user_info['name'];         $_SESSION['style'] = $user_info['style'];         $_SESSION['hist'] = $user_info['hist'];         $_SESSION['infl'] = $user_info['infl'];         $_SESSION['open'] = $user_info['open'];         $_SESSION['photo'] = $user_info['photo'];         $_SESSION['webs'] = $user_info['webs'];          } } if (!$_SESSION['username']) {     if ($error) {         echo $error;         include("login.html");[/code] thats what i got at the top half
  8. [code]$pass = $_POST['pass']; [/code] at the top from the form
  9. doesnt work as in always returns password is invlaid please try again! is there something wrong with my code?
  10. haha another glitch..... meh, the registration in works fine but... wht ive done is on registration u can see tht it makes arandom password then makes an encrypted password, it sends the random passwor to the user for login but puts the encryptd password on the database yes it does work... but on loging in, wht ive done is made it so once the user inputs the password it encrypts also using md5 then compares with database encrypted password but it doesnt work!! [code] $sql_pass_get = "SELECT * FROM band WHERE username='$user'";     $user_info = mysql_fetch_array(mysql_query($sql_pass_get));     $password = $user_info['password'];     // if doesn't match, note that and end     if (md5($pass) != $password) {         $error = "Invalid password.  Try again.";[/code]
  11. ohye ALMOST THERE! i sorted the problem now except it registered but still came up with error message ill check itout tjankyou for all your help!
  12. right thank you hmm i sorted some other problems on login.php now tht works fine! woohoo but still getting parse error on unexpected$ on registerun.php hmm im still looking for missing ; and }
  13. right thankyou for all your help but its still doing the [!--quoteo--][div class=\'quotetop\']QUOTE[/div][div class=\'quotemain\'][!--quotec--]Parse error: parse error, unexpected $ in /home/fsuk/public_html/bla/registerun.php on line 132[/quote] with this code... [code]<? $username = $_POST['user']; $nationality = $_POST['prov']; $email_address = $_POST['email']; $Band_name = $_POST['bname']; $style = $_POST['style']; $History = $_POST['hist']; $Influences = $_POST['infl']; $comments = $_POST['open']; $website = $_POST['webs']; include ('db.php'); // Define post fields into simple variables /* Let's strip some slashes in case the user entered any escaped characters. */ $username = stripslashes($username); $nationality = stripslashes($nationality); $email_address = stripslashes($email_address); $Band_name = stripslashes($Band_name); $style = stripslashes($style); $History = stripslashes($hsitory); $influences = stripslashes($influences); $comments = stripslashes($comments); $website = stripslashes($website); /* Do some error checking on the form posted fields */ if((!$username) || (!$email_address)){     echo 'You did not submit the following required information! <br />';     if(!$username){         echo "Username is a required field. Please enter it below.(must be unique)<br />";     }        if(!$email_address){         echo "Email Address is a required field. Please enter it below.";     }         // if(!$Band_name){    //     echo "Desired Band Name is a required field. Please enter it below.<br />";      || (!$Band_name)    // }     include 'register.php'; // Show the form again!     /* End the error checking and if everything is ok, we'll move on to      creating the user account */     exit(); // if the error checking has failed, we'll exit the script! }      /* Let's do some checking and ensure that the user's email address or username does not exist in the database */ $sql_email_check = mysql_query("SELECT email FROM band              WHERE email='$email_address'"); $sql_username_check = mysql_query("SELECT username FROM band              WHERE username='$username'"); $sql = mysql_query("INSERT INTO band SET username='$username', password='$db_password'"); $email_check = mysql_num_rows($sql_email_check); $username_check = mysql_num_rows($sql_username_check); if(($email_check > 0) || ($username_check > 0)){      echo "Please fix the following errors: <br />";      if($email_check > 0){          echo "<strong>Your email address has already been used by another member          in our database. Please submit a different Email address!<br />";          unset($email_address);      }      if($username_check > 0){          echo "The username you have selected has already been used by another member           in our database. Please choose a different Username!<br />";          unset($username);      }      include 'register.php'; // Show the form again!      exit();  // exit the script so that we do not create this account! } /* Everything has passed both error checks that we have done. It's time to create the account! */ /* Random Password generator. http://www.phpfreaks.com/quickcode/Random_Password_Generator/56.php We'll generate a random password for the user and encrypt it, email it and then enter it into the db. */ function makeRandomPassword() {   $salt = "abchefghjkmnpqrstuvwxyz0123456789";   srand((double)microtime()*1000000);       $i = 0;       while ($i <= 7) {             $num = rand() % 33;             $tmp = substr($salt, $num, 1);             $pass = $pass . $tmp;             $i++;       }       return $pass; } $random_password = makeRandomPassword(); $db_password = md5($random_password); // Enter info into the Database. $sql = mysql_query("INSERT INTO band SET username='$username', password='$db_password', name='$Band_Name', country='$nationality', email='$email_address', style='$style', hist='$history', infl='$influences', open='$comments', webs='$website'"); if(!$sql){     echo 'There has been an error creating your account. Please contact the webmaster.'; } else {     $userid = mysql_insert_id();        $subject = "Your Membership at MyWebsite!";     $message = "Dear $name,     Thank you for registering at our website, http://www.thebandcentral.com!<br><br>          Username: $username<br>     Password: $random_password<br>     <b>PLEASE LOG IN AND CHANGE YOUR PASSWORD</b>     Thanks!<br>     The Webmaster<br>          This is an automated response, please do not reply!";          mail($email_address, $subject, $message,         "From: The Band Central Webmaster<s.pretty1@btinternet.com>;     echo 'Your membership information has been mailed to your email address!      Please check it and follow the directions!'; } ?> [/code] also can you check this script..... for login its giving sam message for last line too....[code]<?php session_start(); header("Cache-control: private"); $user = $_POST['user']; $pass = $_POST['pass']; include('db.php'); // checkin if the user exists $sql_user_check = "SELECT * FROM users WHERE username='$user'"; $result_name_check = mysql_query($sql_user_check); $usersfound = mysql_num_rows($result_name_check); // if user not found, note that and end if ($usersfound < 1) {     $error = "User $user not found."; // if user does exist, continue with processing } else {     // checking if passwords match     $sql_pass_get = "SELECT * FROM users WHERE username='$user'";     $user_info = mysql_fetch_array(mysql_query($sql_pass_get));     $encryptpass = $user_info['encryptpass'];     // if doesn't match, note that and end     if ($encryptpass != md5($pass)) {         $error = "Invalid password.  Try again.";     // if do match, let in and pass on info to session variables     } else {         $_SESSION['userid'] = $user_info['id'];         $_SESSION['username'] = $user_info['username'];         $_SESSION['email'] = $user_info['email'];         $_SESSION['prov'] = $user_info['prov'];         $_SESSION['name'] = $user_info['name'];         $_SESSION['style'] = $user_info['style'];         $_SESSION['hist'] = $user_info['hist'];         $_SESSION['infl'] = $user_info['infl'];         $_SESSION['open'] = $user_info['open'];         $_SESSION['photo'] = $user_info['photo'];         $_SESSION['webs'] = $user_info['webs'];          } } if (!$_SESSION['username']) {     if ($error) {         echo $error;         include("login.html");      } else {     echo "<html><head><title>Welcome Back</title></head><body>Welcome back ".$_SESSION['name']."  <a href=\"settings.php\">Click here</a> to view your current settings.</body></html>"; } ?>[/code]
×
×
  • 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.