Jump to content

CroNiX

Staff Alumni
  • Posts

    1,469
  • Joined

  • Last visited

  • Days Won

    12

Everything posted by CroNiX

  1. You're storing a password in a cookie? Oh my...
  2. Not as fast as listening to low frequency sound at high decibels.
  3. I hope you are prepared for hearing loss later in life.
  4. Its because your tutorial is outdated. In modern php versions, registered globals is set to off (as it should be because its a big security risk). As Ken said and I tried to point out, do not use session_register(). page 1: <?php session_start(); $_SESSION['loggedin'] = $username; ?> page 2 and so on... <?php session_start(); $username=$_SESSION['loggedin']; echo $username; ?>
  5. Read the notes in the manual... http://uk.php.net/session_register
  6. Theres always javascript too. There are scripts that will turn a box, say a div, into a rounded corner box. Heres one that uses the mootools javascript framework, but its kind of a waste to use mootools ONLY for this... http://sgd-ui.melchizedek.ath.cx/demos/corner.html
  7. Im sure people will if you have tried and couldn't get it to work and you've posted your code. They're most likely not just going to do it for you.
  8. Then look at my code and see what I did to hide it. Or look at the mootools docs. They are really good....
  9. Yeah, I was typing when you were....
  10. Why don't you just put a timestamp in the database for when the user logs in? And when someone logs in see if its over 2 hours? If it is, reset your login bit, if not, dont. I dont really see the need for a cron job for this.
  11. Not if you want it set to hidden initially and want more than 1 on a page.
  12. Yes, you have everything set up wrong and it would have take a long time to explain it. So, I wrote you a little example. All you have to do is set the path to mootools to get it to work for you. If you study it you should be able to figure it out. Notice there is NO inline javascript used, as it is bad practice when using a good framework like mootools. Coding should be kept separate from the HTML. <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Mootools Slide</title> <script type="text/javascript" src="your path to mootools"></script> <style type="text/css"> #myContent {border:1px solid #00F; padding:10px; width:200px;} </style> <script type="text/javascript"> window.addEvent('domready', function(){ var slide1 = new Fx.Slide('myContent').hide(); //initialize and set to hidden initially $('button1').addEvent('click', function(e){ // set the click event of the link to toggle slide1 e = new Event(e).stop(); //prevent native click event slide1.toggle(); }); }); </script> </head> <body> <a href="#" id="button1">My Button</a><br /><br /> <div id="myContent">Here is my content<br /><br /><br /><br />more...</div> </body> </html>
  13. echo "<input type=\"button\" onclick=\"$('$div').slide('').close()\" value=\"Sumbit\">";
  14. something like this, but substitute your table name, $refname and $code with the variables from the form. $sql="SELECT my_name FROM your_table_name WHERE my_name = '" . quote_smart($refname) . "' AND code = '" . quote_smart($code) . "'"; $check_refer = mysql_query($sql,$connection) or die("Couldn't execute referral check query.<br>".mysql_error()); if(mysql_num_rows($check_refer) > 0) { //there is a match }
  15. Is this button doing something besides triggering your slide?
  16. If you initialized the slide with: var slide = new Fx.Slide('slideID'); you could change it to this: var slide = new Fx.Slide('slideID').hide(); or var slide = new Fx.Slide('slideID'); slide.hide(); and it would be hidden on domready (assuming you put this in a domready event). as far as having multiple slides on a page, its no problem. You just have have to have each section with its own id and initialize each one like you did the first time, but they all have to have their own id.
  17. Well, you are executing that code within the head of your document. If you view the rendered source code you will probably see it there. If you made it into a function and then called the function from within the body it will probably be visible.
  18. The answers are not in that file either. Its probably in class_user.php. It might be better for you to try asking in the support area for 'Social Engine'. http://www.socialengine.net/support.php
  19. Nobody will be able to help without these answered. Whats in your 'header.php' file?
  20. It is the same as time() (unix timestamp, yes, date and time) except it also has microseconds.
  21. Except for the . instead of the , in the array
  22. What you outlined is a good start. Check out the 'php security' video on this site...its pretty good. http://videos.code2design.com/
  23. Where are you creating the $thisuser object? Its not in your code. ($thisuser = new classname() The error is saying that the method (function in a class) doesn't exist in your class. More people will probably read this if you posted it in your post (using code tags of course) instead of a download link...
  24. CroNiX

    Sessions

    This is what I use. Of course, you need to change all of the database calls to your own as I am using my own abstraction class within it. <?php /* CREATE TABLE `sessions` ( `session_id` varchar(100) NOT NULL default '', `session_data` text NOT NULL, `expires` int(11) NOT NULL default '0', PRIMARY KEY (`session_id`) ) TYPE=MyISAM; */ class SessionManager { private $life_time; private $db; public $sessid; function __construct($db_object) { // Read the maxlifetime setting from PHP $this->life_time = get_cfg_var("session.gc_maxlifetime"); $this->db = $db_object; //change to your own db method // Register this object as the session handler session_set_save_handler( array( &$this, "open" ), array( &$this, "close" ), array( &$this, "read" ), array( &$this, "write"), array( &$this, "destroy"), array( &$this, "gc" ) ); } function open( $save_path, $session_name ) { global $sess_save_path; $sess_save_path = $save_path; // Don't need to do anything. Just return TRUE. return true; } function close() { return true; } function read( $id ) { // Set empty result $data = array(); // Fetch session data from the selected database $time = time(); $newid = $this->db->escape($id); //change to your own db method $this->sessid = $newid; $sql = "SELECT `session_data` FROM `sessions` WHERE `session_id` = '$newid' AND `expires` > $time"; $rs = $this->db->query($sql); //change to your own db method if($this->db->numRows($rs) > 0) { //change to your own db method $data = $this->db->fetchAssoc($this->db->rs); $this->db->closeRS(); } return $data; } function write( $id, $data ) { // Build query $time = time() + $this->life_time; $newid = $this->db->escape($id); //change to your own db method $this->sessid = $newid; $newdata = $this->db->escape($data); //change to your own db method $sql = "REPLACE `sessions` (`session_id`,`session_data`,`expires`) VALUES('$newid', '$newdata', $time)"; $this->db->query($sql);//change to your own db method return TRUE; } function destroy( $id ) { // Build query $newid = $this->db->escape($id); //change to your own db method $q = "DELETE FROM `sessions` WHERE `session_id` = '$newid'"; $this->db->query($q); //change to your own db method return TRUE; } function gc() { // Garbage Collection // Build DELETE query. Delete all records who have passed the expiration time $sql = 'DELETE FROM `sessions` WHERE `expires` < UNIX_TIMESTAMP();'; $this->db->query($sql); //change to your own db method // Always return TRUE return true; } function getSessid(){ return $this->sessid; } } ?> Then you just use sessions as you normally would with all of the regular commands, and it will use the database instead of session files on the server.
  25. No, there is no way to do this, and you shouldn't be able to do this for security reasons. Also, if you were to use an ActiveX component, the USER has to agree to download and install it, you can't just do it (again, major security issue). I run from sites (except Microsoft or other TRUSTED sources) that prompt me to install an ActiveX component and Im sure most others do to. It is usually a sign of someone trying to install malicious software on your computer.
×
×
  • 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.