Jump to content

Fenhopi

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Everything posted by Fenhopi

  1. Hi, I want the user to be able to go to one page and hit a button, once he hits the butten I want a count down to start from 10 minutes. When the user goes to the page within those 10 minutes, I want it to show him a live countdown until those ten minutes run out. Any ideas how I would go about doing this?
  2. Thanks, but it didn't work. Here's table structure: CREATE TABLE `wallposts` ( `postid` int(11) NOT NULL AUTO_INCREMENT, `message` varchar(1000) DEFAULT NULL, `byuser` varchar(25) DEFAULT NULL, `dtime` varchar(50) DEFAULT NULL, `stat` int(11) DEFAULT NULL, `person` varchar(25) DEFAULT NULL, PRIMARY KEY (`postid`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1 CREATE TABLE `commentstatus` ( `commentid` int(11) NOT NULL AUTO_INCREMENT, `shairid` int(11) NOT NULL, `message` varchar(250) DEFAULT NULL, `byuser` varchar(50) DEFAULT NULL, `dtime` varchar(50) DEFAULT NULL, `person` varchar(50) NOT NULL, `status` int(4) DEFAULT NULL, PRIMARY KEY (`commentid`) ) ENGINE=MyISAM AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
  3. Hi, I have this join query that's supposed to take the information from both tables, but it only takes from the commentstatus table, any idea why? Query: $GetStatus = "SELECT * FROM commentstatus, wallposts WHERE (commentstatus.status='$Naw' AND commentstatus.person='$username') OR (wallposts.stat='$Naw' AND wallposts.person='$username')";
  4. Hi, I use a script called lightface to bring up a facebook like popon box on my site. window.addEvent('domready',function(){ document.id('sup').addEvent('click',function() { light = new LightFace.IFrame({ height:350, width:640, url: 'editContact.php?user=<? echo $username; ?>', title: 'Edit Contact information!' }).addButton('Close', function() { light.close(); },true).open(); }); }); That's the code I use to load a page in lightface, however I want to create it so that it can retrieve a php value into the site I open in lightface. In my case I'm trying to load a post id. Does anyone have any suggestions how I'd go about doing that?
  5. Ah, I tried this, but it doesn't work: function termsFunction() { box = new LightFace({ title: 'Terms and conditions', width: 400, height: 300, content: " <form method="post" id="start" action="postback.php"> <input type="hidden" name="postbackto" value="<? echo $friendshares['byuser']; ?>"> <input type="hidden" name="postbackfrom" value="<? echo $friendshares['person']; ?>"> <INPUT NAME="post" TYPE="submit" class="submit" value="That's nice" ALT="like"> </form>", buttons: [ { title: 'I Agree', event: function() { box.fade(0.5); var confirm = new LightFace({ width: 200, title: 'Confirm', keys: { esc: function() { this.close(); box.unfade(); } }, content: 'Do you agree?', buttons: [ { title: 'Yes', event: function() { this.close(); box.close(); }, color: 'green' }, { title: 'No', event: function() { this.close(); box.unfade(); } } ] }); confirm.open(); }, color: 'blue' }, { title: 'Close', event: function() { this.close(); } } ] }); box.open(); } Any ideas?
  6. Hi! First of, I want to say that I don't have a lot of knowledge with js, so please bare with me. I have this function: function formFunction() { return new LightFace({ title: $('demo1title').value, content: $('demo1content').value, draggable: true }).open(); } It is a part of a code that displays a small on-page window. However, within that code I want to have a form that posts $('demo1title').value as a hidden value. Any idea how to do this?
  7. Thanks, man. It did what I tried doing but it didn't work out. Because the frame opens over the window I'm in, so what happens is that i click the link, it starts opening the frame, then I get redirected to postback, and I want to stay on the page I am and just retrieve it through the frame. Any idea how to do this?
  8. Hi, I have a script that creates a frame. The script shows a page of my choosing. However, somehow I need to transfer some values like username from one page, to the page that is opened in the frame. To call the frame I use like this: <a href="postback.php" id="start">TEST </a> But the only way I know to transfer values between pages is with forms and $_POST. So I have this form: <form method="post" action="postback.php"> <input type="hidden" name="postbackto" value="<? echo $friendshares['byuser']; ?>"> <input type="hidden" name="postbackfrom" value="<? echo $friendshares['person']; ?>"> <INPUT NAME="post" TYPE="submit" class="submit" id="start" value="That's nice" ALT="like"> </form> So what I'm trying to do is that when I click the link, the form is submitted, the frame opens the postback.php and I can view the info from the form. All help is appreciated!
  9. First of all, the field that holds prefgender does not say "Not added yet". Yet when I do this, it doesn't echo the info: $prefgender = $req_user_info['prefgender']; if(!$prefgender == "Not added yet"){ ?> <tr> <td>Preferred gender:</td> <td><? echo $req_user_info['prefgender'] ?></td> </tr> <? } Any ideas?
  10. Hi, I have an auto suggest that suggests users as I'm typing. The first time I type in the search field, the drop down oddly places itself over to the right side, however when I do another search right after it's in the right place.. The site is:http://shairzy.byethost12.com if you want to see the problem in action (quick sign up required). Here's the CSS i use: #container { width: 150px; margin-right: auto; margin-left: auto; margin-bottom: 0px; padding: 20px; -moz-border-radius: 10px; -webkit-border-radius: 10px; } /* Styling for Suggestion Box Container */ .suggestionsBox { position: absolute; width: 150px; background-color: #212427; border: 2px solid #000; color: #555; padding: 5px; margin-top: 10px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; -moz-border-radius: 8px; -webkit-border-radius: 8px; } #inputString { width: 150px; padding: 5px; } .suggestionList { margin: 0px; padding: 0px; } /* Individual Search Results */ .suggestionList li { margin: 0px 0px 3px 0px; padding: 7px; cursor: pointer; -moz-border-radius: 3px; -webkit-border-radius: 3px; list-style-type: none; } /* Hover effect */ .suggestionList li:hover { background-color: #5cc1dd; font-weight: bold; } HTML part: <form> <div> <h3>Band Name</h3> <input type="text" size="30" value="" id="inputString" onkeyup="lookup(this.value);" onblur="fill();" /> </div> <!-- hide our suggesetion box to begin with--> <div class="suggestionsBox" id="suggestions" style="display: none;"> <img src="upArrow.png" style="position: relative; top: -20px; left: 30px;" alt="upArrow" /> <div class="suggestionList" id="autoSuggestionsList"></div> </div> </form> </div>
  11. Hi, I'm trying to redirect my users to their profile, but can't figure out how to put the function into the link. sethighlightedValue(); is a function that returns the users username. Is there anyway else to do this? Here's what I got: case RETURN: window.location = "profile.php?user="setHighlightedValue(); this.setHighlightedValue(); bubble = false; break;
  12. Hi, I have this code to suggest names from my database to people searching. However, how would I add more info to the result it displays then just firstname and lastname. Like, if i wanted username and email to be displayed under the name? Code: <?php include("include/session.php"); /* note: this is just a static test version using a hard-coded countries array. normally you would be populating the array out of a database the returned xml has the following structure <results> <rs>foo</rs> <rs>bar</rs> </results> */ $GetNames = "SELECT firstname, lastname, username, country FROM users"; $GetNamesConnect = $database->query($GetNames); While($row = mysql_fetch_array($GetNamesConnect)) { $aUsers[] = $row['firstname'] . " " . $row['lastname'] . ", "; } $aInfo = array( "Bedfordshire", "Buckinghamshire", "Cambridgeshire", "Cheshire", "Cornwall", "Cumbria", "Derbyshire", "Devon", "Dorset", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Warwickshire", "West Sussex", "Wiltshire", "Worcestershire", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Warwickshire", "West Sussex", "Wiltshire", "Worcestershire", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Warwickshire", "West Sussex", "Wiltshire", "Worcestershire", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire" ); $input = strtolower( $_GET['input'] ); $len = strlen($input); $aResults = array(); if ($len) { for ($i=0;$i<count($aUsers);$i++) { // had to use utf_decode, here // not necessary if the results are coming from mysql // if (strtolower(substr(utf8_decode($aUsers[$i]),0,$len)) == $input) $aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]) ); //if (stripos(utf8_decode($aUsers[$i]), $input) !== false) // $aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]) ); } } header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 if (isset($_REQUEST['json'])) { header("Content-Type: application/json"); echo "{\"results\": ["; $arr = array(); for ($i=0;$i<count($aResults);$i++) { $arr[] = "{\"id\": \"".$aResults[$i]['id']."\", \"value\": \"".$aResults[$i]['value']."\", \"info\": \"\"}"; } echo implode(", ", $arr); echo "]}"; } else { header("Content-Type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?><results>"; for ($i=0;$i<count($aResults);$i++) { echo "<rs id=\"".$aResults[$i]['id']."\" info=\"".$aResults[$i]['info']."\">".$aResults[$i]['value']."</rs>"; } echo "</results>"; } ?>
  13. I tried that, but for some reason it doesn't show any result.. Any ideas?
  14. Hi, I have this code: <?php /* note: this is just a static test version using a hard-coded countries array. normally you would be populating the array out of a database the returned xml has the following structure <results> <rs>foo</rs> <rs>bar</rs> </results> */ $aUsers = array( "Ädams, Egbert", "Altman, Alisha", "Archibald, Janna", "Auman, Cody", "Bagley, Sheree", "Ballou, Wilmot", "Bard, Cassian", "Bash, Latanya", "Beail, May", "Black, Lux", "Bloise, India", "Blyant, Nora", "Bollinger, Carter", "Burns, Jaycob", "Carden, Preston", "Carter, Merrilyn", "Christner, Addie", "Churchill, Mirabelle", "Conkle, Erin", "Countryman, Abner", "Courtney, Edgar", "Cowher, Antony", "Craig, Charlie", "Cram, Zacharias", "Cressman, Ted", "Crissman, Annie", "Davis, Palmer", "Downing, Casimir", "Earl, Missie", "Eckert, Janele", "Eisenman, Briar", "Fitzgerald, Love", "Fleming, Sidney", "Fuchs, Bridger", "Fulton, Rosalynne", "Fye, Webster", "Geyer, Rylan", "Greene, Charis", "Greif, Jem", "Guest, Sarahjeanne", "Harper, Phyllida", "Hildyard, Erskine", "Hoenshell, Eulalia", "Isaman, Lalo", "James, Diamond", "Jenkins, Merrill", "Jube, Bennett", "Kava, Marianne", "Kern, Linda", "Klockman, Jenifer", "Lacon, Quincy", "Laurenzi, Leland", "Leichter, Jeane", "Leslie, Kerrie", "Lester, Noah", "Llora, Roxana", "Lombardi, Polly", "Lowstetter, Louisa", "Mays, Emery", "Mccullough, Bernadine", "Mckinnon, Kristie", "Meyers, Hector", "Monahan, Penelope", "Mull, Kaelea", "Newbiggin, Osmond", "Nickolson, Alfreda", "Pawle, Jacki", "Paynter, Nerissa", "Pinney, Wilkie", "Pratt, Ricky", "Putnam, Stephanie", "Ream, Terrence", "Rumbaugh, Noelle", "Ryals, Titania", "Saylor, Lenora", "Schofield, Denice", "Schuck, John", "Scott, Clover", "Smith, Estella", "Smothers, Matthew", "Stainforth, Maurene", "Stephenson, Phillipa", "Stewart, Hyram", "Stough, Gussie", "Strickland, Temple", "Sullivan, Gertie", "Swink, Stefanie", "Tavoularis, Terance", "Taylor, Kizzy", "Thigpen, Alwyn", "Treeby, Jim", "Trevithick, Jayme", "Waldron, Ashley", "Wheeler, Bysshe", "Whishaw, Dodie", "Whitehead, Jericho", "Wilks, Debby", "Wire, Tallulah", "Woodworth, Alexandria", "Zaun, Jillie" ); $aInfo = array( "Bedfordshire", "Buckinghamshire", "Cambridgeshire", "Cheshire", "Cornwall", "Cumbria", "Derbyshire", "Devon", "Dorset", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Warwickshire", "West Sussex", "Wiltshire", "Worcestershire", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Warwickshire", "West Sussex", "Wiltshire", "Worcestershire", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire", "Oxfordshire", "Shropshire", "Somerset", "Staffordshire", "Suffolk", "Surrey", "Warwickshire", "West Sussex", "Wiltshire", "Worcestershire", "Durham", "East Sussex", "Essex", "Gloucestershire", "Hampshire", "Hertfordshire", "Kent", "Lancashire", "Leicestershire", "Lincolnshire", "Norfolk", "Northamptonshire", "Northumberland", "North Yorkshire", "Nottinghamshire" ); $input = strtolower( $_GET['input'] ); $len = strlen($input); $aResults = array(); if ($len) { for ($i=0;$i<count($aUsers);$i++) { // had to use utf_decode, here // not necessary if the results are coming from mysql // if (strtolower(substr(utf8_decode($aUsers[$i]),0,$len)) == $input) $aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]) ); //if (stripos(utf8_decode($aUsers[$i]), $input) !== false) // $aResults[] = array( "id"=>($i+1) ,"value"=>htmlspecialchars($aUsers[$i]), "info"=>htmlspecialchars($aInfo[$i]) ); } } header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified header ("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header ("Pragma: no-cache"); // HTTP/1.0 if (isset($_REQUEST['json'])) { header("Content-Type: application/json"); echo "{\"results\": ["; $arr = array(); for ($i=0;$i<count($aResults);$i++) { $arr[] = "{\"id\": \"".$aResults[$i]['id']."\", \"value\": \"".$aResults[$i]['value']."\", \"info\": \"\"}"; } echo implode(", ", $arr); echo "]}"; } else { header("Content-Type: text/xml"); echo "<?xml version=\"1.0\" encoding=\"utf-8\" ?><results>"; for ($i=0;$i<count($aResults);$i++) { echo "<rs id=\"".$aResults[$i]['id']."\" info=\"".$aResults[$i]['info']."\">".$aResults[$i]['value']."</rs>"; } echo "</results>"; } ?> The $aUsers array, I want to fill with names taken from: $GetNames = "SELECT firstname, lastname, username, country FROM users"; $GetNamesConnect = $database->query($GetNames); $row = mysql_fetch_array($GetNamesConnect) echo $row['firstname'] . " " . $row['lastname'];
  15. Hi, I cant quite figure out how to assign an unique id to the picture I upload to my page, all help would be appreciated. Here's the upload code: //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()) ; mysql_select_db("Database_Name") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?>
  16. I have the time time now viewed as 17:11. The time $Start_Time is 17:00. The time $End_time is 18:00. Can I use this to check if time is in between starttime and endtime? Or do I have to convert it to other formats before it understand that I'm comparing it as times and not just numbers? if($Start_Time < $Now_time && End_Time > $Now_time){ }
  17. When start time is 09:00 and end time is 10:00, time now is 09:30. It's supposed to echo my current class, instead it echos "no class"
  18. Hi! I have this to check if now is between start time and end time: [date_default_timezone_set('Europe/Belgrade'); $TimeNow = date("H:i" ,time()); $today_date = date('d-m-y'); $GetTimeTable = "SELECT * FROM timetable WHERE username='$username' AND Subject_date='$today_date'"; $ConnectTimeTable = $database->query($GetTimeTable); $TimeTable = mysql_fetch_array($ConnectTimeTable); $Subject = $TimeTable['Subject']; $Start_time = $TimeTable['Start_Time']; $End_time = $TimeTable['End_Time']; ?><br><? if($TimeNow >= $Start_time && $TimeNow <= $End_time){ echo "Current Class: "; echo $Subject; echo "<br><br>"; // a START time value $start = $TimeNow; // an END time value $end = $End_time; // what is the time difference between $end and $start? if( $diff=@get_time_difference($start, $end) ) { echo "Time left: " . sprintf( '%02d:%02d', $diff['hours'], $diff['minutes'] ); } else { echo "Hours: Error"; } } else{ echo "No class. "; } Start time and end time is displayed in the format like 14:26. For some reason this code doesn't work though, I don't get why.
  19. I have this query to show the current class I'm in: $GetTimeTable = "SELECT * FROM timetable WHERE username='$username' AND Subject_date='$today_date'"; Then I have this to display current class: if($TimeNow >= $Start_time && $TimeNow <= $End_time){ echo "Current Class: "; echo $Subject;} How would I find next class that day?
  20. Thank you! I get this error though: Warning: move_uploaded_file(images/upload/p_00035.jpg) [function.move-uploaded-file]: failed to open stream: Permission denied in /Users/Fenhopi/Sites/add.php on line 18 Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/private/var/tmp/phpsUIf4H' to 'images/upload/p_00035.jpg' in /Users/Fenhopi/Sites/add.php on line 18 Sorry, there was a problem uploading your file. Any idea why?
  21. Here's the upload script: <?php //This is the directory where images will be saved $target = "images/"; $target = $target . basename( $_FILES['photo']['name']); //This gets all the other information from the form $name=$_POST['name']; $email=$_POST['email']; $phone=$_POST['phone']; $pic=($_FILES['photo']['name']); // Connects to your Database mysql_connect("your.hostaddress.com", "username", "password") or die(mysql_error()) ; mysql_select_db("Database_Name") or die(mysql_error()) ; //Writes the information to the database mysql_query("INSERT INTO `employees` VALUES ('$name', '$email', '$phone', '$pic')") ; //Writes the photo to the server if(move_uploaded_file($_FILES['photo']['tmp_name'], $target)) { //Tells you if its all ok echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded, and your information has been added to the directory"; } else { //Gives and error if its not echo "Sorry, there was a problem uploading your file."; } ?> Wouldn't I need a username pw for it access images, where it's supposed to upload it? Or does it simply upload it to a file called images in the same folder as the upload.php is in? Thank you!
  22. Hello, thanks for replying! Hm, yes, a clarification would be nice. I tried putting the javascript on the outside of the loop, but it still won't load anything else than the last one..
  23. Hi, I have a loop that I run to retrieve all wall posts. Each post, I want to start with textbox hidden. I have a javascript code for that, but it only does it with the last post in the loop. Is there a good solution for this? Code: while($something = $something){ <table> <tr> <td> echo $wallpost; </td> </tr> <script type="text/javascript"> window.onload = hide_box(); function hide_box(){ document.getElementById('myText').style.visibility='hidden'; } </script> <form name="myForm" id="form1" method="post"> <input type="text" name="comments" id="myText" value="Enter in Text" onclick="this.value='';"/> </form> </table> }
×
×
  • 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.