Jump to content

Garcia

Members
  • Posts

    43
  • Joined

  • Last visited

    Never

Everything posted by Garcia

  1. I still believe my other way could work. There is no way for it to do a loop to see if the result of $email matches with any of the results in projectclient ?
  2. Hmm well $email is stored in a $_SESSION variable but just not $projectclient. Would it work if I added projectclient in a $_session variable in login even if it is empty. It would then be defined when I add a project to that client ?
  3. $projectclient isn't declared because I don't know what exactly to declare it to. It's created by the Admin and not used in the login form so I can have it in the session variable as well. Hmm? Since it's suppose to equal $email to properly work so what do you suggest me to do for this?
  4. I still don't get anything. I know that displaying the user's email works fine so I can cross that off. I also get this error : Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\wamp\www\vault\project\client.php on line 8 Should I have the @ in front of mysql_fetch_assoc(); How does the system know what $projectclient is, by the IF statement correct, because the IF statement checks if it equals the $email.
  5. I had another topic but I didn't make it clear enough maybe this will be better and I can get this fixed. Admin creates a Project and assigns the clients email to the projectclient field under project. The client logs on to see his projects only assigned to him. What I want my IF statement to do is see if $email equals the $projectclient and if it does display the project. Now I think that I am missing something because when I do this WHERE projectclient=$projectclient'; I didn't specify exactly what to pull from the database like to pull the same email found in the table. Here is my bit of code: <?php session_start(); header("Cache-control: no-cache"); //Where $con is found. Works perfectly for other SQL queries. require ('config.php'); //Lets select the $projectclient $sql ='SELECT projectclient FROM project WHERE projectclient=$projectclient'; $rs = @mysql_query($sql, $con); $row = mysql_fetch_assoc($rs); $email = $_SESSION['email']; $projectclient = $row['projectclient']; //Lets see if it works. No. print $row['projectclient']; //Are you logged on . Check username. if($_SESSION['email']){ print " Welcome "; print $_SESSION['email']; } else { header ("Location:login.php"); exit(); } //DO you have a project?! if($email == $projectclient) { print "You have a project!"; } else { print "Currently showing no projects."; } ?>
  6. What I am trying to do is this. Admin adds a project for a specific client (projectclient).The client goes to the client page to view his project, project only appears if the client email matches the one the admin set (projectclient). Make sense? I am still trying to figure out how to do this.
  7. Ok this is what I did: Under projects table, projectclients will be assigned an email that needs to match the email of the client to display the project. But that is what I am having problems with. Here is the client.php page. <?php session_start(); header("Cache-control: no-cache"); require ('config.php'); $sql ='SELECT email FROM user'; $rs = @mysql_query($sql, $con); $row = mysql_fetch_assoc($rs); $sql2 ='SELECT projectclient FROM project'; $rs2 = @mysql_query($sql, $con); $row2 = mysql_fetch_assoc($rs2); $email = $row['email']; $projectclient = $row['projectclient']; if($_SESSION['email']){ print " Welcome "; print $_SESSION['email']; } else { header ("Location:login.php"); exit(); } if($email == $projectclient) { print " You have a project. "; } else { print "Umm no project"; } ?> t displays umm no project even when I assigned that project to that email...
  8. Ok this is what I did: Under projects table, projectclients will be assigned an email that needs to match the email of the client to display the project. But that is what I am having problems with. Here is the client.php page. <?php session_start(); header("Cache-control: no-cache"); require ('config.php'); $sql ='SELECT email FROM user'; $rs = @mysql_query($sql, $con); $row = mysql_fetch_assoc($rs); $sql2 ='SELECT projectclient FROM project'; $rs2 = @mysql_query($sql, $con); $row2 = mysql_fetch_assoc($rs2); $email = $row['email']; $projectclient = $row['projectclient']; if($_SESSION['email']){ print " Welcome "; print $_SESSION['email']; } else { header ("Location:login.php"); exit(); } if($email == $projectclient) { print " You have a project. "; } else { print "Umm no project"; } ?> It displays umm no project even when I assigned that project to that email...
  9. Its a MYSQL table. No I just want if someone can explain how I can do this logically.
  10. I am developing a Project Management System and I need a logical way on how to assign projects to clients. Here is the table I have: Table: projects Field 1: project_id Field 2: projectname Field 3: projectdesc Field 4: projectclient Each client is assigned their own ID. So how would I be able to create an IF statement to show only the client their own project? Thanks.
  11. Hello! I am skinning an application for a client and encountering many errors :-\. In firefox under http://www.garciawebmedia.com/search/search.php?search=maroc&type=Images you can notice a small 1px problem. Search File: <script language="javascript" type="text/javascript"> <!-- var win=null; function NewWindow(mypage,myname,w,h,scroll,pos){ if(pos=="random") {LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100; TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;} if(pos=="center") {LeftPosition=(screen.width)?(screen.width-w)/2:100; TopPosition=(screen.height)?(screen.height-h)/2:100;} else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20} settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes'; win=window.open(mypage,myname,settings);} // --> </script> <?php /*--------------------------------------------------+ | | | Copyright © 2006 http://www.inoutscripts.com/ | | All Rights Reserved. | | Email: contact@inoutscripts.com | | | +---------------------------------------------------*/ ?><?php $src_note="Results found in <a href=\"http://www.altavista.com/\">AltaVista</a>"; $special=""; $engine=$_REQUEST['type']; include_once("admin/config.inc.php"); //$source="AltaVista"; $source="special"; $source=$mysql->echo_one("select source from ".$tableprefix."inoutmse_engine where name='$engine'"); $tot_count=$mysql->echo_one("select count from ".$tableprefix."inoutmse_engine where name='$engine'"); $tot_count+=1; mysql_query("update ".$tableprefix."inoutmse_engine set count='$tot_count' where name='$engine'"); //echo "hi".$source; //$source=$engine; //if($source="AltaVista") // $search // include_once("admin/config.inc.php"); // Grabbing the Search Terms //$index=$_REQUEST['index']; $search=$_REQUEST['search']; $index=0; if(isset($_REQUEST['index'])) $index=$_REQUEST['index']; $search=str_replace("\\","",$search); $search=str_replace("\'","'",$search); //$search="cricket"; //Finding Total Value ?> <?php if($filter_badwords==1){ $fp=fileOpen("admin/settings/filter.txt","r"); $ch=""; $abc=""; while(!feof($fp)) { $ch=fgetc($fp); while($ch!="\n" && $ch!="\r\n" && !feof($fp)) { $abc.=$ch; $ch=fgetc($fp); } if($abc!="") $search=str_replace(strtolower($abc),"",strtolower($search)); $abc=""; } } ?> <?php $search=str_replace(" ","+",$search); include_once("url_replaces.inc.php"); include_once("total_replaces.inc.php"); $search=str_replace("+"," ",$search); $once=0; set_time_limit(0); $no=3; $search=str_replace(' ','+',$search); $special=str_replace(":","%3A",$special); //$fp=$faltanews; $cannotfind=0; $foundonce=0; $t=""; $result=""; $noresults=1; include_once("headers.inc.php"); // $results_display.='<table>'; if($total==0 || $total=="" || $index*10 > $total || str_replace(" ","",str_replace("+","",$search))=="") { $ct=""; $fs=fileOpen($server_dir."admin/templates/error.tpl.html","r"); while(!feof($fs)) $ct.=fgetc($fs); $results_display.=$ct; // $results_display.='</table>'; } else { //echo "result".$results_display; //echo "hi2"; $total_display="Showing <span class=\"total_range\">".(($index*10)+1)."</span> - <span class=\"total_range\">"; ?> <?php if((($index*10)+10)<=$total) { $total_display.= ($index*10)+10; } else { $total_display.= $total; } ?> <?php $total_display.="</span> of around <span class=\"total_results\">" ?><?php $total_display.= number_format($total); $total_display.="</span> results for <span class=\"search_term\">" ?> <?php $total_display.=str_replace("+"," ",$search)."</span>"; ?><?php //echo "hi2"; // include("url_replaces.inc.php"); /*$contents = ''; while (!feof($fp)) { $contents .= fread($fp, 8192); } echo "contents".$contents; exit;*/ //while((!feof($fp))&&($cannotfind==0)&&$noresults<=10) while((!feof($fp))) { $ch=fgetc($fp); $t=""; if($ch==$b1) { //echo "hi"; $t=$t.$ch; $ch=fgetc($fp); if($ch==$b2) { $t=$t.$ch; $ch=fgetc($fp); if($ch==$b3) { //echo "hi"; $i=0; $match=""; while(!feof($fp)&&$i<strlen($scheck)) { $match=$match.fgetc($fp); $i=$i+1; } if($match==$scheck) { //echo "hi"; $t=$t.$ch; $start=$start.$t.$match; $result=""; $result=$result.$start; while($cannotfind==0&&(!feof($fp))) { $foundonce=0; $ch=fgetc($fp); if($ch==$e1) { $result=$result.$ch; $ch=fgetc($fp); if($ch==$e2) { $result=$result.$ch; $ch=fgetc($fp); //echo "Source=".$source."<br>"; //echo "ch=".$ch; //echo "e3=".$e3."<br>"; // $e3 = "t"; //echo "engine =". $engine ; if($ch==$e3) { $result=$result.$ch; $i=0; $match=""; //if($engine != "Audio"){ while(!feof($fp)&&$i<strlen($echeck)) { $match=$match.fgetc($fp); $i=$i+1; } //} if($match==$echeck) { $result=$result.$match; $result=$result.$end; //echo "$result <br>"; //echo "<hr><hr>Source=".$result."<hr><hr>"; include("result_replaces.inc.php"); include("link_replaces.inc.php"); ?> <?php $results_display.=' <table cellpadding="0" ><tr> <td width="0%" valign="top">'; if($show_thumbs==1){ $results_display.='<img src="http://open.thumbshots.org/image.pxf?url='.$link.'" border="0" onload="if (this.width>50) this.border=1; this.alt=\'Thumbnails by Thumbshots.org\';"> </td><td width="96%" valign="top">'; }else { $results_display.=' </td> <td width="96%" >'; } ?> <?php if($term_bold==1) include("termstyle.php"); // echo $link; // echo "hi"; $results_display.= "$result"; if($show_mail=="1") { if($engine=="News") $results_display.=" "; //Send link url to the popup window. $results_display.='<img src="images/mail.gif" height="16" width="16" align="top"> <a href="recommend.popup.php?link='.urlencode($link).'&result='.urlencode('http://'.$_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']).'" onclick="NewWindow(this.href,\'0\',\'450\',\'450\',\'no\',\'center\');return false" onfocus="this.blur()" class="popup">Email Link</a> '; } //if($engine=="Wikipedia") //$link="wikilink.php?link=".$link; //echo $engine; if(($quick_look==1) && ($engine!="Wikipedia")) { if($engine=="Audio") $results_display.="<br>"; include("qlook.php"); } ?> <?php $results_display.='</td> <td width="4%"> </td> </tr> <tr> <td> </td><td> </td><td> </td> </tr> '; if($show_separator=="1") { $results_display.=' <tr> <td colspan="3" bgcolor="#CCCCCC"><img src="images/spacer.gif" width="1" height="1"></td> </tr><tr> <td colspan="3"> </td></tr> '; } $results_display.='</table>'; ?> <?php $noresults=$noresults+1; break; } else { $result=$result.$match; } } } if(strlen($result>700)) { echo "overflow"; $cannotfind=1; break; } } if($foundonce==1) break; $result=$result.$ch; } } } } } } ?> <?php if(1) { ?> <?php if ($noresults>=2) { ?> <?php $search=str_replace("'","\'",$search); //include("admin/rel_terms.php"); $search=str_replace("\'","'",$search); ?> <?php } // $engine=$_REQUEST['type']; ?> <?php $count=$_REQUEST["index"]; if($count>=1){ ?> <?php $footerlinks_display.=' <a href="search.php?type='.$engine.'&c=1&index='; ?><?php $footerlinks_display.=(--$count); $count++; ?><?php $footerlinks_display.='&search='; ?><?php $footerlinks_display.="$search"."\">"; ?><?php $footerlinks_display.="Previous"; ?><?php $footerlinks_display.='</a> ';?> <?php } ?> <?php $set=1; for($i=($count-5);$i<($count+;$i++) { if($i>0&& $i<=(($total)/(10))+1) { if($set==1) { $footerlinks_display.="| "; $set=2; } if(($index)==($i-1)) { ?> <?php $footerlinks_display.=" ".$i." |"; } else { ?> <?php $footerlinks_display.=' <a href="search.php?type='.$engine.'&c=1&index='; ?><?php $footerlinks_display.=($i-1); $footerlinks_display.='&search='; ?><?php $footerlinks_display.= "$search"."\">"; ?><?php $footerlinks_display.="$i"; ?><?php $footerlinks_display.='</a> |';?> <?php } } } ?> <? if($total=="" || $total==0) $total=0; if($total>=(($index*10)+10)) { ?> <?php $footerlinks_display.=' <a href="search.php?type='.$engine.'&c=1&index='; ?><?php $footerlinks_display.= (++$count); $footerlinks_display.='&search='; ?><?php $footerlinks_display.="$search"."\">"; ?><?php $footerlinks_display.= "Next"."</a>"; ?> <?php } else { echo ""; } ?> <?php } if($noresults==1) { $ct=""; $fp=fileOpen($server_dir."admin/templates/error.tpl.html","r"); while(!feof($fp)) $ct.=fgetc($fp); $results_display.=$ct; // $results_display.='</table>'; } } // $results_display.='</table>'; ?> <?php print " <div id='logo'> <img src='images/logo.gif' width='239' height='55' alt=''> </div> "; print " <div id='navbackground2'> <ul> "; if ($_GET["type"] == "Maroc") print " <li class='col1'> <a href='search.php?search=$search&type=Maroc' ><div class='font'>Maroc</div></a></li> "; else { print " <li class='col2'> <a href='search.php?search=$search&type=Maroc' ><div class='font'>Maroc</div></a></li> "; } if ($_GET["type"] == "Web") print " <li class='col1'> <a href='search.php?search=$search&type=Web' ><div class='font'>Web</div></a></li> "; else { print " <li class='col2'> <a href='search.php?search=$search&type=Web' ><div class='font'>Web</div></a></li> "; } if ($_GET["type"] == "Images") print " <li class='col1'> <a href='search.php?search=$search&type=Images' ><div class='font'>Images</div></a></li> "; else { print " <li class='col2'> <a href='search.php?search=$search&type=Images' ><div class='font'>Images</div></a></li> "; } if ($_GET["type"] == "News") print " <li class='col1'> <a href='search.php?search=$search&type=News' ><div class='font'>News</div></a></li> "; else { print " <li class='col2'> <a href='search.php?search=$search&type=News' ><div class='font'>News</div></a></li> "; } if ($_GET["type"] == "Kids") print " <li class='col1'> <a href='search.php?search=$search&type=Kids' ><div class='font'>Kids</div></a></li> "; else { print " <li class='col2'> <a href='search.php?search=$search&type=Kids' ><div class='font'>Kids</div></a></li> "; } print " </ul> </div></div> "; if($_REQUEST['type']=="Kids") { print " <div id='mg1' > <div id='searchcontent'> <form name='form1' method='get' action='redir.php'> <input name='search' type='text' id='search' value='"; if(isset($_REQUEST['search'])) echo $_REQUEST['search']; print "'size='60'> <input name='type' type='hidden' id='type' value='Kids'> <input type='submit' class='button' name='Submit' value='Search Kids !'> </div> <br/><br/> <div class='total'>$total_display</div> </div> "; } if($_REQUEST['type']=="Maroc") { print " <div id='mg1' > <div id='searchcontent'> <form name='form1' method='get' action='redir.php'> <input name='search' type='text' id='search' value='"; if(isset($_REQUEST['search'])) echo $_REQUEST['search']; print "'size='60'> <input name='type' type='hidden' id='type' value='Maroc'> <input type='submit' name='Submit' value='Search Maroc !'> </div> <br/><br/> <div class='total'>$total_display</div> </div> "; } if($_REQUEST['type']=="News") { print " <div id='mg1' > <div id='searchcontent'> <form name='form1' method='get' action='redir.php'> <input name='search' type='text' id='search' value='"; if(isset($_REQUEST['search'])) echo $_REQUEST['search']; print "'size='60'> <input name='type' type='hidden' id='type' value='News'> <input type='submit' name='Submit' value='Search News !'> </div> <br/><br/> <div class='total'>$total_display</div> </div> "; } if($_REQUEST['type']=="Images") { print " <div id='mg1' > <div id='searchcontent'> <form name='form1' method='get' action='redir.php'> <input name='search' type='text' id='search' value='"; if(isset($_REQUEST['search'])) echo $_REQUEST['search']; print "'size='60'> <input name='type' type='hidden' id='type' value='Images'> <input type='submit' name='Submit' value='Search Images !'> </div> <br/><br/> <div class='total'>$total_display</div> </div> "; } if($_REQUEST['type']=="Web") { print " <div id='mg1' > <div id='searchcontent'> <form name='form1' method='get' action='redir.php'> <input name='search' type='text' id='search' value='"; if(isset($_REQUEST['search'])) echo $_REQUEST['search']; print "'size='60'> <input name='type' type='hidden' id='type' value='Web'> <input type='submit' name='Submit' value='Search Web !'> </div> <br/><br/> <div class='total'>$total_display</div> </div> "; } $results_display='<script src="qlook.js" language="JavaScript"></script>'.$results_display; $results_display='<script src="image-swap.js" language="JavaScript"></script>'.$results_display; $ch=""; $fp=fileOpen("admin/templates/results.tpl.html","r"); while(!feof($fp)) $ch.=fgetc($fp); //echo $results_display; //exit; function search($start,$end,$string, $borders=true){ $reg="!".preg_quote($start)."(.*?)".preg_quote($end)."!is"; preg_match_all($reg,$string,$matches); if($borders) return $matches[0]; else return $matches[1]; } ////////////////////////////DECODE IT CODE START///////////////////////////// $arr = search("&#8226; <a","<br>-->",$results_display); $results_display = str_replace($arr,"",$results_display); $arr = search("&#8226; <a","</a></span>",$results_display); $results_display = str_replace($arr,"",$results_display); $results_display = str_replace("Open in new","",$results_display); ////////////////////////////DECODE IT CODE END///////////////////////////// $ch=str_replace("{RESULTS}",$results_display,$ch); $ch=str_replace("{TOTAL}",$total_display,$ch);$ch=str_replace("{FOOTERLINKS}",$footerlinks_display,$ch); $ct=""; //echo $site_dir; $fp=fileOpen($server_dir."tabs.php?type=$engine"."&search=$search","r"); while(!feof($fp)) $ct.=fgetc($fp); $ch=str_replace("{TABS}",$ct,$ch); $ct=""; $fp=fileOpen($server_dir."admin/rel_terms.php?search=".$search."&on=web&type=$engine","r"); while(!feof($fp)) $ct.=fgetc($fp); $ch=str_replace("{RELATIVE-VERT}",$ct,$ch); $ct=""; $fp=fileOpen($server_dir."admin/rel_terms_iv.php?search=".$search."&on=web&type=$engine","r"); while(!feof($fp)) $ct.=fgetc($fp); $ch=str_replace("{RELATIVE-HORI}",$ct,$ch); //eval("\$ch=\"$ch\";"); $ch=str_replace("{ENGINE}",$engine,$ch); $ch=str_replace("{TERM}",str_replace("+"," ",$search),$ch); $ch=str_replace("{SOURCE}",$src_note,$ch); echo $ch; //echo "hi"; mysql_close(); ?> Style /*General page style.*/ BODY { background-color: #FFFFFF; font-family: arial; font-size: 14px; margin-left: 0px; margin-top: 0px; margin-right: 0px; margin-bottom: 0px; } * { margin: 0; padding: 0; } input { border: 1px solid #000; height: 22px; } .button { font: 12px Verdana, Geneva, Arial, Helvetica, sans-serif; margin-left: 10px; } td { font-family: verdana; font-size:13px; } big { font-family: verdana; font-size: 13px; text-decoration: none; } small { font-family: verdana; font-size: 11px; text-decoration: none; } /*Link styles*/ a:link,a:visited,a:active { font-family: verdana; font-size: 13px; text-decoration: none; } a:hover { color: #ff0000; } .total { color: #FFF; font-size: 14px; float: right; margin-right: 25px; margin-bottom: 10px; } /* Manages the style heading of related search*/ .related_heading { font-family: verdana; color:#FFF; text-decoration: none; font-weight: bold } /* Manages the style of the range of number of results*/ .total_range { font-family: verdana; color:#FFF; text-decoration: none; font-weight: bold } /* Manages the style of the total number*/ .total_results { font-family: verdana; color:#FFF; text-decoration: none; font-weight: bold } /* Manages the style of the search term*/ .search_term { font-family: verdana; color:#FFF; text-decoration: none; font-weight: bold } #navbackground { width: 100%; height: 32px; background-image: url(images/navbg.gif); } #navbackground2 { width: 100%; height: 32px; background-image: url(images/navbg.gif); } #navbackground2 ul { list-style:none; text-align: center; } #navbackground2 ul li { margin-top: 7px; float: left; width: 124px; height: 25px; margin-left: 5px; } #mg1 { width: 100%; height: 79px; background-image: url(images/mbg.gif); border-bottom: 1px solid #000; } #navbackground ul { display: inline; list-style:none; text-align: center; } #navbackground ul li { margin-top: 6px; float: left; width: 124px; height: 25px; margin-left: 5px; } .col1 {background-image: url(images/nav1.gif); border-bottom: 1px solid #d62201; } .col2 {background-image: url(images/nav2.gif); border-bottom: 1px solid #000; } #searchcontent { float: left; margin-top: 20px; margin-left: 100px; } .font { text-align: center; margin-top: 6px; color: #FFFFFF; font-weight: bold; text-decoration: none; } #logo { margin-top: 20px; margin-left: 50px; } Another problem I am having is that I can not center the tabs at all on the page. <?php include_once("admin/config.inc.php"); ?> <script language="javascript"> function Determine(type,status){ //alert(type); var term=document.getElementById('search').value; //alert(term); if(term!="") window.location="redir.php?type="+type+"&search="+term; if(status=="0" && term=="") window.location="index.php?type="+type; } </script> <?php if(!isset($_REQUEST['type'])){ $type=$mysql->echo_one("select name from ".$tableprefix."inoutmse_engine where disabled<>1 order by sortorder asc"); //echo $type; }else $type=$_REQUEST['type']; ?> </head> <body> <div id="navbackground"> <ul> <?php if (($_GET["type"] == "") or ($_GET["type"] == "Maroc")) {?> <li class="col1"> <a href="javascript:Determine('Maroc','0');" ><div class="font">Maroc</div></a></li> <?php } else {?> <li class="col2"> <a href="javascript:Determine('Maroc','0');" ><div class="font">Maroc</div></a></li><? } ?> <?php if ($_GET["type"] == "Web") {?> <li class="col1"> <a href="javascript:Determine('Web','0');" ><div class="font">Web</div></a></li> <?php } else {?> <li class="col2"> <a href="javascript:Determine('Web','0');" ><div class="font">Web</div></a></li><? } ?> <?php if ($_GET["type"] == "Images") {?> <li class="col1"> <a href="javascript:Determine('Images','0');" ><div class="font">Images</div></a></li> <?php } else {?> <li class="col2"> <a href="javascript:Determine('Images','0');" ><div class="font">Images</div></a></li><? } ?> <?php if ($_GET["type"] == "News") {?> <li class="col1"> <a href="javascript:Determine('News','0');" ><div class="font">News</div></a></li> <?php } else {?> <li class="col2"> <a href="javascript:Determine('News','0');" ><div class="font">News</div></a></li><? } ?> <?php if ($_GET["type"] == "Kids") {?> <li class="col1"> <a href="javascript:Determine('Kids','0');" ><div class="font">Kids</div></a></li> <?php } else {?> <li class="col2"> <a href="javascript:Determine('Kids','0');" ><div class="font">Kids</div></a></li><? } ?> </ul> </div> </div> <div id="mg1"> <div id="searchcontent"> <?php if(!isset($_REQUEST['type']) || $_REQUEST['type']=="Web") { ?> <form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" class="button" name="Submit" value="Search Web !"> </form> </div></div> <?php } ?> <?php if($_REQUEST['type']=="Images") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Images !"> <?php } ?> <?php if($_REQUEST['type']=="Audio") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Audio !"> <?php } ?> <?php if($_REQUEST['type']=="Video") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Video !"> <?php } ?> <?php if($_REQUEST['type']=="News") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search News !"> </form> <?php } ?> <?php if($_REQUEST['type']=="Sport") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Sport !"> <?php } ?> <?php if($_REQUEST['type']=="Open Directory") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Open Directory !"> <?php } ?> <?php if($_REQUEST['type']=="Wikipedia") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Wikipedia !"> <?php } ?> <?php if($_REQUEST['type']=="Dictionary") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Dictionary !"> <?php } ?> <?php if($_REQUEST['type']=="Maroc") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Marrocco !"> <?php } ?> <?php if($_REQUEST['type']=="Kids") { ?><form name="form1" method="get" action="redir.php"> <input name="search" type="text" id="search" value="<?php if(isset($_REQUEST['search'])) echo $_REQUEST['search']; ?>" size="60"> <input name="type" type="hidden" id="type" value="<?php echo $type; ?>"> <input type="submit" name="Submit" value="Search Kids !"> <?php } ?> One more issue... How can I get the input field larger and button larger and looking like the Search button showed on this forum above? Thanks!
  12. I never really figured out a solution to fix the footer problem on all the websites i have created. In my browser and resolution (Firefox, 1280 x 1024) the footer fits on the bottom of the page, now when I got to 1024 x 768 in any browser the right content box goes under the footer being cut off. Is the due possibly to the height of the container? Any fix on how to do this? My page qualifies as XHTML valid so not being valid isn't the problem Here is the live page http://trueamericanlife.com/garciamedia/design2.html Here are the codes <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html> <head> <title>Garcia Web Media</title> <meta name="description" content="A web design business the creates logo identities, web design, templates, and other type of graphics." /> <meta name="keywords" content="web design, logos, templates, web templates, banners, media, garcia, web" /> <link href='design2.css' rel='stylesheet' type='text/css' /> </head> <body> <div id="container"> <div id="containermargins"> <div id="header"> <div id="banner"></div> <div id='navbar'> <ul> <li><a href='#'><img src='images/home.gif' width='77' height='30' alt='' /></a></li> <li><a href='#'><img src='images/about.gif' width='77' height='30' alt='' /></a></li> <li><a href='#'><img src='images/services.gif' width='77' height='30' alt='' /></a></li> <li><a href='#'><img src='images/portfolio.gif' width='77' height='30' alt='' /></a></li> <li><a href='#'><img src='images/contact.gif' width='77' height='30' alt='' /></a></li> </ul> </div> </div> <div id="leftcontent"> <div id="leftcontentbg"> <img src="images/customerquotehead.gif" height="46px" width="203px" alt=""/> <br/><p><b>Interested in our Services and want to request a free quote?</b><br/> A free quote will bring you a free estimated cost for any work you want done. We will get back to you as soon as possible, may take up to 24 hours for a responce.</p> <br/><center><a href="quote.html">Request Quote Now!</a></center> <br/> </div> <img src="images/leftconfade.jpg" height="111px" width="203px" alt="" /> </div> <div id="rightcontent"> <div id="rightcontentbg"> <img src="images/rightconhead.gif" height="40px" width="569px" alt="" /> <div id="rightcontxt"><h2>Our <i>mission</i> is to provide you with a complete web package that will fit your needs. Affordable prices, wonderful work, and great cooperative customer support. You will always leave more then satisfied. </h2> <br/> <h2><i>Garcia Web Media</i> specializes in web design, development and logo identity. We provide all services including a full web design package including a domain name, hosting, custom web design, identity logo (includes business cards) and a content management system that is easy for you to customize. Please check out our services page for full details.</h2> </div> <div id="rightconimg"><img src="images/mission.gif" width="200px" height="143px" alt="" /></div> <div class="txtmargin"><img src="images/bar.gif" height="7px" width="550px" alt="" /></div> <div id="recentprojects"><img src="images/recentprojects.gif" width="222px" height="37px" alt="" /></div> <div id="leftpro"><p>The last project was created as a skin for a website called True American Life. True American Life is a community simulating an american dream. We came up with a dark design resembling a blacked out city. <a href="#">Read more...</a></p></div> <div id="rightpro"><a href="http://trueamericanlife.com"><img src="images/project1.gif" width="199px" height="142px" border="0" alt=""/></a></div> <div class="footer"></div> </div> <img src="images/rightconbot.gif" height="13px" width="569px" alt="" /> </div> </div> <div class="footer"></div> <div id="bottom"><h3>Copyright © 2007 Garcia Web Design. All Rights Reserved.</h3></div> </div> </body> </html> html, body { background: #51606e; color: #48515a; font: 12px verdana; height: 100%; margin: 0px; padding: 0px; } a img { border:0; } * { margin: 0; padding: 0; } a:link { color: #48515a; } a:hover { color: #9aa9b8; } a:visited { color: #48515a; } a:active { color: #48515a; } div#container { background-image: url('images/bg.gif'); height: 100%; position: relative; width: 820px; margin: auto; } * html #container { height:100%; } div#containermargins { margin: 0 10px 0 10px; } div#header { height: 140px; padding: 0 0 2em 0; } div#banner { background-image: url('images/banner.jpg'); width: 100%; height: 100px; } #navbar { height:40px; background-image: url('images/navbg.gif'); width: 100%; } #navbar ul { list-style:none; } #navbar ul li { float:left; margin: 2px 0 0 10px; } div#leftcontent { float: left; width: 220px; } div#leftcontentbg{ background-image: url('images/leftconbg.gif'); width: 203px; } div#rightcontent { width: 569px; float: right; } div#rightcontxt { float: left; width: 345px; } div#rightconimg { float: right; width: 220px; } div#rightcontentbg{ background-image: url('images/rightconbg.gif'); width: 569px; } div#rightpro { float: right; width: 220px; } div#leftpro { float: left; width: 345px; } .footer { display: block; clear:both; } .spacer { clear: both; height: 40px; width: 100%; } div#bottom { display: block; clear: both; position: absolute; bottom: 0; background-color: #3d4855; margin: 0 0 0 10px; width: 800px; height: 30px; border-top: 1px solid #223241; border-bottom: 1px solid #223241; } p { margin-left: 8px; margin-right: 8px; } h3 { font: 12px verdana; color: #FFF; text-align: center; } h2 { color: #FFFFFF; font: 12px verdana; margin-left: 8px; margin-right: 8px; } div#recentprojects{ margin-left: 20px; padding-top: 5pt; } .txtmargin { margin-left: 10px; } Any help would be greatly appreciated since I just spent an hour and a half trying to debug my errors . Thanks!
  13. You could just do: [code] include ('admin/admin.php'); [/code]
  14. Garcia

    Sessions

    Thank You Everyone  :-* ;D !
  15. Garcia

    Sessions

    Thanks all... I get the username, and the id, but the gid displays simply 'gid' . I have the value 1 automatically set as default in the table for gid. 1 would equal the member's group. Here is my updated codes. Log In Script : [code] <?php //login page session_start(); session_register("username", "id", "gid"); require ("config.php"); //if entered blank form returns error foreach ($_POST as $field => $value) {   if ($value == "") {   $blanks[] = $field; } } if (isset ($blanks) ) { $message = "Following fields are blank. Please enter the required information:  "; foreach ($blanks as $value) { $message .= "$value, "; } extract ($_POST); include ('login_form.php'); exit(); } //Define variables. $username = trim($_POST['username']); $password = trim($_POST['password']); //time to select information $sql ="SELECT `username`,`password`, `id`, 'gid' FROM members WHERE username = '$username' AND password = md5('$password')"; $result = mysql_query($sql, $con); $row = mysql_fetch_assoc($result); mysql_error(); //We check if username and password is correct $num = mysql_numrows ($result); if ($num != 0) { $_SESSION['username'] = $username; $_SESSION['id'] = $row['id']; $_SESSION['gid'] = $row['gid'];         print "Welcome " . $_SESSION['username'] . " - your log-in succeeded!"; } else { print "Wrong username or password"; } ?> [/code] Here is where I am viewing / protecting the page. [code] <?php require ('config.php'); session_start(); header("Cache-control: no-cache"); if ( ! isset ( $_SESSION['username'] ) ) { header ( 'Location: login_form.php' ); exit (); } // continue, logged in user print $_SESSION['username']; print '<br />'; print $_SESSION['id']; print '<br />'; print $_SESSION['gid']; print '<br />'; if ( $_SESSION['gid'] == '1') { print "Authorized"; } else { print "Not authorized"; } ?> [/code] The output for the IF statement shows Not Authorized but it should say Authorized. Any help? Thanks :).
  16. Garcia

    Sessions

    Now is the $id defined by pulling the information from the SQL query? I have tried a few things and it hasn't defined the $id because I haven't used it in the form like i did the username.
  17. I am trying to retrieve the user id of a member from my login page, but I do not know how set the variable and retrieve it on that page. Log In: [code] <?php //login page session_start(); session_register("username", "id", "gid"); require ("config.php"); //if entered blank form returns error foreach ($_POST as $field => $value) {           if ($value == "")                 {                   $blanks[] = $field;                 } } if (isset ($blanks) ) {         $message = "Following fields are blank. Please enter the required information:  ";         foreach ($blanks as $value)         {                 $message .= "$value, ";         }         extract ($_POST);         include ('login_form.php');         exit(); } //Define variables. $username = trim($_POST['username']); $password = trim($_POST['password']); //time to select information $sql ="SELECT `username`,`password`, `id`, 'gid' FROM members WHERE username = '$username' AND password = md5('$password')"; $result = mysql_query($sql, $con); $row = mysql_fetch_assoc($result); mysql_error(); //We check if username and password is correct $num = mysql_numrows ($result); if ($num != 0) {         print "Welcome $username - your log-in succeeded!"; } else {         print "Wrong username or password"; } ?> [/code] Here is the page where I want the sessions to appear. Now would I need to start a query to receive the users id and if I did how would I accomplish this? [code] <?php require ('config.php'); session_start(); header("Cache-control: no-cache"); print $username; print $id; //Not sure how to set this one up ?> [/code] Any help would be appreciated. Thanks!
  18. Garcia

    Groups

    Here is what I am trying to accomplish. I set up an example page for groups. -Displays an error for guests. -Display an error for members who are not an admin (group 3). I set up a table for members and a field called gid which is its group id. I set up a table for groups which have the groups and the id. Now to protect a page for admins only I tried this: [code] <?php session_start(); header("Cache-control: no-cache"); if($_SESSION['auth']) { print "Welcome Member!"; } else { print "Welcome Guest!"; } if($_SESSION['gid'] == 3{ print "Part of Admin Group"; } else { print "Not part of admin group"; } ?> [/code] That didn't work it did print Welcome Member but for everyone it including guests it did say Part of Admin Group. I am trying to accomplish user group protected pages, but not sure how to set it up properly. I may need to create a permissions table but not sure what to add with that. Any help including code snippets or tutorials would be very appreciated. Regards,
  19. Garcia

    Groups

    No, this is about protecting pages with permissions by creating groups in PHP...
  20. Garcia

    Groups

    I have been looking around not sure where to find a tutorial or anything. I am looking for a tutorial or help on how to set up groups, and permissions. So I can have groups like members, staff, and admin. I already set up the group id and when a member registers they automatically going into group 1 which is members. But I don't know how to set up anything else  ???. Thanks!
  21. I am having problems how to loop through all my fields and set an error if they are blank. This is what I have now. [code] foreach($_POST as $value) { if ($password and $username == "") {   $message = "Please fill in the Password field!";       include ('login_form.php');   exit();     } } [/code] I am not sure how to set that up properly. I did have an If for each field and it would repeat the form multiple times with each error. So I stuck them together and not sure how to do it, and with the loop. Any help would be nice. Thanks!
  22. Alright well i still am having a problem  ???. Updated Code: Login [code] <?php //login page session_start(); require ("config.php"); switch (@$_POST['do'] ) { case "new": //if entered blank form returns error if($_POST['username'] == "") {   $message = "Blank Username"; include ("login_form.php"); } if($_POST['password'] == "") {   $message = "Blank Password"; include ("login_form.php"); } $sql = "SELECT username FROM members WHERE username='$_POST[username]'"; $rs = mysql_query($sql, $con) or die ("Couldn't execute query."); $num = mysql_num_rows($rs); if ($num > 0) // login name found! { $sql = "SELECT username From members WHERE username='$_POST[username]' AND password=md5('$_POST[password]')"; $result2 = mysql_query($sql,$con)                 or die ("Couldn't execute query 2."); $num2 = mysql_num_rows ($result2); if ($num > 0) //correct passy { $_SESSION['auth'] = "yes"; header ("Location: members.php"); }       else {   $message = "The Login Name, '$_POST[username]' exists, but you have not entered the correct password!<br/>";   include ("login_form.php"); } } elseif ($num == 0) { $message = "Login Name does not exist"; include ("login_form.php"); } break; default: include ("login_form.php"); } ?> [/code] login form [code] <html> <head> <title>Member Login</title> </head> <body> <h1>Member Login:</h1><br /> <?php     if (isset ($message) ) { print " $message "; } ?> <form action="login.php?do=new" method="POST"> Member ID: <input type="text" name="username " size="20" /><br /><br /> Password: <input type="password" name="password" size="20" /><br /><br /> <input type="submit" name="Submit" value="Login" /> </form> </body> </html> [/code] When entered without information it doesn't display any information and goes right to login.php?do=new . Thanks!
  23. When fields left blank it does not show error. Also how is it possible when successful login to have a page that says "Successful Login" and then redirect to another. Here is main code: [code] <?php //login page session_start(); require ("config.php"); switch (@$_POST['do'] ) { case "new": //if entered blank form returns error foreach ($_POST as $field => $value) { if ($value == "") { $blanks[] = $field; } }     if (isset ($blanks) ) { $message = "The following fields are blank.     Please enter the required information: "; foreach ($blanks as $value) { $message .= "$value, "; } extract ($_POST); include ("login_form.php"); exit(); } $sql = "SELECT username FROM members WHERE username='$_POST[username]'"; $rs = mysql_query($sql, $con) or die ("Couldn't execute query."); $num = mysql_num_rows($rs); if ($num > 0) // login name found! { $sql = "SELECT username From members WHERE username='$_POST[username]' AND password=md5('$_POST[password]')"; $result2 = mysql_query($sql,$con)                 or die ("Couldn't execute query 2."); $num2 = mysql_num_rows ($result2); if ($num > 0) //correct passy { $_SESSION['auth'] = "yes"; $logname=$_POST['username']; $_SESSION['logname'] = $logname; $today = date("Y-m-d h:i:s"); $sql = "INSERT INTO Login (loginName, loginTime)       VALUES ('$logname', '$today')"; $result = mysql_query ($sql, $con) or die ("Couldn't execute query"); header ("Location: members.php"); }       else {   $message = "The Login Name, '$_POST[username]' exists, but you have not entered the correct password!<br/>";   include ("login_form.php"); } } elseif ($num == 0) { $message = "Login Name does not exist"; include ("login_form.php"); } break; default: include ("login_form.php"); } ?> [/code] Login Form: [code] <html> <head> <title>Member Login</title> </head> <body> <h1>Member Login:</h1><br /> <?php     if (isset ($message) ) { print " $message "; } ?> <form action="login.php?do=new" method="POST"> Member ID: <input type="text" name="<?php print $username ?>" size="20" /><br /><br /> Password: <input type="password" name="<?php print $password ?>" size="20" /><br /><br /> <input type="hidden" name="do" value="new"> <input type="submit" name="log" value="Log In" /> </form> </body> </html> [/code] Thanks!
×
×
  • 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.