Jump to content

pocobueno1388

Members
  • Posts

    3,369
  • Joined

  • Last visited

    Never

Everything posted by pocobueno1388

  1. darkfreaks - What does that have to do with anything asked? md5() is a one way street, you can't decrypt it, at least not provided by PHP.
  2. Well, you have to give the session a value. I'm guessing the value would be the users username...If you don't want to assign a value to it, just do this: $_SESSION['username'] = TRUE; The value of the session is what would be displayed if you echoed it out.
  3. Replace this line: session_register('username'); with: $_SESSION['username'] = "Value"; That *might* get rid of the error. Your registering your session the deprecated way.
  4. I think it's: javascript:history.go
  5. It's okay that the items will have different names, that one query will take care of ALL of them. Did you try it?
  6. <?php $result = mysql_query("SELECT rank FROM users WHERE username = '$username'"); $row = mysql_fetch_assoc($result); if ($row['rank'] == "admin") { echo "You are an admin."; }else{ echo "You are not an admin"; echo $row['rank']; } ?>
  7. Yes, it is because you are including it twice. Why not just include the one file that has both the files you need in it at the top of the page, then get rid of the include that you call on all your pages since that is already included in the other file?
  8. Just do a query that will group the items together by name. <?php $query = mysql_query("SELECT count(name) as amount, image FROM items WHERE ownerID='$ownerID' GROUP BY name")or die(mysql_error()); //display them while ($row = mysql_fetch_assoc($query)){ echo '<img src="'.$row['image'].'"><br>'; echo '<b>Amount:</b>:'.$row['amount'].'<p>'; } ?>
  9. Yes, those should both be before any output. All the "doctype" stuff is considered output to the browser
  10. Try this: <?php session_start(); if (!$_SESSION["valid_user"]) { // User not logged in, redirect to login page header("location:login.php"); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Admin</title> <link href="/mainstyle.css" rel="stylesheet" type="text/css" /> <link rel="shortcut icon" href="favicon.ico" /> </head> <body> <center> <table width="895" height="134" style="background-image:url(/Untitled-3.gif)"> <tr> <th width="99"><a href="/index.shtml"><img src="/logotrans3.gif" alt="logoSAR" width="118" height="126" border="0" />[/url]</th> <th width="782" height="128" scope="col"><a href="/index.shtml"><img src="/SARtitle2.gif" alt="sartitle" width="656" height="82" border="0" />[/url]</th> </tr> </table> <table width="895" height="822"> <tr> <td width="140" height="806" valign="top"><table width="140" height="232" border="0"> <tr> <th width="134" height="22" scope="row"><div align="left">Home-</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">About-</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">Current News-(<a href="admin/newsedit.php">edit[/url])</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">Calendar-(<a href="admin/caledit.php">edit[/url])</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">Photos In Action-(<a href="admin/picedit.php">add/edit[/url])</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">Videos-(<a href="admin/videdit.php">add/edit[/url])</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">SAR Links-(<a href="admin/linksedit.php">edit[/url])</div></th> </tr> <tr> <th height="22" scope="row"><div align="left">Apply-</div></th> </tr> <tr> <th height="20" scope="row"><div align="left">Contact-</div></th> </tr> </table></td> <td width="642" align="center" valign="top"> <div class="img"> <p>Admin Page </p> </div> </td> <td width="97" align="left" valign="top"> <? // Display last login date // Display logout link echo "<p><a href=\"logout.php\">logout[/url]</p>"; ?> </td> </tr> </table> <table width="895" height="57"> <tr> <th height="51" style="border:none"><h6>Home | About | News | Calendar | Photos | Videos | Links | Apply | Contact</h6> <h6>Copyright 2007 FrameWorks Studios [email]admin@fresnosar.com[/email]. All rights reserved.</h6></th> </tr> </table> </center> </body> </html>
  11. It's probably giving you an error because the header function has to be used before any output to the browser. Post your code and we can help you figure out where to put it.
  12. Sasa - That shouldn't be necessary, we aren't working with fractions or decimals. All they needed to do was place this code: if ($i == $split_num) echo '</td><td>'; at the beginning of the while loop, that should fix everything. That is what I did to the code in my last post.
  13. Yes, it would return "hi", but to get that returned value, you need to assign it a variable. <?php function testing(){ $message = "hi"; return $message; } $text = testing(); echo $text; ?>
  14. EDIT: Oops, nevermind...haha. This should do the trick: <?php include("admin/dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM profiles WHERE ap=1"; $result=mysql_query($query); $num=mysql_num_rows($result); $split_num = $num/2; $i=0; echo '<table width="100%"><td>'; while ($i < $num) { $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $displayname=mysql_result($result,$i,"displayname"); $pictureurl=mysql_result($result,$i,"pictureurl"); if ($i == $split_num) echo '</td><td>'; ?> <b>Name:</b> <? echo "$displayname"; ?> <br> <img src="<? echo "$pictureurl"; ?>"> <p> <?php $i++; } echo '</td></table>'; ?>
  15. EDIT: Okay, try it now. Oops, try this: <?php include("admin/dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM profiles WHERE ap=1"; $result=mysql_query($query); $num=mysql_num_rows($result); $split_num = $num/2; $i=0; echo '<table width="100%"><td>'; while ($i < $num) { $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $displayname=mysql_result($result,$i,"displayname"); $pictureurl=mysql_result($result,$i,"pictureurl"); ?> <b>Name:</b> <? echo "$displayname"; ?> <br> <img src="<? echo "$pictureurl"; ?>"> <p> <?php if ($i == $split_num) echo '</td><td>'; $i++; } echo '</td></table>'; ?>
  16. Give this a try: <?php include("admin/dbinfo.inc.php"); mysql_connect(localhost,$username,$password); @mysql_select_db($database) or die( "Unable to select database"); $query="SELECT * FROM profiles WHERE ap=1"; $result=mysql_query($query); $num=mysql_num_rows($result); $num = $num/2; $i=0; while ($i < $num) { $first=mysql_result($result,$i,"first"); $last=mysql_result($result,$i,"last"); $displayname=mysql_result($result,$i,"displayname"); $pictureurl=mysql_result($result,$i,"pictureurl"); ?> <table width="100%"> <td> <b>Name:</b> <? echo "$displayname"; ?> <br> <img src="<? echo "$pictureurl"; ?>"> <p> <?php if ($i == $num) echo '</td><td>'; $i++; } echo '</td></table>'; ?>
  17. Theres no need to post your problem twice...I responded on your other topic.
  18. Are those the entire files? You had to have included another page somewhere in the script with the include() or require_once() function.
  19. The header function has to be called before any output to the browser. If you post your code to that script, we can help you place it in the correct spot.
  20. phpSensei - Ken wants to check if their is a number IN the string, not if the entire variable is numeric or not. Thats why is_numeric won't work for the situation. The code probably ended up being something like this: <?php $str = "dsffdaf"; $str = str_split($str); foreach ($str as $char){ if (is_numeric($char)){ $nums = TRUE; break; } } if (isset($nums)){ echo "The string contained a number."; } else { echo "The string has NO numbers."; } ?>
  21. Give this a try: <?php session_start(); if (isset($_POST['houselist'])){ $houselist = $_POST['houselist']; //set the session $_SESSION['houselist'] = $houselist; //check if it worked if (isset($_SESSION['houelist'])){ echo 'Session set!<br>'; echo $_SESSION['houselst']; } } $soldhousesquery = "SELECT Price, HouseType FROM soldhouses ORDER BY Price ASC"; $soldhousesresult = @mysql_query($soldhousesquery) or die(mysql_error()); echo '<form action="'.$_SERVER['PHP_SELF'].'" method="post"> <select name="houselist" size=10>">'; while($soldhousesrow = mysql_fetch_array($soldhousesresult)) { echo "<option value=\"{$soldhousesrow['Price']}|{$soldhousesrow['HouseType']}\">£ {$soldhousesrow['Price']} - {$soldhousesrow['HouseType']}</option>"; } echo '</select></form>'; ?> Remember to call session_start() on all the pages you want the session to continue to.
  22. Your going to have to give a lot more detail than that for anyone to be able to help you. By that do you mean you are wanting to select a row from a different table in the same query? If thats the case, the two tables have to relate in some way...give more information on the table your trying to get the row from.
  23. Give this method a try: <html><body> TABLES TEST<BR> <H3>Group A</H3> <?php $conn=mysql_connect("localhost", "server", "password") or die("could not connect"); $rs=mysql_select_db("database", $conn)or die("could not connect to database"); $sql=stripslashes("SELECT `stage`,`team`,`p`,`pts`,`w`,`d`,`l`,`gf`,`ga`, (gf - ga) AS 'gd' FROM `lgtables` WHERE `stage` LIKE 'GP A' ORDER BY 'pts' desc, 'gd' desc"); $num = mysql_num_rows($sql); $rs=mysql_query($sql,$conn) or die("could not execute query because ".mysql_error()); $list="<table border=\"1\" cellpadding=\"2\">"; $list.="<tr><th>Team</th>"; $list.="<th>P</th>"; $list.="<th>PTS</th>"; $list.="<th>W</th>"; $list.="<th>D</th>"; $list.="<th>L</th>"; $list.="<th>GF</th>"; $list.="<th>GA</th>"; $list.="<th>GD</th></tr>"; for ($i=1; $i<$num; $i++) { $row = mysql_fetch_assoc($sql); if ($i == 1 || $i == 2) $bg = '#ffcc99'; else if ($i == 3 || $i == 4) $bg = '#ffcc66'; else $bg = 'white'; $list.="<tr bgcolor=\"$bg\">"; $list.="<td><b>".$row["team"]."</b></td>"; $list.="<td><center><b>".$row["p"]."</b></center></td>"; $list.="<td><center><b>".$row["pts"]."</b></center></td>"; $list.="<td><center>".$row["w"]."</center></td>"; $list.="<td><center>".$row["d"]."</center></td>"; $list.="<td><center>".$row["l"]."</center></td>"; $list.="<td><center>".$row["gf"]."</center></td>"; $list.="<td><center>".$row["ga"]."</center></td>"; $list.="<td><center><b>".$row["gd"]."</b></center></td>"; $list.="</tr>"; } $list.="</table>"; echo($list); ?> </body></html>
×
×
  • 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.