Jump to content

chris_s_22

Members
  • Posts

    77
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

chris_s_22's Achievements

Member

Member (2/5)

0

Reputation

  1. didnt know where else to put it
  2. I'm looking into the possibility of adding a new chat with webcam capabilities. I'd like it to be customisable and able to use with my data from mysql. I did a search on google and noticed a lot of sites charge a monthly/annually fee but I don’t think this is what I want. Obviously I like it to be cheap as possible but I don’t mind paying a one off price but I like to have total control so I’m not relying on a 3rd party site. I imagine it will have to involve a java or flash Any advice on how I can achieve this
  3. Can anyone show me or point me in direction of a tutorial that limits search results 1) i want to limit the number of rows that will show up in total eg 500 / 998 so only the 500 can be viewed. 2) i also want to display 10 results per page and have link to next 10 and previous 10 as well as option to jump straight to page ? $result = mysql_query ("SELECT * FROM table_name WHERE column_name LIKE '%$search_entered%' "); $row=mysql_num_rows($result); echo "<table>"; while($row=mysql_fetch_array($result)) { $column1 = $row["column1 "]; $column2 = $row["column2 "]; $column3 = $row["column3 "]; echo "<td>$column1 <td>"; echo "<td>$column2 <td>"; echo "<td>$column3 <td>"; } echo "</table>";
  4. im trying to create a internal mail message system. though I keep running into problems can anyone point me in direction of a good tutorial or help me with mine? so far i got my database. a page that displays list of messages in brief a page that displays list of messages sent in brief now i want to be able to delete messages This is code im using to display messages. i also added a form as i thought i need some kind of checkbox and somedata to be passed then on the maildelete.php im struggling to figure out what i should be checking for and my query <?php include_once 'Connect.php'; //This starts session, connect to database and calls any functions needed $usernameid = $_SESSION['id']; $query = ("SELECT * FROM mail WHERE messageto = '$usernameid' "); $result = mysql_query($query) or die ('failed query.'); $exist = mysql_num_rows($result); if($exist=='0') { echo"You have no mail"; } else { echo "<form action='maildelete.php' method='POST' name='delete'>"; echo "<table border='1' cellspacing='1' cellpadding='1'>"; echo "<tr><td></td><td>FROM</td><td>SUBJECT</td></tr>"; while ($row = mysql_fetch_assoc($result)) { $messagefrom = $row["messagefrom"]; $messagedate = $row["date"]; $subjecttitle = $row["subjecttitle"]; $message = $row["message"]; echo "<tr><td><input name='checkdelete' type='checkbox' value='1'></td>"; echo "<td>$messagefrom</td>"; echo "<td><div align='left'>$subjecttitle</div>"; echo "$message - only want it to display 1st 50 characters...<br>"; echo "<div align='right'>$messagedate</div></td></tr>"; } echo "<tr><td><input type='submit' value='DELETE' name='submit'></td></tr></table></form>"; } ?>
  5. any help is much apreciated this is driving me insane trying to solve this
  6. after more checking i realise if i echo out session data its fine unless it came from the search results the session username is changed So im guessing that my problem is in search.php that somewhere i change the session username so the data been passed to the view.php is wrong This is the search.php <?php include 'Connect.php';?> <html><head><link href="style.css" rel="stylesheet" type="text/css"></head> <body> <div class=navigationbarbox><?php include "navigationbar.php";?></div> <?php if(!isset($_GET[submit])) { // Show the form include 'searchindex.php'; exit; } else { if (empty($_GET['searchone']) )// Check if field empty { // Reshow the form with an error $searchempty_error = 'field empty'; include 'searchindex.php'; exit; } //CHECKS USERNAME if(!preg_match("/^[a-z\d]{1,100}$/i", $_GET[searchone])) { // Reshow the form with an error $searchentery_error = "Invalid search only letters and numbers!<br />"; include 'searchindex.php'; exit; } $result = mysql_query ("SELECT * FROM members WHERE username LIKE '%$searchone%' "); $num=mysql_num_rows($result); if($num>0) { /* start the search result box */ echo '<div class="searchresults">'; echo "<table><tr>"; while($row=mysql_fetch_array($result)) { $userid = $row["id"]; $photo = $row["photo"]; echo "<td><img src='http://myurl.co.uk/NEWTEACH/userimages/$photo' width='100' height='150'><br>"; echo '<a href="profileindex.php?userid='.$userid.'">' . $row['username'] . '</a><br>'; echo '<strong>Location:</strong>' . $row['location'] . '<br>'; echo '<strong>Date of Birth:</strong>' . $row['dob'] . '</td>'; } echo "</tr></table>"; echo '</div>'; //end searchresults div } else { echo '<p>Sorry, your search returned no results!</p>'; } // end if $num } // end isset if ?> <div class=searchresult><?php echo '<strong>You searched for:</strong> ' . $searchone . '<br>'; echo 'There are ' . $num . ' results.'; ?></div> </body> </html>
  7. What else can i do to narrow down and solve the problem. Where is my problem? 1}When i go to my search index page which displays a search form. 2)The data from form is sent to the search.php for checking and displays results without a problem. 3)If i then navigate to another page other than the result links everything is fine HOWEVER.. if i click on one of the result links, it let me navigate to the page and displays fine but doesnt let me navigate away from that page. The session just seems to end so when i try visit any other page it fails on the is_authed function the is_authed function checks session data. THIS IS THE PAGE THAT RESULTS LINKS ARE DIRECTED TO <?php include_once 'Connect.php'; if (!is_authed()) { die ('You are not permitted to view this page, <a href="index.php">click here</a> to go back.'); } ?> <html><head> <link href="style.css" rel="stylesheet" type="text/css"></head> <body> <div class=logo><?php include "logo.php";?></div> <div class=navigationbarbox><?php include "navigationbar.php";?></div> <div class=photo><?php include "profilephoto.php";?></div> <div class=sidelinks><?php include "profilesidelinks.php";?></div> <div class=info><?php include "profileinfo.php";?></div> <div class=footerbox><?php include "footer.php";?></div> </body></html> MY SESSION IS THE FIRST THING IN CONNECT.PHP which also conect to database and calls for any functions needed. the logo just contains <img src="images/logo.jpg" alt="" width="300" height="65"> no php whatso ever the navigation contains my navigation bar this includes connect.php profilesidelinks as the names says is side bar link also inlcudes connect.php profileinfo includes connect.php and just queries database and displays info footer as the name suggest is the footer with links no php whatso ever
  8. silly me in the inner loop i was using same variables as the outter loop ive since changed them im now getting the echo message "You have no friends" even though i know in database there is my connect.php consists of session start, conects to database then calls for the functions page. i use a include to connect.php on each page so a session should be there but ive realised that if i echo out the session id its blank but if i echo out session username it shows the username any advice guys?
  9. i dont think the problem is the is_authed function as ive used this on all my pages i wish to protect without any problem. it basically checks session data if i take out this part and replace with a simple echo statment it works fine which tells me it is this part of the code while ($row = mysql_fetch_assoc($result)) { $friendwithid = $row["friendwith"]; $query = ("SELECT * FROM members WHERE $friendwith = '$friendwithid'"); $result= mysql_query ($query) or die ('Could not query.'); while ($row = mysql_fetch_assoc($result)) { $photo = $row["photo"]; $username = $row["username"]; } echo "<img src='http://www.myurl.co.uk/NEWTEACH/userimages/$photo' width='100' height='150'><br>"; echo"$username<br>"; echo'<a href="friendsdelete.php?userid='.$userid.'">Remove Friend</a>'; }
  10. my connect.php starts the session just so you know i can navigate arround my site fine except when i come to this page. it lets me in but then when i try to leave no matter what page i go to or which page i come from it shows the error !is_authed Also can someone check my code i wasnt sure if i could do a loop within another one <?php include_once 'Connect.php'; if (!is_authed()) { die ('You are not permitted to view this page, <a href="index.php">click here</a> to go back.'); } ?> <html><head><title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css"></head> <body> <div class=logo><?php include "logo.php";?></div> <div class=navigationbarbox><?php include "navigationbar.php";?></div> <div class=welcome> <?php // Checks friends $member = $_SESSION["id"]; $query = ("SELECT * FROM friends WHERE member = '$member'"); $result= mysql_query ($query) or die ('Could not query.'); $exist = mysql_num_rows($result); if($exist=='0') { echo"You have no friends"; } else // if any friends gets { while ($row = mysql_fetch_assoc($result)) { $friendwithid = $row["friendwith"]; $query = ("SELECT * FROM members WHERE $friendwith = '$friendwithid'"); $result= mysql_query ($query) or die ('Could not query.'); while ($row = mysql_fetch_assoc($result)) { $photo = $row["photo"]; $username = $row["username"]; } echo "<img src='http://www.myurl.co.uk/NEWTEACH/userimages/$photo' width='100' height='150'><br>"; echo"$username<br>"; echo'<a href="friendsdelete.php?userid='.$userid.'">Remove Friend</a>'; } } ?> </div> <div class=footerbox><?php include "footer.php";?></div> </body> </html>
  11. would this be consider right? while($row=mysql_fetch_array($result)) { $userid = $row["id"]; echo '<a href="profileindex.php?user_id='$userid'">' . $row['username'] . '</a><br>'; }
  12. the $username is the session data the site im creating so far users can register/login which starts a session user then can upload photos, edit there profiles and view there own profile when they goto view.php user can search for other user this is where im up to. i want a user to be able to, not only search but to click on there name and view there profile when someone uses my search it dispalys some brief users data with a link. if a user clicks on that link i want it to display there data NOT THE SESSION DATA but... i need the script to carry on as it is displaying session data so if a user visit view.php it still views there data I ONLY need to do the above if it came from the search results. im guessing i have to add something to the search results link view.php? this should send data to the view.php then on the view.php do a check to see if it there was any data sent otherwise to do what it was original just im not sure exactly what
  13. when i do a search on the database i display data like so echo '<a href="view.php">' . $row['username'] . '</a>'; if a user clicks on the link of a result it takes them to a page that does includes for each part of a page. This is view.php <?php include_once 'Connect.php'; if (!is_authed()) { die ('You are not permitted to view this page, <a href="index.php">click here</a> to go back.'); } ?> <html><head><title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css"></head> <body> <div class=logo><?php include "logo.php";?></div> <div class=navigationbarbox><?php include "navigationbar.php";?></div> <div class=photo><?php include "image.php";?></div> <div class=sidelinks><?php include "sidebar.php";?></div> <div class=info><?php include "info.php";?></div> <div class=footerbox><?php include "footer.php";?></div> </body></html> the logo,navbar and footer will always be same, however the image, sidebar and info will differ currently each page is coded to display the session users data. this is image.php <?php include_once 'Connect.php'; $thequery = ("SELECT * FROM members WHERE username = '$username' "); $query = mysql_query($thequery) or die ('failed query.'); while ($row = mysql_fetch_assoc($query)) { $photo = $row["photo"]; } ?> <html> <head></head> <body> <img src="http://www.escortellie.co.uk/NEWTEACH/userimages/<?php echo $photo?>" width="100" height="150"> </body> </html> i want it still to display the sesion data but if came from the search to display the data of that user instead which parts and how do i alter my code so this can be acomplished
  14. This is the code i use to upload a photo to a folder and put file name in database. However if someone was to re use the form to change photo id like it so that the old one was deleted How do i do this <?php include 'Connect.php'; if(!isset($_POST[submit])) // checks that the data being recieved came from a POST variable named 'submit' { // if error reshow the form You cannot access this page directly. include 'index.php'; exit; } else { if ((($_FILES["photo"]["type"] == "image/gif") || ($_FILES["photo"]["type"] == "image/jpeg") || ($_FILES["photo"]["type"] == "image/pjpeg")) && ($_FILES["photo"]["size"] < 51000)) { $ext = findexts ($_FILES['photo']['name']) ; //This applies the function to our file $ran = rand () ;//This line assigns a random number to a variable. $ran2 = $ran."."; //adds a . on the end of $ran $target = "images/"; //This is the directory where images will be saved $pic = $ran2.$ext;//This gets information from the form that has since been randomised and checked $target = $target . $ran2.$ext;//This combines the directory, the random file name, and the extension //If everything is ok we try to upload it //Writes the information to the database mysql_query("UPDATE members SET photo = '$pic' WHERE username = '$username'") ; if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { header('Location: index.php'); } else { echo "Sorry, there was a problem uploading your file."; } } else { echo "Invalid file"; } } ?>
  15. would this be ok? $types = array("type/jpg", "type/jpeg", "type/pjpeg", "type/PJPEG", "type/JPG", "typ/JPEG", "type/gif", "type/GIF", "type/png", "type/PNG");if(!in_array($uploaded_type,$types)){ echo "Invlaid file type"; $ok = 0;}
×
×
  • 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.