Jump to content

jesushax

Members
  • Posts

    498
  • Joined

  • Last visited

    Never

Everything posted by jesushax

  1. ok can you do the below changes echo "<p>This is the Message:".$message."</p>"; //header( "Location: http://www.markarma.com" ); exit(); where commenting out the header so we can see whats posted from the message can you post the output of this is the message.. Thanks
  2. try this XHTML strict option for your html and better formatting for your php HTML <form method="post" action="sendmail.php"> Your Name: <br /> <input type="text" name="YourName" /> Email: <br /> <input name="email" type="text"><br> Message: <br /> <textarea name="message"></textarea><br> <input type="submit"> </form> <?php $to = "mark@markarma.com"; $subject = "This is the subject of the email"; $message = " <html> <head> <title>HTML email</title> </head> <body>"; $message .= "Message From:"; $message .= $_POST["YourName"]; $message .= "Message:"; $message .= $_POST["message"]; $message .= "From: "; $message .= $_POST["email"]; $message .= " </body> </html> ";// Always set content-type when sending HTML email $headers = "MIME-Version: 1.0" . "\r\n"; $headers .= "Content-type:text/html;charset=iso-8859-1" . "\r\n"; $headers .= 'From: <$email>' . "\r\n"; mail($to,$subject,$message,$headers); header( "Location: http://www.markarma.com" ); exit(); ?>
  3. then when you click b it would be 1 2 3 4 5 of B's ?
  4. glad we go there in the end, no dont think they have rep system here, its no trouble though glad i could help really Alex
  5. ok put session_start(); at the top of the checklogin.php and then lets try it all again hopefully have this sorted
  6. if i used both though wouldnt it confuse a user? or do you mean like pages for the letter A which i would obviously need so it could be A B C D E... then after clicking a letter EG A Pg 1 2 3 4 of As that would be more effcient yes?
  7. no i dont need to add anything else to them its just as it is its just when browsing, the A's always come first and i guess not all companies are getting full exposure so would you suggest leaving it as is, becuase thats what they expect or doing as laffin said? i could swap pagnation for alphabetical? eg. A B C D instead of Page 1 2 3 4 what you think?
  8. firstly id craete a include file and keep my db connection info in there connection.php <?php $uname = 'eevoke_admin2'; $pass = '3T4JI2ny2QFp'; $db_name = 'eevoke_ostube'; $host = 'localhost'; $con = mysql_connect($host, $uname, $pass); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($db_name, $con); if (!$db_selected) { die ('Can\'t use database : ' . mysql_error()); } ?> then at the top of all the pages you use a database on include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); that will save you copy and pasting your db connection all the time, and stop you accidently posting yoru login details on a public forum, lucky your db is stored locally your problem lies with some xml your using or including elsewhere do you want to just write the information to a page or do you have formatting to it grabbed elsewhere?
  9. as pointed out by thorpe <?php while($r=mysql_fetch_array($resultID)) { $album=$r["media_id"]; $title=$r["media_title"]; }// move this fella echo "<player showDisplay='yes' showPlaylist='yes' autoStart='yes'>\n"; {echo "<song path='$album' title='$title'/>";} echo "</player>\n"; }//down here ?>
  10. my code below, if i order by RAND everytime i click page 2 or 3 then another random set or results are gonna be displayed instead of the first queries results <?php session_start(); include($_SERVER['DOCUMENT_ROOT'] . '/includes/directory_header.php'); $Trade = urldecode($_GET["Trade"]); $max = 10; $p = @$_GET['p']; if(empty($p)){ $p = 1; } $limits = ($p - 1) * $max; $SQL = mysql_query("SELECT * FROM tblDirectory2 WHERE Sect1_2 LIKE '%$Trade%' ORDER BY Sect1_4 ASC LIMIT ".$limits.",$max") or die (mysql_error()); $totalres = mysql_result(mysql_query("SELECT COUNT(CompanyID) AS tot FROM tblDirectory2 WHERE Sect1_2 LIKE '%$Trade%' "),0); $totalpages = ceil($totalres / $max); ?> <div id="navigation"> <div style="float:left;"><?php echo $Trade; ?></div> <div style="float:right;"> <strong>Page:</strong> <?php for($i = 1; $i <= $totalpages; $i++){ echo "<a href='".$_SERVER['PHP_SELF']."?Trade=".urlencode($Trade)."&p=$i'>$i</a>\n"; } ?> </div> <div style="float:right; width:375px; text-align:left;"> <a class="boldlink" href="/new_directory/contents.php">Directory Contents</a> | <a class="boldlink" href="/default.php">Main Website</a> </div> </div> <?php if (mysql_num_rows($SQL) <1) { echo "<p>Sorry there are currently no members under the category $Trade, <a href=\"/new_directory/contents.php\">click here</a> to go back to the contents</p>\n"; } else { while ($row = mysql_fetch_array($SQL)) { ?> <div class="trade"> <h3><a href="record.php?title=<?php echo urlencode($TTitle)."&T=".$T."&ID=".$row["CompanyID"]; ?>"><?php echo $row["Sect1_4"]?></a></h3> <div class="trade-left"> <table width="100%" border="0"> <tr> <td style="width:29%" class="top-right"><strong> </strong></td> <td style="width:71%"><?php echo $row["Sect1_7a"]."<br />\n"; echo $row["Sect1_7b"]."<br />\n"; echo $row["Sect1_7c"]."<br />\n"; echo $row["Sect1_7d"]."\n"; ?></td> </tr> <tr> <td class="right">Tel:<strong> </strong></td> <td><strong><?php echo $row["Sect1_5"]?></strong></td> </tr> <tr> <td class="right">CHAS: </td> <td><?php echo YN($row["Sect1_10"])?></td> </tr> </table> </div> <div class="trade-right"> <table width="100%" border="0"> <tr> <td class="right">Pl Insurance Cover: </td> <td>£<?php echo $row["Sect2_1"]?></td> <td class="right">El insurance Cover: </td> <td>£<?php echo $row["Sect2_2"]?></td> </tr> <tr> <td class="right">Risk insurance Cover: </td> <td><?php echo $row["Sect2_3"]?></td> <td> </td> <td> </td> </tr> <tr> <td class="right">Planning Supervisor Indemnity: </td> <td>£<?php echo $row["Sect2_5"]?></td> <td class="right">Design Work Indemnity: </td> <td>£<?php echo $row["Sect2_4"]?></td> </tr> <tr> <td class="right">Turnover for Previous Year: </td> <td><?php echo $row["Sect3_3"]?></td> <td class="right">CIS Type: </td> <td><?php echo $row["Sect3_5"]?></td> </tr> <tr> <td colspan="4" class="right" style="padding:3px 0;"><a href="record.php?Trade=<?php echo urlencode($Trade)."&ID=".$row["CompanyID"]; ?>" style="color:#CC0033;">Full Company Details</a></td> </tr> </table> </div> </div> <?php } } ?> <div class="clear"></div> <div id="lower-navigation"> <strong>Page:</strong> <?php for($i = 1; $i <= $totalpages; $i++){ echo "<a href='".$_SERVER['PHP_SELF']."?Trade=".urlencode($Trade)."&p=$i'>$i</a>\n"; } ?> </div> <?php include($_SERVER['DOCUMENT_ROOT'] . '/includes/footer.php'); ?>
  11. hi all, im after some ideas on how to order a directory of companies, at the moment they are ordered by alphabetical company name A-Z with pagnation of 10 to a page. thing is that doing that, only the companies beginging with A are going to get first page exposure when users are searching the directory can anyone think of a fairer way to do this so all compaines get some exposure? i cant use RAND as im using pagnation on clicking page 2 you would get a completely new random set of companies Thanks for any help i know this is a tough one
  12. sorry for long reply hope your still around so i can help... that page is fine then just delete the two echo statments and remove the two // from the header redirect just notice on the members_page.php my fault change it to this <?php session_start(); $ID = $_SESSION["ID"]; $selected = mysql_query("SELECT * FROM members WHERE id='$ID'") or die(mysql_error()); if (mysql_num_rows($selected) > 0) { while ($user = mysql_fetch_array($selected)) { echo "Username: ".$user["username"]."<br />"; echo "Email: ".$user["email"]."<br />"; echo "Level: ".$user["level"]."<br />"; echo "Health: ".$user["health"]."<br />"; echo "Strength: ".$user["strength"]."<br />"; echo "Agility: ".$user["agility"]."<br />"; echo "Intellect: ".$user["intellect"]."<br />"; echo "Main Hand: ".$user["main_hand"]."<br />"; echo "Off Hand: ".$user["off_hand"]."<br />"; echo "Class: ".$user["class_armor"]."<br />"; } }else { echo "<p>Sorry there are no results for this person</p>"; } ?> then let me know if it works? Cheers
  13. right this means we dont have a session ID, the memebers area page is fine for now we need to go back to the checklogin see whats happening there replace this your checklogin with this one <?php include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT id FROM members WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql) or die(mysql_error()); //below we check for results then if we have results set sessions, if not write the error if (mysql_num_rows($result) > 0) { $user = mysql_fetch_array($result); $_SESSION["ID"] = $user["id"];//here we get the users ID echo "<p>SQL IS:".$sql."</p>"; echo "<p>USER ID IS:".$user["id"]."</p>"; //header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> then post the SQL IS: and the USER ID IS: results CHeers
  14. no probs, copy and paste this in there with your username and pass <?php $uname = ''; $pass = ''; $db_name = 'test'; $host = 'localhost'; $con = mysql_connect($host, $uname, $pass); if (!$con){ die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($db_name, $con); if (!$db_selected){ die ('Can\'t use database : ' . mysql_error()); } ?> [\code]
  15. right ok then then there is no id for that person have you inserted any data into the tabe? do the fields have values? for starts lets make sure the session ID has a value in members area add this after $ID = $_SESSION["ID"]; echo "<p>The Current Session ID is:".$ID."</p>"; then tell me if there is a number after the : when you preview the page
  16. have you created connection.php and filed in your details connection.php ?php $uname = ''; $pass = ''; $db_name = 'test'; $host = 'localhost'; $con = mysql_connect($host, $uname, $pass); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($db_name, $con); if (!$db_selected) { die ('Can\'t use database : ' . mysql_error()); } ?> oops and my bad under members_area.php after the session_start(); put this include($_SERVER['DOCUMENT_ROOT'] . '/connection.php');
  17. ok firstly we now need to include the IDs into a session also we will include a loop that will tell us if there has been any results reutned so back to checklogin.php here we go tell me what comes up... checklogin.php <?php include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); // username and password sent from form $myusername=$_POST['myusername']; $mypassword=$_POST['mypassword']; // To protect MySQL injection (more detail about MySQL injection) $myusername = stripslashes($myusername); $mypassword = stripslashes($mypassword); $myusername = mysql_real_escape_string($myusername); $mypassword = mysql_real_escape_string($mypassword); $sql="SELECT id FROM members WHERE username='$myusername' and password='$mypassword'"; $result=mysql_query($sql) or die(mysql_error()); //below we check for results then if we have results set sessions, if not write the error if (mysql_num_rows($result) > 0) { $user = mysql_fetch_array($result); $_SESSION["ID"] = $user["id"];//here we get the users ID header("location:login_success.php"); } else { echo "Wrong Username or Password"; } ?> members_area.php <?php session_start(); $ID = $_SESSION["ID"]; $selected = mysql_query("SELECT * FROM members WHERE id='$ID'") or die(mysql_error()); if (mysql_num_rows($selected) > 1) { while ($user = mysql_fetch_array($selected)) { echo "Username: ".$user["username"]."<br />"; echo "Email: ".$user["email"]."<br />"; echo "Level: ".$user["level"]."<br />"; echo "Health: ".$user["health"]."<br />"; echo "Strength: ".$user["strength"]."<br />"; echo "Agility: ".$user["agility"]."<br />"; echo "Intellect: ".$user["intellect"]."<br />"; echo "Main Hand: ".$user["main_hand"]."<br />"; echo "Off Hand: ".$user["off_hand"]."<br />"; echo "Class: ".$user["class_armor"]."<br />"; } }else { echo "<p>Sorry there are no results for this person</p>"; } ?>
  18. does your database have all the fiels names, username, email etc in the table test? and do they have data in? is there more than one record in the table aswell? if so you will need to use a unique identifier to distingush which persons stats to display a few notes you may want to create a connection.php and have your database info in there then include it on your pages, will save you tpying it out over and over eg. connection.php <?php $uname = ''; $pass = ''; $db_name = 'test'; $host = 'localhost'; $con = mysql_connect($host, $uname, $pass); if (!$con) { die('Could not connect: ' . mysql_error()); } $db_selected = mysql_select_db($db_name, $con); if (!$db_selected) { die ('Can\'t use database : ' . mysql_error()); } ?> then at the top of your pages use include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); e.g. <?php session_start(); include($_SERVER['DOCUMENT_ROOT'] . '/connection.php'); $myusername = $_SESSION["username"]; $mypassword = $_SESSION["password"]; $selected = mysql_query("SELECT * FROM members WHERE username='$myusername' and password='$mypassword'") or die(mysql_error()); $user = mysql_fetch_array($selected); echo "Username: ".$user["username"]."<br />"; echo "Email: ".$user["email"]."<br />"; echo "Level: ".$user["level"]."<br />"; echo "Health: ".$user["health"]."<br />"; echo "Strength: ".$user["strength"]."<br />"; echo "Agility: ".$user["agility"]."<br />"; echo "Intellect: ".$user["intellect"]."<br />"; echo "Main Hand: ".$user["main_hand"]."<br />"; echo "Off Hand: ".$user["off_hand"]."<br />"; echo "Class: ".$user["class_armor"]."<br />"; ?> [\code] makes things easier to manage and quicker too
  19. right heres your whole page for members_area.php fixed now it should work let me know the results <?php session_start(); $host="localhost"; // Host name $username=""; // Mysql username $password=""; // Mysql password $db_name="test"; // Database name $tbl_name="members"; // Table name $myusername = $_SESSION["username"]; $mypassword = $_SESSION["password"]; $con = mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $selected = mysql_query("SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'") or die(mysql_error()); $user = mysql_fetch_array($selected); echo "Username: ".$user["username"]."<br />"; echo "Email: ".$user["email"]."<br />"; echo "Level: ".$user["level"]."<br />"; echo "Health: ".$user["health"]."<br />"; echo "Strength: ".$user["strength"]."<br />"; echo "Agility: ".$user["agility"]."<br />"; echo "Intellect: ".$user["intellect"]."<br />"; echo "Main Hand: ".$user["main_hand"]."<br />"; echo "Off Hand: ".$user["off_hand"]."<br />"; echo "Class: ".$user["class_armor"]."<br />"; ?>
  20. start the process from the begining again but on the checklogin.php change create $_SESSION["username"] = stripslashes($myusername); create $_SESSION["password"] = stripslashes($mypassword); To This $_SESSION["username"] = $myusername; $_SESSION["password"] = $mypassword;
  21. see the post above, add the session_start(); line and then post the results again if it doesnt work Cheers
  22. just noticed, you forgot to start the session on the members page <?php session_start(); //add this line here $host="localhost"; // Host name
  23. can you add echo "<p>".$selected."</p>"; in the postition below and post what it says $con = mysql_connect("$host", "$username", "$password")or die("cannot connect"); mysql_select_db("$db_name")or die("cannot select DB"); $selected = "SELECT * FROM $tbl_name WHERE username='$myusername' and password='$mypassword'"; echo "<p>".$selected."</p>"; $user = mysql_fetch_array($selected); cheers
  24. you forgot to close the variables add ; to the end after the ] $myusername = $_SESSION["username"]; $mypassword = $_SESSION["password"]; cheers
  25. can you post your code for the members_area.php page cheers
×
×
  • 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.