Jump to content

jammesz

Members
  • Posts

    83
  • Joined

  • Last visited

    Never

Everything posted by jammesz

  1. Yes that's true but at least its not on my system. I have searched many times for one but no one has made one (for obvious reasons). Bazaar came close to being the solution as you can host the physical repository on a server and access it through http from a computer. The only problem was that you can't write to it, even through ftp. If no one comes up with a better solution i guess i might have to host my own server using my second home phone line so i can keep the tax and repository systems separated.
  2. Yes i have thought of that but its a solution im trying to stay away from as i am no expert on preventing my system from getting hacked besides the obvious steps of keeping only the required ports open and not using root user etc. It's a bigger risk to do that also because I'm an accountant where data security plays a big role on keeping my license. I can get into a lot of trouble if something bad were to happen. Thanks anyway
  3. Im interested in using a version control system for development. Even though there's already software out there for this (CVS,SVN,GIT,Bazaar,Mercurial), they're no use to me if i can't use them on my shared host account due to my host not providing any of these or it costing extra. It also must be private so sorceforge etc. isn't any good. Free version control hosts don't help either as their restrictions (amount of space, users, projects, etc.) don't meet my requirements. So... is there a possible solution to all this like turning a mysql db into a version control system or php into one? Also, i've heard that the version control systems use delta compression for diffs and saving space but putting this all together to make a version control system using, say, mysql is a bit worrying. Any suggestions or better solutions would be appreciated.
  4. This will get the result you want... <? $i_array = array( array('bank_id'=>1,'bank_name'=>1,'total_amount'=>100), array('bank_id'=>2,'bank_name'=>2,'total_amount'=>0), array('bank_id'=>1,'bank_name'=>1,'total_amount'=>600), array('bank_id'=>2,'bank_name'=>2,'total_amount'=>300), array('bank_id'=>3,'bank_name'=>3,'total_amount'=>-200), array('bank_id'=>2,'bank_name'=>2,'total_amount'=>-10) ); $o_sum_array=array(); $o_array=array(); foreach($i_array as $ia){ $o_sum_array[$ia['bank_id']] += $ia['total_amount']; $o_array[$ia['bank_id']] = array('bank_id'=>$ia['bank_id'],'bank_name'=>$ia['bank_name'],'sum'=>$o_sum_array[$ia['bank_id']]); } echo '<pre>'; print_r($o_array); echo '</pre>'; ?> Result... Array ( [1] => Array ( [bank_id] => 1 [bank_name] => 1 [sum] => 700 ) [2] => Array ( [bank_id] => 2 [bank_name] => 2 [sum] => 290 ) [3] => Array ( [bank_id] => 3 [bank_name] => 3 [sum] => -200 ) )
  5. well the error it throws before my custom one is actually the same error (eg. mysql_connect() [function.mysql-connect]: Access denied for user 'ODBC'@'localhost' (using password: NO)). i just wanted to replace with mine but i think you answered my question anyway. BTW i can still filter out php's database error msg in the error() function but it's a real hassle to do it this way and i was trying to see if there was a more efficient way.
  6. I have written my own error handling function in php. function error($type, $error, $file, $line){ die('<meta http-equiv="refresh" content="0;url=error.php?t='.rawurlencode(base64_encode($type)).'&e='.rawurlencode(base64_encode($error)).'&f='.rawurlencode(base64_encode($file)).'&l='.rawurlencode(base64_encode($line)).'">'); } error_reporting(0); set_error_handler("error", E_ALL & ~E_NOTICE); mysql_connect($cfg['mysql_server'],$cfg['ysql_username'],$cfg['mysql_password']) or trigger_error("Can't connect to database server", E_USER_ERROR); mysql_select_db($cfg['mysql_database']) or trigger_error("Can't connect to database", E_USER_ERROR); (the example error is the missing "m" from the username variable passed to mysql_connect) My error function picks up this error but i want it to pick up my own personal error msg for the error first ( ...or trigger_error("Can't connect to database", E_USER_ERROR); ) before the default php one. Anyone know how to do this???
  7. oh... I overlooked that on the php date manual . Thanks for the help
  8. no as that gives the day of the month, i want the day of the week
  9. I made a calendar script that relies on the date("N") to tell the numeric representation of the day of the week. But the problem is that it doesn't work on php4 as it was added in php5. Is there a way around this???
  10. Thanks for the help btherl. Very useful library.
  11. yea thats wat i mean. i just wanted to know if someone else has done this, otherwise i think i might have to download the src.
  12. I was wondering if theres a way to have php functions in c++. I only know basic c++ so i dont know if there is anything like this out there. but in my opinion php manipulates strings better, and easier, and this would save a lot of trouble having to do it in c++ (as in c++ it requires more code and effort). Any help would be good.
  13. kk. I guess im gonna have to put up with it. Anyway thanks for the help.
  14. Does any one know how i can do multiple querys in AdoDB Lite? This is an example of what im trying to do: $sql="DROP TABLE IF EXISTS cms_users; CREATE TABLE cms_users ( usr_id INT( 255 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , usr_username VARCHAR( 255 ) NOT NULL , usr_password VARCHAR( 255 ) NOT NULL , UNIQUE ( usr_username ) ) ENGINE = innodb; "; $db->Execute($sql) or die("Error creating table"); But it doesnt work and comes up with an error. Btw the error msg doesnt give me any clues to what is wrong with it. It just says incorrect syntax. So i tried this: $sql="DROP TABLE IF EXISTS cms_users;"; $db->Execute($sql) or die("Error dropping existing tables"); $sql=" CREATE TABLE cms_users ( usr_id INT( 255 ) NOT NULL AUTO_INCREMENT PRIMARY KEY , usr_username VARCHAR( 255 ) NOT NULL , usr_password VARCHAR( 255 ) NOT NULL , UNIQUE ( usr_username ) ) ENGINE = innodb; "; $db->Execute($sql) or die("Error creating table"); The above code works but i really dont want to do it this way.
  15. jammesz

    Uses of linux

    k, thanks for your guys help
  16. jammesz

    Uses of linux

    I know about all the features of linux but what i meant to say is what can linux do that windows cant besides being used for servers, developing/editing programs, and being stable and more secure? Im trying to find out whether you can do more with it. Ive got the latest fedora linux and installed it on its own machine and its just sitting there doing nothing so im getting ideas off you guys
  17. jammesz

    Uses of linux

    Besides developing programs and setting up servers on Linux what else is there to do???
  18. I tryed the following in my .htaccess file and it worked but then the flash player doesn't play the video file: RewriteEngine on RewriteRule ^(.*)\.flv$ http://www.jamix.com/joomla/?option=com_video&vc=$1 [nc] So this doesnt work but im hoping this might give someone an idea of how to solve my problem.
  19. Did you read all of my question? I explained that ive already tryed this and it did work until the flash player viewed the .flv file and then it didnt (i was able to access the flv file after viewing it in the flash player). this is what i used: RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} ^http://(www.)?jamix.com/joomla/videos(/)?.*$ [NC] RewriteRule .*.(mpg|wmv|mov|rm|avi|flv|mpeg|swf|MPEG|WMV|AVI|MOV|RM|FLV)$ http://www.jamix.com/joomla/access_denied.php [R,NC] its only a test htaccess script that disallowed direct access from my own site. Dont bother going to www.jamix.com as its just my intranet domain, not a real domain. Anyway this way doesnt work so dont bother going into it. Think of it like this. All i want is basically a htaccess file that has 'deny from all' except for the flash player.
  20. So... ill repeat what i said before then - thats not what my question was asking
  21. Erm.. did you read/understand the sessions part ? umm... isnt it just a script that hides the actual link of the video files??
  22. You completely misunderstood the question. i want to prevent direct access to the movies so that if a person goes to http://mydomain.com/videos/mymovie.flv it will redirect them and wont download the movie. Plus i've already got a script that does what you said above (different method though).
  23. Hi, im trying to work out how to stop direct access to a certain folder and its files. My purpose of this is to protect video files from being downloaded and i figured that the apache mod_rewrite is used to do this. I have tryed searching this forum and the web for a solution only to find anti-hotlinking scripts in which i customized to disallow my own site from accessing them but then when i view the videos in my flash player the apache server (after I viewed the video) allows me to access it, whereas it disallows me to access videos that i havent viewed in the flash player. Now to me that seems a bit stupid as it should follow the rules i give it no matter what. Anyway, i am fully aware about how the cache downloads the videos and all the other protection issues so dont mention that this whole thing is a waste of time because of them. Ive already fixed all thoughs issues except for this one. I know this is possible as all you have to do is read the users url and make sure that they aren't in the video directory. I have barely any experience with .htaccess files and when i search for a tutorial it just comes up with how to password protect a directory with .htaccess and nothing else so ive come here for help. Any ideas?
  24. OK i solved it. Since this was hard to figure out how to do, i presume that there is someone else out there who needs this code as well so im posting it here. <? $html->header(); $html->top_nav(); echo '<select name=""><option>News Categories</option>'; function retrieveTree($path){ $delim = strstr(PHP_OS, "WIN") ? "\\" : "/"; if($dir=@opendir($path)){ $i=0; while (($element=readdir($dir))!== false){ if(is_dir($path.$delim.$element) && $element!= "." && $element!= ".."){ $c=substr_count($path.$delim.$element, $delim); $array['d'.$c.$element] = retrieveTree($path.$delim.$element); }elseif($element!= "." && $element!= ".."){ $i++; $array['f'.$i] = $element; } } closedir($dir); } return (isset($array) ? $array : false); } function constructTree($branch){ foreach($branch as $key=>$value){ $key_type=substr($key,0,1); $key_indent=substr($key,1,1); $key=substr($key,2); if($key_type=='d'){ echo '<option>'; for($i=1;$i<$key_indent;$i++){ echo ' |- '; } echo ' '.$key.'</option>'; if(is_array($value)){ constructTree($value); } } } } $files=retrieveTree($news_dir); $list=constructTree($files); echo ' </select> <hr> <pre>'; print_r($files); echo ' </pre> '; $html->footer(); ?> Attached is what the script looks like (the news categories are directories). PS. this is not using any databases [attachment deleted by admin]
×
×
  • 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.