abdfahim
-
Posts
535 -
Joined
-
Last visited
Posts posted by abdfahim
-
-
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']; ?>
-
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
-
okay guys .. thanks .. it seems like I had a whole misconception how flash file works in browser .....
Thanks for clearing it up ......
-
so isn't there any way to protect a folder from direct access (but enable php inclusion)?
-
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
-
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?
-
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));
-
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
--
-- 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
-
From your query, I can't see any problem. If your table is not confidential and also not too big, may be you can attach the sql export here, then I can load in my machine and check.
-
SafeGuard or SourceGuard? (Note, they are 2 completely different products.)
Oops, a typo !! Yes, it is ofcourse SourceGuard
-
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
-
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,
-
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."'");
-
isn't this belong to JavaScript forum?
-
$flatarr = array(); foreach($old_array as $key => $val) { $flatarr = array_merge($flatarr,$val); }
-
During inserting, you should do like this
if(!get_magic_quotes_gpc()){ $name = addslashes($name); }
-
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>
-
good that you solved ur prob ...
-
you already are passing variable $_POST['paypal_email'] to start.php, why bother passing $_GET['email'] which is exactly same as $_POST['paypal_email']?
if you need anyhow in GET format (which I don't know actually why), just assign in start.php like below
$_GET['email'] = $_POST['paypal_email']
-
//Sorry, message truncated. I didn't get your problem.//
-
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 ......
-
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.
-
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>";
-
not sure about built in function, but another method should be
$pagename=explode("/",$_SERVER['PHP_SELF']); echo $pagename[count($pagename)-1];
Username changes
in PHPFreaks.com Website Feedback
Posted
I have been searching this for months!
I am trying to align all my forum login name, so can I please have my username (login name) changed to abdfahim?
I have already changed the display name to that long time back.
Thanks