Jump to content

Fenhopi

Members
  • Posts

    121
  • Joined

  • Last visited

    Never

Everything posted by Fenhopi

  1. Thanks for you reply! But, it didn't work..
  2. Okay, so I have this site mydomain.com. When the user logs on there I want the user to be able to go to forum.mydomain.com without getting logged out. So I've googled this for days, and here's what I've found out: I don't have access to my hosts php.ini file, so I can't change anything there. I've put ini_set("session.cookie_domain", ".mydomain.com"); on top of my session.php file. I've edited the .htaccess in both the forum folder and my root folder to php_value session.cookie_domain ".mydomain.com" . Still, after all this; it's totally random wether the session works on both or not. Sometimes it works, others it doesn't. I think perhaps it usually stops working after I've edited on some files on my site.. but I just have no idea what's wrong.. All help would be appriciated!
  3. Thanks for replying! Okay, I tried this, with no success.. <? include("include/session.php"); ?> <html> <head> <title>Preload Image Page</title> <script language="JavaScript1.1"> <!-- begin hiding /* Preload Image With Update Bar Script (By Marcin Wojtowicz [one_spook@hotmail.com]) Submitted to and permission granted to Dynamicdrive.com to feature script in it's archive For full source code to this script and 100's more, visit http://dynamicdrive.com */ // You may modify the following: var locationAfterPreload = "http://dynamicdrive.com" // URL of the page after preload finishes var lengthOfPreloadBar = 150 // Length of preload bar (in pixels) var heightOfPreloadBar = 15 // Height of preload bar (in pixels) // Put the URLs of images that you want to preload below (as many as you want) <?php $Get_pictures = "SELECT bilde FROM beis"; $Connect_bilde = $database->query($Get_pictures); while($rad = mysql_fetch_array($Connect_bilde)){ $my_array[] = $rad['bilde']; } $nummer = count($my_array); echo "var yourImages = new Array(" . $nummer . ");"; $stab = "0"; while($stab < $nummer){ echo " yourImages[".$stab."]=".$my_array[$stab]."\n"; $stab++; } ?> // Do not modify anything beyond this point! if (document.images) { var dots = new Array() dots[0] = new Image(1,1) dots[0].src = "images/black.gif" // default preloadbar color (note: You can substitute it with your image, but it has to be 1x1 size) dots[1] = new Image(1,1) dots[1].src = "images/blue.gif" // color of bar as preloading progresses (same note as above) var preImages = new Array(),coverage = Math.floor(lengthOfPreloadBar/yourImages.length),currCount = 0 var loaded = new Array(),i,covered,timerID var leftOverWidth = lengthOfPreloadBar%coverage } function loadImages() { for (i = 0; i < yourImages.length; i++) { preImages[i] = new Image() preImages[i].src = yourImages[i] } for (i = 0; i < preImages.length; i++) { loaded[i] = false } checkLoad() } function checkLoad() { if (currCount == preImages.length) { location.replace(locationAfterPreload) return } for (i = 0; i <= preImages.length; i++) { if (loaded[i] == false && preImages[i].complete) { loaded[i] = true eval("document.img" + currCount + ".src=dots[1].src") currCount++ } } timerID = setTimeout("checkLoad()",10) } // end hiding --> </script> </head> <body bgcolor="#FFFFFF"> <center> <font size="4">Please be patient while some images<br> are being preloaded...</font><p> 0% <script language="JavaScript1.1"> <!-- begin hiding // It is recommended that you put a link to the target URL just in case if the visitor wants to skip preloading // for some reason, or his browser doesn't support JavaScript image object. if (document.images) { var preloadBar = '' for (i = 0; i < yourImages.length-1; i++) { preloadBar += '<img src="' + dots[0].src + '" width="' + coverage + '" height="' + heightOfPreloadBar + '" name="img' + i + '" align="absmiddle">' } preloadBar += '<img src="' + dots[0].src + '" width="' + (leftOverWidth+coverage) + '" height="' + heightOfPreloadBar + '" name="img' + (yourImages.length-1) + '" align="absmiddle">' document.write(preloadBar) loadImages() } document.write('<p><small><a href="javascript:window.location=locationAfterPreload">Skip Preloading</a> | <a href="http://dynamicdrive.com/">Script Credits</a></small></p>') // end hiding --> </script> </center> </body> </html>
  4. Hi, I retrieve the pictures I want to display through a php loop that stores them in an array. What I want to do is to get those array values to get recognized by my js preloading script. Any tips how I'd do that? Here's my code (The relevant part is at the top): <html> <head> <title>Preload Image Page</title> <?php $Get_pictures = "SELECT bilde FROM beis"; $Connect_bilde = $database->query($Get_pictures); while($rad = mysql_fetch_array($Connect_bilde)){ $my_array[] = $rad['bilde']; } ?> <script language="JavaScript1.1"> <!-- begin hiding /* Preload Image With Update Bar Script (By Marcin Wojtowicz [one_spook@hotmail.com]) Submitted to and permission granted to Dynamicdrive.com to feature script in it's archive For full source code to this script and 100's more, visit http://dynamicdrive.com */ // You may modify the following: var locationAfterPreload = "http://dynamicdrive.com" // URL of the page after preload finishes var lengthOfPreloadBar = 150 // Length of preload bar (in pixels) var heightOfPreloadBar = 15 // Height of preload bar (in pixels) // Put the URLs of images that you want to preload below (as many as you want) var yourImages = new Array("<? echo $my_array; ?>","http://yourdomain.com/test2.gif") // Do not modify anything beyond this point! if (document.images) { var dots = new Array() dots[0] = new Image(1,1) dots[0].src = "black.gif" // default preloadbar color (note: You can substitute it with your image, but it has to be 1x1 size) dots[1] = new Image(1,1) dots[1].src = "blue.gif" // color of bar as preloading progresses (same note as above) var preImages = new Array(),coverage = Math.floor(lengthOfPreloadBar/yourImages.length),currCount = 0 var loaded = new Array(),i,covered,timerID var leftOverWidth = lengthOfPreloadBar%coverage } function loadImages() { for (i = 0; i < yourImages.length; i++) { preImages[i] = new Image() preImages[i].src = yourImages[i] } for (i = 0; i < preImages.length; i++) { loaded[i] = false } checkLoad() } function checkLoad() { if (currCount == preImages.length) { location.replace(locationAfterPreload) return } for (i = 0; i <= preImages.length; i++) { if (loaded[i] == false && preImages[i].complete) { loaded[i] = true eval("document.img" + currCount + ".src=dots[1].src") currCount++ } } timerID = setTimeout("checkLoad()",10) } // end hiding --> </script> </head> <body bgcolor="#FFFFFF"> <center> <font size="4">Please be patient while some images<br> are being preloaded...</font><p> 0% <script language="JavaScript1.1"> <!-- begin hiding // It is recommended that you put a link to the target URL just in case if the visitor wants to skip preloading // for some reason, or his browser doesn't support JavaScript image object. if (document.images) { var preloadBar = '' for (i = 0; i < yourImages.length-1; i++) { preloadBar += '<img src="' + dots[0].src + '" width="' + coverage + '" height="' + heightOfPreloadBar + '" name="img' + i + '" align="absmiddle">' } preloadBar += '<img src="' + dots[0].src + '" width="' + (leftOverWidth+coverage) + '" height="' + heightOfPreloadBar + '" name="img' + (yourImages.length-1) + '" align="absmiddle">' document.write(preloadBar) loadImages() } document.write('<p><small><a href="javascript:window.location=locationAfterPreload">Skip Preloading</a> | <a href="http://dynamicdrive.com/">Script Credits</a></small></p>') // end hiding --> </script> </center> </body> </html>
  5. Hi, I'm aware that there are some difficulties with using javascript in php loops because of the client side and server side work that's being done. Anyways, here's what I got: Code: function alertBox() { document.sendform.to2.value = document.getElementById('test3').value; document.sendform.to.value = document.getElementById('test4').value; e.style.display="none"; } while ($row = mysql_fetch_array($getRecord)) { $TheirProfilePicture = $row['profilepicture']; $mysock = getimagesize("http://face2blog.comlu.com/images/uploads/$TheirProfilePicture?time=time()");?> <li><a href="#" onClick="alertBox();" id="test"><img src="http://face2blog.comlu.com/images/uploads/<? echo $TheirProfilePicture ?>?time=<?php echo time(); ?>" <? echo imageResize($mysock[0], $mysock[1], 45); ?> /> <font color="grey" size="3"><?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?></font><input type="hidden" id="test3" value="<?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?>"><input type="hidden" id="test4" value="<?php echo $row['username']; ?>"></a></li> <?php } Please ignore the lach of script tags, I'm just pasting in what's relevant. This is the code of my autosuggest search thingy. When a user clicks one of the suggestions I'd like alertbox(); to get the info of the one I picked, not the last result that was looped. Is there a way or a trick that I could do to make this work with ajax? Thank you in advance!
  6. Hi, I'm aware that there are some difficulties with using javascript in php loops because of the client side and server side work that's being done. Anyways, here's what I got: function alertBox() { document.sendform.to2.value = document.getElementById('test3').value; document.sendform.to.value = document.getElementById('test4').value; e.style.display="none"; } while ($row = mysql_fetch_array($getRecord)) { $TheirProfilePicture = $row['profilepicture']; $mysock = getimagesize("http://face2blog.comlu.com/images/uploads/$TheirProfilePicture?time=time()");?> <li><a href="#" onClick="alertBox();" id="test"><img src="http://face2blog.comlu.com/images/uploads/<? echo $TheirProfilePicture ?>?time=<?php echo time(); ?>" <? echo imageResize($mysock[0], $mysock[1], 45); ?> /> <font color="grey" size="3"><?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?></font><input type="hidden" id="test3" value="<?php echo $row['firstname']; ?> <?php echo $row['lastname']; ?>"><input type="hidden" id="test4" value="<?php echo $row['username']; ?>"></a></li> <?php } Please ignore the lach of script tags, I'm just pasting in what's relevant. This is the code of my autosuggest search thingy. When a user clicks one of the suggestions I'd like alertbox(); to get the info of the one I picked, not the last result that was looped. Is there a way or a trick that I could do to make this work? Thank you in advance!
  7. Hi, I have a few links on my site. What I need is for when I click one of these links I want the link text to appear in the textbox above. Is this doable?
  8. That's what I ended up doing. Something the obvious takes awhile to see.
  9. Yeah.. Possibly. I just want to find which rows have the right username as well as the status: 0, and have them returned.. And I really thought the query would do that..
  10. I want my query to return the values where person='$username' and status=0 from one table, and the same in another table. Here's what I got: $GetStatus = "SELECT comments.status, friends.status FROM comments, friends WHERE (comments.person='$username' AND comments.status='0') OR (friends.user2='$username' AND friends.status='0')"; However it just returns values from different rows where the status is different than 0..
  11. Hi, I have this piece of code: function GetAlerts(){ $username = mysql_real_escape_string($_SESSION['username']); $GetStatus = "SELECT comments.status, friends.status FROM comments, friends WHERE comments.person='$username' AND friends.user2='$username'"; $Connect = $database->query($GetStatus); $NumberRows = mysql_num_rows($Connect); return $NumberRows; } When I call the function I get: Fatal error: Call to a member function query() on a non-object And it points to the $GetStatus line. However, if I just use the code like this: $username = mysql_real_escape_string($_SESSION['username']); $GetStatus = "SELECT comments.status, friends.status FROM comments, friends WHERE comments.person='$username' AND friends.user2='$username'"; $Connect = $database->query($GetStatus); $NumberRows = mysql_num_rows($Connect); echo $NumberRows; it works perfectly.. Any ideas? Thanks in advance.
  12. Hi, my website allows users to upload pictures. But when I display these pictures I need them all to not be larger than a certain max width and height.. Is it some tutorial on how to fit images proportionately? Thank you!
  13. Hi, I'm building a blog, and I want the user to be able to add images to their entry. But I can't quite figure out how to this without risking injections. I see that most sites, such as phpfreaks has the img tags with brackets. Any suggestions how I'd go about doing that? All help appreciated!
  14. Alright.. that makes things harder, seeing as some of the queries depends on the information gathered from the loop..
  15. Okay, what if the queries are in a while loop? Do I just require it within the loop?
  16. OKay, do I just put that on the top of the page, or where I normally would have put the queries?
  17. So, I don't want my index page to be to crowded with code. Such as queries and db connections taking over half my page makes it all look untidy. Is it a way that I can store my queries, etc on a page, and just call on it? Or a similar solution? Thank you in advance
  18. I can't get it to work when I include this piece: $userid = mysql_real_escape_string($_SESSION['userid']); //WALLNOT $db2 = "SELECT status FROM comments WHERE touser='$username' AND status='0'"; $db2connect = $database->query($db2); $status2 = "SELECT status FROM friends2 WHERE user2='$username' and status='0'"; $test = $database->query($status2); $statfromdb = "SELECT stat FROM wallposts WHERE person='$username' AND stat='0'"; $status = $database->query($statfromdb); $GetStatus = "SELECT byuser, status, dtime FROM commentstatus WHERE status='$Naw'and person='$username' AND byuser!='$username'"; $ConnectGetStatus = $database->query($GetStatus); $Getmsg = "SELECT status FROM messages WHERE status='0' AND touser='$username'"; $ConnectGetmsg = $database->query($Getmsg); $row = mysql_fetch_array($test); $row2 = mysql_fetch_array($ConnectGetmsg); $getrow = mysql_fetch_array($status); $getrow2 = mysql_fetch_array($db2connect); $StatusComment = mysql_fetch_array($ConnectGetStatus); //Select profile picture $GetProfilePicture = "SELECT profilepicture FROM users WHERE username='$username'"; $ConnectProfilePicture = $database->query($GetProfilePicture); $ProfilePicture = mysql_fetch_array($ConnectProfilePicture); $MyProfilePicture = $ProfilePicture['profilepicture']; I think it might have something to do with session.php. It says can't re-define db..
  19. You have to set a default time zone. For example put this: date_default_timezone_set('Europe/Belgrade'); At the top of your page.
  20. I have this piece of code: function newmessage() { box = new LightFace({ title: 'New message', width: 600, height: 400, content: "<form method='post' action='sendmessage.php'>To: <br><input type='text' name='to'><br><br>Subject: <input type='text' size='94' name='subject'><br><br><textarea name='message' rows='13' cols='63'></textarea><br><br><input type='submit' value='Send' name='send'><input name='from' type='hidden' value='<? echo $username; ?>'></form>", buttons: [ { title: 'Close', event: function() { this.close(); } } ] }); box.open(); } As well as this piece of code: $userid = mysql_real_escape_string($_SESSION['userid']); //WALLNOT $db2 = "SELECT status FROM comments WHERE touser='$username' AND status='0'"; $db2connect = $database->query($db2); $status2 = "SELECT status FROM friends2 WHERE user2='$username' and status='0'"; $test = $database->query($status2); $statfromdb = "SELECT stat FROM wallposts WHERE person='$username' AND stat='0'"; $status = $database->query($statfromdb); $GetStatus = "SELECT byuser, status, dtime FROM commentstatus WHERE status='$Naw'and person='$username' AND byuser!='$username'"; $ConnectGetStatus = $database->query($GetStatus); $Getmsg = "SELECT status FROM messages WHERE status='0' AND touser='$username'"; $ConnectGetmsg = $database->query($Getmsg); $row = mysql_fetch_array($test); $row2 = mysql_fetch_array($ConnectGetmsg); $getrow = mysql_fetch_array($status); $getrow2 = mysql_fetch_array($db2connect); $StatusComment = mysql_fetch_array($ConnectGetStatus); //Select profile picture $GetProfilePicture = "SELECT profilepicture FROM users WHERE username='$username'"; $ConnectProfilePicture = $database->query($GetProfilePicture); $ProfilePicture = mysql_fetch_array($ConnectProfilePicture); $MyProfilePicture = $ProfilePicture['profilepicture']; That I use in 19 different pages, is there anyway I can put them all into one page, and just them through a function? It takes so much time when loading if I have it on each page? And if you have any other tips how to optimize my loading speed please write them. Thank you in advance! *Edit: Bad grammar.
  21. Hi, I want a page that displays loading content when user logs in, that stays there until all the images on the main page has been preloaded, then redirects to the index page. Is there a way to do this?
  22. Hi, I'm running a PHP script that displays a countdown. But I need something that updates that script every second, so that it actually looks like a countdown. Any ideas how to do this? I'm new to Javascript.
  23. Thank you! Any advice how I would do this part? Query MySQL table to update the end time
×
×
  • 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.