Jump to content

abdfahim

Members
  • Posts

    535
  • Joined

  • Last visited

Posts posted by abdfahim

  1. Hi,

    I want to implement a progress bar. The idea is simple, I have file2.php where I set $_SESSION['progress'] value in each loop.

    While file2 is working in background, I want to return the $_SESSION['progress'] value in main thread using below functions.

    But the problem is, it is not working. While fprogress is being called in every second, the value is set only once at the end.

    Can anybody please help?

    Thanks,

    var updateprog;
    	
    	function fprogress() {
    	    var progxmlHttp = new XMLHttpRequest();
    	    var progress;
    	    var url = "file1.php";
    	    progxmlHttp.onreadystatechange=function(){
    		if (progxmlHttp.readyState==4 && progxmlHttp.status==200){
    		    progress = progxmlHttp.responseText;
    		    document.getElementById("progress").innerHTML ="Progress: "+progress+"% <br><br>"; 
    		}
    	    }
    	    
    	    progxmlHttp.open("GET", url, true);
    	    progxmlHttp.send(null);
    	}
    	
    	function updateAll(mid)
    	{
    	    var xmlhttp=new XMLHttpRequest();
    	    updateprog = window.setInterval(fprogress,1000);
    	    xmlhttp.onreadystatechange=function(){
    		if (xmlhttp.readyState==4 && xmlhttp.status==200){
    		    window.clearInterval(updateprog);
    		    document.getElementById("progress").innerHTML ="progress: 100% <br><br>"; 
    		}
    	    }
    	    xmlhttp.open("POST","file2.php",true);
    	    xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
    	    params = "key=xxx";
    	    xmlhttp.send(params);
    	}
    

    file1.php

    <?php
        if (!isset($_SESSION)) {
    	session_start();
        }
        echo $_SESSION['progress'];
    ?>
    
    
  2. Hi,

     

    Another question. If I want to block direct access to my "includes" folder where I have base PHP files (only PHP files) which are included throughout the site, is it enough I just disable directory listing using following commands in htaccess? Or I should take some more precautions to protect my code?

     

    .htaccess

    Options -Indexes

  3. thanks both of you ... My server is Apache  running on Linux ....

     

    I'll definitely use that -Indexes command.

     

    For protecting files from download, is there any way except putting them outside webroot? Can't I use htaccess to restrict direct access to those folders? I Googled and found lots of example, but I couldn't properly tweak those to make it perfect for me, as I have no experience in htaccess.

     

    The code I tried to do was to redirect to webroot (www.mysite.com) whenever someone try to direct access that directory (www.mysite.com/classes). But I was stuck in 2 kind of scenarios:

     

    1. That directory was protected but the server PHP files also failed to access. Hence I got all those "includes" inside PHP file not working

    2. There was infinite loop while redirecting

     

     

     

     

  4. Hi,

     

    I have some flash files and also some PHP files in a folder called "classes" which I inlcuded/embeded in my other PHP files.

     

    What I want is nobody can directly go to "www.mysite.com/classes" to protect downloading those files.

     

    Also I want to disable file listing when somebody point to any directory.

     

    How can I do those?

  5. I want to get the maximum values of the second key of a multidimensional array. Write now I am using the code below, which works. But interested to know whether anybody has any better idea?

     

    $arr['a']['2012-08-04']=100;
        $arr['a']['2012-08-01']=4545;
        $arr['a']['2012-08-07']=2434;
        $arr['b']['2012-08-02']=2334;
        $arr['b']['2012-08-03']=2324;
        
        $dt=array();
        foreach($arr as $val){
    $dt=array_merge($dt,$val);
        }
        echo max(array_keys($dt));

  6. Hello:

     

    Thanks for getting back with me.  I am new to all this and have never done an "export" so I do not know the best way to do it.  Hopefully this is what you requested.  I did an export and left all defaults selected and it printed out this:

     

    -- phpMyAdmin SQL Dump

    -- version 2.11.11.3

    -- http://www.phpmyadmin.net

    --

    -- Host: 50.63.244.142

    -- Generation Time: Jul 29, 2012 at 10:34 PM

    -- Server version: 5.0.92

    -- PHP Version: 5.1.6

     

    SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";

     

    --

    -- Database: `db2012gman`

    --

     

    -- --------------------------------------------------------

     

    --

    -- Table structure for table `charismos`

    --

     

    CREATE TABLE `charismos` (

      `userid` int(11) NOT NULL auto_increment,

      `username` longtext,

      `email` varchar(75) NOT NULL default 'a',

      `avatar` varchar(11) default NULL,

      `zenscore` varchar(11) NOT NULL default '0',

      PRIMARY KEY  (`userid`)

    ) ENGINE=MyISAM  DEFAULT CHARSET=utf8 AUTO_INCREMENT=59 ;

     

    --

    -- Dumping data for table `charismos`

    --

     

    INSERT INTO `charismos` VALUES(1, 'firstuser', 'heisfirst@first.com', '1', '1');

    INSERT INTO `charismos` VALUES(2, 'second user', 'sheissecond@second.com', '2', '23');

    INSERT INTO `charismos` VALUES(3, 'gerard is the third', 'third@third.com', '3', '55');

    INSERT INTO `charismos` VALUES(4, 'fourhguy', 'afteradding@newfield.com', '4', '55');

    INSERT INTO `charismos` VALUES(5, ' will it work', 'no_email@submitted.com', '2', '10');

    INSERT INTO `charismos` VALUES(57, ' gerard_again', ' gh@we.com ', '3', '2300');

    INSERT INTO `charismos` VALUES(58, ' textuser', '  ', '3', '0');

     

     

    Okay, locate your problem. You have extra space in front of user name, hence it is not giving anything. If you write like below, it will work (notice an extra space in username, e.g. NOT 'will it work', rather, ' will it work'

    SELECT count( * )
    FROM charismos
    WHERE username = ' will it work'
    

     

    You see, you have same problem after 4th row for all data. That's why you are not getting any result after 4th row. To overcome this prob, always use PHP TRIM function when entering data in database

  7. thanks Drummin 4 u'r clue ,,, limit not counting the "3 consecutive value" that i need

     

     

    May be you can rewrite query like

    $sql = "SELECT Totrain FROM tablename WHERE TotRain>'20' ORDER BY `ID` ASC, `Year` ASC, `Month` ASC, `dayset` ASC LIMIT 3 
    

  8. Dears,

     

    I am wondering why ioncube is almost double price compare to safeguard? ioncube basic has same price (~200USD) but ioncube Cerberus is price 379USD. And if you compare with sourceguard, it has the options matched with ioncube cerberus (MAC/IP/Domain licensing, time based licensing etc.).

     

    Anybody has any idea what extra I can get with extra price for ioncube?

     

    thanks,

  9. I don't see any problem except those syntax issues in query lines. Try to echo variable $fetch_1 before if loops.

     

    $qry_2=mysql_query("INSERT INTO `tbl` (...) VALUES (...)") or die(mysql_error());
    

     

     

    $qry_2_Update=mysql_query("UPDATE `tbl` SET `att` = `att` +1 WHERE `id`='".$this->u_tst."'");
    

  10. can you just try using this code to make it basic (again if you want to use GET method anyhow in start.php?

    <form action="http://mysite.com/start.php?offer_pgid=071691" method="post">
    <p><input type="text" style="
    width:230px;
    height:60px;
    border:2px dashed #D1C7AC;
        font-size:18px;" name="paypal_email"></p>
    <p> </p>
    <input type="image" name="continue" src="images/arw_submit.png" alt="submit" value="Submit"></form>
    

     

    and write following line on top of start.php

    $_GET['email']=$_POST['paypal_email'];
    

     

     

    =========OR=======

     

    <form action="http://mysite.com/start.php" method="get">
    <p><input type="text" style="
    width:230px;
    height:60px;
    border:2px dashed #D1C7AC;
        font-size:18px;" name="email"></p>
    <p> </p>
    <input type="hidden" name="offer_pgid" value="071691">
    <input type="image" name="continue" src="images/arw_submit.png" alt="submit" value="Submit">
    </form>
    
    

  11. Yea, I agree with this method.  I use the sesssion_id hash as the temporary key for the link and verification.  The key is stored in the user's activation column, where normally is a bool integer.

     

    looks like we are on the exactly same page :) ....

     

    .....  The key is stored in the user's activation column, where normally is a bool integer.

     

    Mahngiel, do you have a time column to make the hash only usable within a certain time?

     

    I've been toying with this in my mind but I'm not wanting to make another column for time.

     

    you have 2 choice ... either insert another column in DB for time stamp, but I prefer to embed the expiration time stamp inside that key ......

  12. I personally don't like this security question answer method (because I never could remember those of any of my web accounts). And if the security answer is is too straight forward, then there is no point of having it.

     

    So what I did for my designed forums,

    - when a user click on "forget password" link, it will ask for the email address.

    - If email address matches, it will create a temporary key in database against that user and send a specific link with hashed (md5) key as argument to his email address.

    - If he clicked on that link, it matches the key and then asked for a new password.

  13.  

     

    Thank you, hm, but I copied and pasted the link and it gives me this error

     

     

    Parse error: syntax error, unexpected '}', expecting ',' or ';' in C:\xampp\htdocs\translators19.php on line 131

     

     

    which I did not get before pasting it.

     

    good that ur problem is resolved ..

     

    Nevertheless, I put end semi-colon inside quote ...  stupid typing mistake ..

     

    echo "<a href=\"?country=".$_GET['country']."&from_language=Russian&into_language=Latvian&submitted=true&
    page=".$x. "\">".$x."</a>";
    

×
×
  • 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.