Jump to content

enkidu72

Members
  • Posts

    51
  • Joined

  • Last visited

    Never

Everything posted by enkidu72

  1. The file will be moved , but still will reside on the server . The security issue is just a "political" problem . This portal , and the certificates are of the max importance , with then you "could" access to hundreds of computers all over the world . So my chiefs ( that are not IT ) want the max security you can think of . The code is crypted . The session itself it's a problem because reside on the server , so we crypt and move them to a database on another machine physically connected to the web server that accepts connections only from one ethernet nic .
  2. I'll try to explain better ... User upload his personal cert via a form . The certificate is then something like this : $_FILES['cert']['tmp_name'] which actually is a file stored in the apache server . There is a ( VERY ) remote possibility that someone can gain root access to the web server , and so can read this file . A program uses this file to generate a personal proxy for the user .
  3. Hi neil.johnson , all this measures are already implemented on the web site . But still seems that's not enough . The main problem is with this files being uploaded via web and stored ( even for some second ) in the fs ..
  4. Hi all ... I 'm coding for a site that has to be very secure . The problem is that users are sending via form a private certificate , which has to be used in the creation of a personal proxy . Files sent by a form are stored with a tmp name on the server , which is not what we want . In the case of someone gaining the root access to the machine he could retrieve and use them . We have thought about crypted filesystem , crypted session on a remote db and much more . I' d like to know if someone has some idea ... Thx in advance David
  5. Is that right ? It seems to work but seems "pervert" to me mysql> describe members ; describe groups ; describe group_user ; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | id | int(4) | NO | PRI | NULL | auto_increment | | username | varchar(65) | NO | | | | | password | varchar(65) | NO | | | | | permission | int(4) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+ 4 rows in set (0.00 sec) +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | id | int(4) | NO | PRI | NULL | auto_increment | | group_name | varchar(20) | YES | | NULL | | +------------+-------------+------+-----+---------+----------------+ 2 rows in set (0.00 sec) +-------+--------+------+-----+---------+-------+ | Field | Type | Null | Key | Default | Extra | +-------+--------+------+-----+---------+-------+ | uid | int(4) | NO | | | | | gid | int(4) | NO | | | | +-------+--------+------+-----+---------+-------+ 2 rows in set (0.00 sec) mysql> select * from members ; select * from groups ; select * from group_user ; +----+----------+----------+------------+ | id | username | password | permission | +----+----------+----------+------------+ | 1 | david | desmo2 | 1 | | 2 | andrea | pippo | 0 | +----+----------+----------+------------+ 2 rows in set (0.00 sec) +----+------------+ | id | group_name | +----+------------+ | 1 | david | | 2 | users | | 3 | andrea | +----+------------+ 3 rows in set (0.00 sec) +-----+-----+ | uid | gid | +-----+-----+ | 1 | 1 | | 1 | 2 | | 2 | 2 | | 2 | 3 | +-----+-----+ 4 rows in set (0.00 sec) So if I want to know which groups david is inside : mysql> select group_name from members inner join group_user on group_user.uid=members.id inner join groups on group_user.gid=groups.id where members.id=1 ; +------------+ | group_name | +------------+ | david | | users | +------------+ 2 rows in set (0.00 sec) I'm not very sure of this ...
  6. Hello all , I have what is (probably) a very stupid question ... I need to create tables for a db but I'm a bit confused and I hope someone could help ... I have a table members containing details about users: describe members ; +------------+-------------+------+-----+---------+----------------+ | Field | Type | Null | Key | Default | Extra | +------------+-------------+------+-----+---------+----------------+ | id | int(4) | NO | PRI | | auto_increment | | username | varchar(65) | NO | | | | | password | varchar(65) | NO | | | | | group | int(4) | NO | | | | | permission | int(4) | NO | | | | And now I have to create a group table . User and group are unique , but I need a user to belong to more groups ... Which is the best way to do it ? Thx in advance David
  7. The linux kernel module fuse was doing that ... So maybe If he's using a linux box can avoid that part .
  8. Actually I did something similar in the past, but the sensor data was written on the filesystem by the sensor itself . I used a perl daemon to parse it and to send it to a mysql db . Then the data was extracted from the db via PHP and showed as a web page by an Apache web server ...
  9. Yes , I had already noticed Basically the problem is that if the dir somedir_amber_0 already exists , doesn't create somedir_amber_1 ... Here the output : Array ( [0] => 22-01-09_18-17-03 [1] => 22-01-09_18-17-03_amber [2] => 22-01-09_18-17-03_amber_0 ) SELECT workdir FROM jobs WHERE workdir LIKE '%22-01-09_18-17-03%' AND owner='27' Warning: mkdir() [function.mkdir]: File exists in /var/www/html/stable/xplor_sc.php on line 305 so I think the problem is in the if (in_array($amber_dir_new, $directories)) { $i = 0; do { $amber_dir_new = "{$amber_dir}{$amber_dir_suffix}_{$i}"; $i++; } while (in_array($amber_dir_new, $directories)); } part of the code ...
  10. MANY THX ! Still doesn't work , but at least I've understood which was my mistake !
  11. the record is a directory name , sorry
  12. This was how was working before , now all infos have been saved in a db ... while (file_exists("$home_dir/$user_dir/Xplor-SC/$amber_dir_new/") ){ $count++; $amber_dir_new=$amber_dir.$amber_dir_suffix.$underscore.$count; } I just need to do the same querying mysql ...
  13. I need to check if the record exists in the db ... ( a directory ) If it does , increment count by one . So : count = 0 1) check for "dir" -> dir exists 2) count = 1 check for dir1 -> dir1 exists 3)count=2 check for dir2 -> dir2 doesn't exist create dir dir2 ...
  14. Hi all , I'm stuck with a while that doesn't seems to work ... here the code : $amber_dir_suffix='_amber'; $amber_dir_new=$amber_dir.$amber_dir_suffix; $count=0; $underscore="-"; $query="select id from jobs where workdir='$amber_dir_new' and owner='$user_id'"; while (mysql_numrows(mysql_query($query))) { $count++; $amber_dir_new=$amber_dir.$amber_dir_suffix.$underscore.$count; } $result=mkdir("$home_dir/$user_dir/Xplor-SC/$amber_dir_new/"); if($result){ echo "Directory $amber_dir_new created succesfully "; }else{ echo "Cannot create dir $home_dir/$user_dir/Xplor-SC/$amber_dir_new!"; } Basically i need to check if the record exist , and if does increment count ... I'm sure It must be a stupid thing ...
  15. hi flyhoney , thx for your reply , but that's not really the problem ... I don't need to clean all blank spaces , I need them to explode the line ... Later when I have to write the table , i need to ignore them . What was ( almost as I said ) working was : foreach ($string as $word){ $check=trim($word); if ( !empty($check)) { echo "<td>$word</td>"; } } <table><tr><td>Distance</td><td>and</td><td>angle</td><td>violations:</td></tr><tr><td></td></tr><tr><td></td><td>target</td><td>Key:</td><td>.</td><td>=</td><td>0.0</td><td>-</td><td><=</td><td>0.1</td><td>+</td><td><=</td><td>0.2</td><td>*</td><td><=</td><td>0.5</td><td>0</td><td><=</td><td>1.0</td><td>8</td><td><=</td><td>2.0</td><td>@</td><td>></td><td>2.0</td><td>Stats:</td><td>Ave</td><td><std></td><td>min/max/#</td></tr><tr><td></td><td>CD2</td><td>TRP</td><td>43</td><td>--</td><td>H</td><td>PHE</td><td>30</td><td>:</td><td>6.00</td><td>:</td><td>*</td><td>0.44</td><td><</td><td>0.00></td><td>0.44</td><td>/</td><td>0.44</td><td>1</td></tr><tr><td></td><td>CD2</td><td>TRP</td><td>43</td><td>--</td><td>HA</td><td>LYS</td><td>31</td><td>:</td><td>3.30</td><td>:</td><td>+</td><td>0.15</td><td><</td><td>0.00></td><td>0.15</td><td>/</td><td>0.15</td><td>1</td></tr><tr><td></td><td>CZ3</td><td>TRP</td><td>43</td><td>--</td><td>HA</td><td>LYS</td><td>31</td><td>:</td><td>3.30</td><td>:</td><td>*</td><td>0.21</td><td><</td><td>0.00></td><td>0.21</td><td>/</td><td>0.21</td><td>1</td></tr><tr><td></td><td>CH2</td><td>TRP</td><td>43</td><td>--</td><td>HA</td><td>PHE</td><td>52</td><td>:</td><td>6.00</td><td>:</td><td>*</td><td>0.32</td><td><</td><td>0.00></td><td>0.32</td><td>/</td><td>0.32</td><td>1</td></tr><tr><td></td><td>CH2</td><td>TRP</td><td>43</td><td>--</td><td>HA</td><td>VAL</td><td>54</td><td>:</td><td>5.00</td><td>:</td><td>*</td><td>0.28</td><td><</td><td>0.00></td><td>0.28</td><td>/</td><td>0.28</td><td>1</td></tr><tr><td></td><td>H</td><td>ALA</td><td>26</td><td>--</td><td>H</td><td>GLU</td><td>27</td><td>:</td><td>2.90</td><td>:</td><td>-</td><td>0.07</td><td><</td><td>0.00></td><td>0.07</td><td>/</td><td>0.07</td><td>1</td></tr><tr><td></td><td>H</td><td>GLU</td><td>27</td><td>--</td><td>H</td><td>LYS</td><td>28</td><td>:</td><td>2.90</td><td>:</td><td>*</td><td>0.26</td><td><</td><td>0.00></td><td>0.26</td><td>/</td><td>0.26</td><td>1</td></tr><tr><td></td><td>HD2</td><td>PHE</td><td>30</td><td>--</td><td>HA</td><td>THR</td><td>17</td><td>:</td><td>3.30</td><td>:</td><td>0</td><td>0.94</td><td><</td><td>0.00></td><td>0.94</td><td>/</td><td>0.94</td><td>1</td></tr><tr><td></td><td>HA</td><td>LYS</td><td>31</td><td>--</td><td>H</td><td>ALA</td><td>34</td><td>:</td><td>3.50</td><td>:</td><td>+</td><td>0.15</td><td><</td><td>0.00></td><td>0.15</td><td>/</td><td>0.15</td><td>1</td></tr><tr><td></td><td>H</td><td>LYS</td><td>50</td><td>--</td><td>H</td><td>THR</td><td>51</td><td>:</td><td>2.90</td><td>:</td><td>-</td><td>0.09</td><td><</td><td>0.00></td><td>0.09</td><td>/</td><td>0.09</td><td>1</td></tr><tr><td></td><td>H</td><td>PHE</td><td>52</td><td>--</td><td>H</td><td>LYS</td><td>4</td><td>:</td><td>3.50</td><td>:</td><td>-</td><td>0.08</td><td><</td><td>0.00></td><td>0.08</td><td>/</td><td>0.08</td><td>1</td></tr><tr><td></td><td>HD2</td><td>PHE</td><td>52</td><td>--</td><td>H</td><td>GLU</td><td>27</td><td>:</td><td>3.50</td><td>:</td><td>*</td><td>0.39</td><td><</td><td>0.00></td><td>0.39</td><td>/</td><td>0.39</td><td>1</td></tr><tr><td></td><td>HA</td><td>PHE</td><td>52</td><td>--</td><td>H</td><td>ASP</td><td>46</td><td>:</td><td>3.50</td><td>:</td><td>*</td><td>0.23</td><td><</td><td>0.00></td><td>0.23</td><td>/</td><td>0.23</td><td>1</td></tr></table> </div>
  16. Hi all , I have some problems cleaning a text file for output it in an HTML page ... The source file contains something like this : ANGLES: 5- 10- 15- # Filename nvio max <5 10 20 20 >20 --------------------------------------------------------------------------------------------------------------- 1 min.out 0 0.00 0 0 0 0 0 OMEGAS: 5- 10- 15- # Filename nvio max <5 10 20 20 >20 --------------------------------------------------------------------------------------------------------------- 1 min.out 0 0.00 0 0 0 0 0 --------------------------------------------------------------------------------------------------------------- Distance and angle violations: First atom Last atom target Key: . = 0.0 - <= 0.1 + <= 0.2 * <= 0.5 0 <= 1.0 8 <= 2.0 @ > 2.0 Stats: Ave <std> min/max/# CD2 TRP 43 -- H PHE 30 : 6.00 : * 0.27 < 0.00> 0.27 / 0.27 1 CD2 TRP 43 -- HA LYS 31 : 3.30 : + 0.13 < 0.00> 0.13 / 0.13 1 CZ3 TRP 43 -- HA LYS 31 : 3.30 : * 0.35 < 0.00> 0.35 / 0.35 1 CH2 TRP 43 -- HA PHE 52 : 6.00 : * 0.31 < 0.00> 0.31 / 0.31 1 CH2 TRP 43 -- H THR 53 : 5.00 : + 0.17 < 0.00> 0.17 / 0.17 1 CH2 TRP 43 -- HA VAL 54 : 5.00 : * 0.23 < 0.00> 0.23 / 0.23 1 HA GLU 15 -- H LEU 7 : 2.90 : + 0.11 < 0.00> 0.11 / 0.11 1 H GLU 27 -- H LYS 28 : 2.90 : * 0.22 < 0.00> 0.22 / 0.22 1 HD2 PHE 30 -- HA THR 17 : 3.30 : 0 0.89 < 0.00> 0.89 / 0.89 1 HA LYS 31 -- H ALA 34 : 3.50 : + 0.12 < 0.00> 0.12 / 0.12 1 HD2 PHE 52 -- H GLU 27 : 3.50 : * 0.37 < 0.00> 0.37 / 0.37 1 HA PHE 52 -- H ASP 46 : 3.50 : * 0.20 < 0.00> 0.20 / 0.20 1 I just wanted to put the last part in a table , so I did this : $viol=file("$path/viol.out"); $to_replace="0"; foreach ($viol as $line ){ $is_match=preg_match('/violations/',$line); if ($is_match) { $to_replace="1"; echo "<table>"; } if ($to_replace==1){ echo "<tr>"; $line = eregi_replace(" +", " ", $line); $line=str_replace(array( "\r\n","\r", "\n", "\t"), '', $line); $string=explode(" ",$line); foreach ($string as $word){ echo "<td>$word</td>"; } echo "</tr>"; }else{ echo "$line<br/>"; } } echo "</table>" But I have some extra chars at the beginning of the table ... I almost solved it checking each word with trim() , but trim get rid of "0" too ... so I can't use it ... Some ideas ? Thx in advance David
  17. I think I wrote it wrong ... The array should be something similar ... Array[0] { Array[0] { id => 1 titolo => titolo1 weight => 2 } Array[1] { id => 2 titolo => titolo2 weight => 1 } } And then sorted by weight ...
  18. Hi all , I need to put values in an array , an url and a weight . And then sort all the elements in the array by weight . es.: url1 - weight 5 url2 - weight 4 url3 -weight 7 and then have them sorted more or less this way : url2 - weight4 url1 -weight5 url3 -weight7 ... I've tried this but i think I'm quite confused on something <?php $Menu=array(); function cmp($x, $y) { if ($x[1] == $y[1]) { return 0; } return ($x[1] > $y[1]) ? 1 : -1; } $titolo1="primo titolo"; $titolo2="secondo titolo"; $titolo3="terzo titolo"; $titolo1_peso="1"; $titolo2_peso="3"; $titolo3_peso="2"; //array_push($Menu,$titolo1); //array_push($Menu,$titolo2); //array_push($Menu,$titolo3); $Menu[]=$titolo1; $Menu[]=$titolo2; $Menu[]=$titolo3; $Menu["$titolo1"]=$titolo1_peso; $Menu["$titolo2"]=$titolo2_peso; $Menu["$titolo3"]=$titolo3_peso; usort($Menu,'cmp'); foreach ($Menu as $key => $value){ print "$key -- $value \n"; } ?> Can someone please help ? Many thx in advance David
  19. Thx for you replies ... Would be more efficient even If I destroy and re-create sessions ? This way I write a new session on the filesystem every time , the other way I'd make queries on the db ... Or maybe you was telling me that I should not recreate sessions ? I saw it's possible to save sessions on the db too , with session_set_save_handler() ... Security is very important in this case , because the web gives access to the resources of a grid of clusters .
  20. Hello all ... Just a question ... I'm writing code for a site that need authentication . The authentication part works with a certificate installed in the browser against a mysql db . When the user is authenticated I use sessions to pass data from one page to another , I save the session data in an array , destroy the session , create a new one and copy the data back . This to prevent hijacking of the session . My question is ... wouldn't be more secure to store all the data in a database instead of saving it in the session ? Or better , what are the advantages/disvantages to use session instead of using a db for this purpose ? Thx in advance David
  21. I've tried this : i've added a column pageid in the table menu and I add the id of the new inserted page there : $query="insert into page (l_index_id,titolo,testo,is_news,is_active,categoria) values ('$link_family','$titolo','$testo','0','$is_active','0')"; mysql_query($query) or die(mysql_error()); $pageid=mysql_insert_id(); $query="insert into menu (l_index_id,peso,menu_link,menu_title,is_title,pageid) values ('$link_family','$peso','$link_menu','$link_desc','$is_title','$pageid')"; mysql_query($query) or die(mysql_error()); Then I do : $query_page="select titolo,id,is_active from page where l_index_id='$l_index_id' and is_active='1'"; and $query2="select distinct * from menu where menu.pageid='$page_id'"; and it works ... It's correct ? Ciao David
  22. I'll try to explain "titolo" is the title of the page , while menu_title is the visible link of the menu . They are more or less the same , but in a page the title can be very large , while in the menu has to be shorter ( example : page title "This is the title of page 1" , menu title "page 1 " ) If it's short can be the same . The l_link_id is the family , the "subject" , of one ( or more ) pages . Example : parent -> Tuscany children ->Tuscany -> Florence ( active ) -> Pisa ( inactive ) -> Lucca ( active ) on the page Tuscany ( the default ) there will be the content of the page Tuscany , and on the menu the links to the page Tuscany and Florence and Lucca . Clicking on Florence will get you to the page Florence , with the same menu . Pisa should not be visible because inactive . many thx to both of you guys Ciao David
  23. I got this : mysql> select p.id, m.menu_link, m.peso, m.menu_title, m.is_title from page p inner join menu m on p.l_index_id = m.l_index_id where m.l_index_id = '4' and p.is_active='1' order by m.peso asc; +----+-----------+------+----------------+----------+ | id | menu_link | peso | menu_title | is_title | +----+-----------+------+----------------+----------+ | 4 | | 0 | toscana | 1 | | 5 | | 0 | toscana | 1 | | 4 | | 2 | prova immagine | 0 | | 5 | | 2 | prova immagine | 0 | +----+-----------+------+----------------+----------+ 4 rows in set (0.00 sec) What do you mean to add a foreign key to a table ? D.
×
×
  • 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.