Jump to content

simpli

Members
  • Posts

    165
  • Joined

  • Last visited

    Never

Posts posted by simpli

  1. I'm just afraid a customer will hack into the system and access another customer's data. I know about protecting about sql injection and I built that into my code but I can't help think what if. Also, what if I forget in one query to put the user key and the whole dataset becomes available to everyone. Isolating each customer in their own databases protects for this kinds of lapses.

    JR

  2. Hi,

    I am designing a commercial level system. I will have several corporate clients. Take for example Client A and Client B. By the nature of the service I'm going to be offering, they are going to be storing company sensitive data on my server. I would not want company A to have access to company B's data. Furthermore the site is gonna be using Ajax.

     

    I was thinking of applying the instance concept (as in World of Warcraft instance) where each customer would have an instance on my servers and they could do whatever they want in there without access or knowledge to other customers instances. For this to work however, each customer would need its own database which would basically be their own sandboxes. Does it make sense design-wise or am I overlooking something that would allow me to keep everyone in one database and be secure?

    Please don't tell me it's an Antipattern. I checked the antipattern presentation and it's not there so there's yet hope. Thanks for your input,

    J-R

  3. Hi,

    I have  phpMyAdmin - 2.11.7.1

    MySQL client version: 5.0.41

     

    I have a backup of my database. I inadvertently deleted one table and I would like to restore that table. I have created a database to receive the restored information but I have no idea how to proceed. I backed the data as csv. Some website say to click on sql and I should see a "Choose file" button. I see no such thing. Can anyone help me in the restore?

     

    Thanks,

    JR

  4. It would possibly all the information that is in the databases of the system, except maybe for the systems database. So all the user information they will possibly put in, if they want to build a report counting the number of people they have in their organization or the number of people in a certain category working at this location or whatever. Because they could want to pull all kind of information, it's almost impossible to create one report to rule them all therefore my need.

    JR

  5. Hi,

    I am going to build an application with php and mysql. In the end result, there are going to be a few tables with all sorts of data. I would like to build all the possible my customers would need and have them available with one tool or other in Ajax. I however know that it would be impossible for me to anticipate all my clients reporting needs. I was first thinking of building an "Advanced Reporting Module" in my application (like business objects) where they can create their own reporting in an Ajax environment with the matching responsiveness. Before embarking on something as ambitious as that however, I was wondering if anyone know a product (commercial or otherwise) that gives this kind of service. I would add that module on top of my database and this would give the users the access to the underlying data for reporting purposes.

     

    Thanks for sharing anything you think can help.

    JR

  6. Hi,

    I am in the designing part of creating a client server AJAX application. I will need to represent hierarchical data. I know there are two big schools of thought for representing such data: The adjacency model and the nested set.It's nightmarish to use adjacency with SQL because it's just awkward to code and gets complicated as the number of levels increase. Nested models is however very slow for trees where we will write because a lot of data needs to be moved around upon insertion. I know for a fact that my tree structure will be big and will have to be able to handle inserts gracefully. Does that condemn me to using the Adjacency model? In what I've read out there, there's always mention of a third option that would overcome the shortcomings of either method but I've never seen any sign of it. Anyone has a clue about that third method?

     

    Can anyone php libraries for either method?

     

    Thanks,

    JR

  7. Hi,

    two months ago at the beginning of a little project I chose to use phpliblogin to create, manage users and give them access to my php application. It worked perfectly until I put it online and tried to access it from the outside world and boom it's not working from the outside for some reason. Now I feel it's too late as I can't troubleshoot it but the question remains: Can someone recommend a user authentication management solution that is tested, and has good features. Two months ago I would have wanted one that's free but in all honesty I'm more than willing to pay provided I can get some support when something is not working. Also it needs to be something that's maintained, not like phpliblogin.

     

    Thanks in advance JR

  8. Hi,

    before I go any further I wanna say I read the header error primer. This isn't my first time dealing with header error but I haven't been able to clear this one and I am so close to a deadline. Also I am using a login library (phpliblogin) and I don't know if it's messing with my code.

     

    The error message I have is

    session_register() [<a href='function.session-register'>function.session-register</a>]: Cannot send session cache limiter - headers already sent (output started at /Applications/MAMP/htdocs/choice_round_1.php:1) in /Applications/MAMP/htdocs/php_lib_login_includes/login.inc.php on line 247

     

    Now I checked the code in my script and there is no invisible character and nothing that is output before i call the header. Can anyone help me?

    This is the whole code in my php file.

    <?php
        // standard stuff php_lib_login needs to have
        include('php_lib_login_includes/login.inc.php');
    $nombre_joueurs = 10;
    if(lib_login_valid_user())
    {
        // call this to protect the page
        $user = lib_login_protect_page();
    //Validation of players		
    	$error_validation=array(); //initialize $error to empty array
    
    
    //If we get here as a result of the submit button having been pushed: We are going to validate the data
    if(isset($_POST['submit'])){
    	global $nombre_joueurs;
    
    	$nbjoueurs = $nombre_joueurs;
    	$arrayPlayers[] = array();
    	$arrayCount = array();
    
    
    	for ($i=1; $i <= $nbjoueurs; $i++)
    	{
    		if(trim($_POST['player_' . $i])=='') {
    			$error_validation['player_' . $i] = "Votre joueur #" . $i . " n'a pas ete choisi!<br />"; 
    		}
    		else{
    //If player fields are not empty we place the 10 chosen players in an array that will be used to validate the duplicates
    			$arrayPlayers[$i-1] = $_POST['player_' . $i];
    		}
    	}
    
    
    
    //Validation of matchups
    	if(!isset($_POST['m_1vs8East'])){
    		$error_validation['m_1vs8East'] .="Vous devez choisir un gagnant pour l'affrontement 1 Vs 8 Est!<br />"; 
    	}
    	if(!isset($_POST['m_2vs7East'])){
    		$error_validation['m_2vs7East'] ="Vous devez choisir un gagnant pour l'affrontement 2 Vs 7 Est!<br />"; 
    	}
    	if(!isset($_POST['m_3vs6East'])){
    		$error_validation['m_3vs6East'] ="Vous devez choisir un gagnant pour l'affrontement 3 Vs 6 Est!<br />"; 
    	}
    	if(!isset($_POST['m_4vs5East'])){
    		$error_validation['m_4vs5East'] ="Vous devez choisir un gagnant pour l'affrontement 4 Vs 5 Est!<br />"; 
    	}
    	if(!isset($_POST['m_1vs8West'])){
    		$error_validation['m_1vs8West'] ="Vous devez choisir un gagnant pour l'affrontement 1 Vs 8 Ouest!<br />"; 
    	}
    	if(!isset($_POST['m_2vs7West'])){
    		$error_validation['m_2vs7West'] ="Vous devez choisir un gagnant pour l'affrontement 2 Vs 7 Ouest!<br />"; 
    	}
    	if(!isset($_POST['m_3vs6West'])){
    		$error_validation['m_3vs6West'] ="Vous devez choisir un gagnant pour l'affrontement 3 Vs 6 Ouest!<br />"; 
    	}
    	if(!isset($_POST['m_4vs5West'])){
    		$error_validation['m_4vs5West'] ="Vous devez choisir un gagnant pour l'affrontement 4 Vs 5 Ouest!<br />"; 
    	}
    
    	$arrayCount = array_count_values($arrayPlayers);
    	foreach ($arrayCount as $key => $arrayCount)
    	{
    
    		if($arrayCount.$key >1){
    			$error_validation[$key] = $key . " ne peut etre choisi plus d'une fois <br />";
    		}
    
    	}
    
    //There are no errors we can write to database
    	if(empty($error_validation)){
    //If data has been validated correctly we open connection to the database and we start writing to it.	    
        	include('config.php');
        	include('opendb.php');
        
    		addmatchups($conn);
    		addfinalist($conn);
    		addChampion($conn);
    		addGoalie($conn);
    		addPlayers($conn);
    		mysql_close($conn);	
    //After writing to table, redirect to results page
    		header("Location: http://localhost:8003/showresults.php"); 	
    	}
    }
    //if $error = success: We come here as a result of a successful account creation and we will show no error message
    proceed_show_form($error_validation);
    
    
    }
    
    
    function proceed_show_form($error_v){
    //We come here if the form is showed for the first time (not a result of the submit button	 
    //We do all this only if the user has been authenticated
    
    //html page header info
    print <<<htmldebut1
    <form id="frmchoixronde1" name="frmchoixronde1"  method="POST" 
    enctype="application/x-www-form-urlencoded" onsubmit='return formValidator()'>
    <html><head>
    <META HTTP-EQUIV="Content-Type" content="text/html; charset=utf-8">
    <META HTTP-EQUIV="Content-Language" CONTENT="fr-CA">
    <title>Page des poolers</title>
    htmldebut1;
    
        include('textmenu.css');
        include('validate.js');
        include('optionsmenu.php');
    print <<<htmldebut2
    </head>
    <body>
    <b>Entrez vos choix pour la première ronde</b>
    htmldebut2;
    
    // Connects to the pool database
        include('config.php');
        include('opendb.php');
    
    retrieveMatchups(1,'East',$conn,$error_v);    
    retrieveMatchups(1,'West',$conn,$error_v);    
    chooseFinalist('East','one',$conn);
    chooseFinalist('West','two',$conn);
    chooseChampion($conn);
    chooseGoaltender($conn);
    choosePlayers($error_v);
    
    mysql_close($conn);	
    echo '<input type="submit" name="submit" value="Soumettre vos choix">';
    if(!empty($error_v)){
    	echo '<fieldset class="six" style="width:450px">';
    	echo '<legend>Erreurs</legend>';
    	echo implode( $error_v);
    	echo '</fieldset>';
    }
    
    
    
    
    }
    //End of the form
    echo '</form></br> </body></html> '
    ?>
    <?php
    function retrieveMatchups($round, $conference, $conn,$error){
    //We retrieve the matchup list for the Eastern conference
    $sql_matchup =<<<SQL
    	SELECT	*
    	FROM	matchup where matchup_name like '%$conference' and round=$round order by matchup_number
    SQL;
    $lconn = $conn;
    
    $result = mysql_query($sql_matchup ,$conn);
    if(!$result) die("Query Failed.");
    
    //Shows Eastern conference matchups
    echo '</br>';
    echo '<fieldset>';
    echo '<legend>'. $conference . '</legend>'. "\n";
    while($row =mysql_fetch_assoc($result)) {
    
    echo '<label for="' . 'm_' . $row["matchup_name"] . '_1"'. (isset($error['m_' . $row["matchup_name"]]) ? ' class="error"' :'') .'>'  . '<input name="' .'m_' .  $row["matchup_name"] .'" type="radio" id="' .'m_' . $row["matchup_name"] . '_1"' .   ' value="' . $row["team1"] . '"';
    if(isset($_POST['m_' . $row["matchup_name"]]))
    echo ($_POST['m_' . $row["matchup_name"]] == $row["team1"]? ' checked' : '');
    echo '">' . $row["team1"] . '</label>' . "\n"; 
    echo '<label for="' . 'm_' . $row["matchup_name"] . '_2"'. (isset($error['m_' . $row["matchup_name"]]) ? ' class="error"' :'') .'>'  . '<input name="' .'m_' . $row["matchup_name"]  .'" type="radio" id="' .'m_' . $row["matchup_name"] . '_2"' .  ' value="' . $row["team2"] .  '"';
    
    if(isset($_POST['m_' . $row["matchup_name"]]))
    echo ($_POST['m_' . $row["matchup_name"]] == $row["team2"]? ' checked' : '');
    echo '">' . $row["team2"] . '</label>' . "\n"; 
    
    
    echo ' <select name="'. 'nbmatch_'.$row["matchup_name"] . '">';
    echo '<option selected="selected">4<option>5<option>6<option>7</select>';
    echo '</br>' . "\n";
    }
    echo '</fieldset>';
    }
    
    function chooseFinalist($conference, $class,$conn)
    {
    //choice of Eastern finalist
    
    //We retrieve the matchup list for the Western conference
    $sql_finalist =<<<SQL
    SELECT *
    FROM playoff_teams
    WHERE conference = '$conference'
    ORDER BY rank
    SQL;
    
    $lconn = $conn;
    
    $result = mysql_query($sql_finalist ,$lconn);
    if(!$result) die("Query Failed.");
    
    
    echo '<fieldset class="' . $class .'" style="width:200px">' . "\n";
    
    echo '<legend>Finaliste  ' . ($conference == "West" ? "Ouest" : "Est"). '</legend>' . "\n";
    echo ' <select name="'. 'finalist' . $conference . '">' . "\n";
    //Lists all the potential finalists of the specied conference
    
    
    while($row =mysql_fetch_assoc($result)) {
    echo '<option';
    
    if(isset($_POST['finalist' . $conference])){
    	if($_POST['finalist' . $conference] == trim($row["name"]))
    		echo ' selected="selected"';
    }
    
    echo '>' . trim($row["name"]) . "\n";
    }
    
    echo '</select>';
    echo '</fieldset>';
    echo '</br>' . "\n";
    
    }
    
    function chooseChampion($conn)
    {
    //Choice of Stanley cup champion
    $lconn = $conn;
    
    //We retrieve the matchup list for the Western conference
    $sql_champion =<<<SQL
    SELECT *
    FROM playoff_teams
    ORDER BY rank, conference
    SQL;
    
    
    $result = mysql_query($sql_champion ,$lconn);
    if(!$result) die("Query Failed.");
    
    
    echo '<fieldset class="three" style="width:100">';
    echo '<legend>Champion</legend>';
    echo ' <select name="champion">' . "\n";
    //List of all the potential Stanley cup champions
    
    while($row =mysql_fetch_assoc($result)) {
    echo '<option';
    
    
    if(isset($_POST['champion'])){
    	if($_POST['champion'] == trim($row["name"]))
    		echo ' selected="selected"';
    }
    
    echo '>' . trim($row["name"]) . "\n";
    }
    
    echo '</select>';
    echo '</fieldset>';
    echo '</br>' . "\n";
    }
    
    function chooseGoaltender($conn)
    {
    
    //Choice of goaltender
    
    //We retrieve the matchup list for the Western conference
    $sql_goalie =<<<SQL
    SELECT goalies.name
    FROM goalies, playoff_teams
    WHERE goalies.team = playoff_teams.short_name
    SQL;
    
    $lconn = $conn;
    
    $result = mysql_query($sql_goalie ,$lconn);
    if(!$result) die("Query Failed.");
    
    
    echo '<fieldset class="four">';
    echo '<legend>Votre gardien</legend>';
    echo ' <select name="goalie">' . "\n";
    //List of all the potential Stanley cup champions
    
    
    while($row =mysql_fetch_assoc($result)) {
    echo '<option';
    if(isset($_POST['goalie'])){
    	if($_POST['goalie'] == trim($row["name"]))
    		echo ' selected="selected"';
    }
    echo '>' . trim($row["name"]) . "\n";
    
    }
    
    echo '</select>';
    echo '</fieldset>';
    echo '</br>';
    }
    
    function addmatchups($conn)
    {
    $round = 1;
    global $user;
    $luser = $user;
    
    $lconn = $conn;
    
    $luser = mysql_real_escape_string($user);
    //We retrieve the matchup list for the Western conference
    $sql_matchup =<<<SQL
    SELECT 'username' from matchup_choices where matchup_choices.username ='$luser';
    SQL;
    
    
    $result = mysql_query($sql_matchup ,$lconn);
    $num_rows = mysql_num_rows($result);
    
    //The user of which we are trying to write the matchup does not exist so we can add it
    if($num_rows == 0){
    //We add the matchups
    
    //Eastern conference
    	$choice_1vs8East = mysql_real_escape_string($_POST['m_1vs8East']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_1vs8East']);
    	addMatchupLines($luser, $round, '1vs8East', $choice_1vs8East, $number_matches, $lconn);
    
    	$choice_2vs7East = mysql_real_escape_string($_POST['m_2vs7East']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_2vs7East']);
    	addMatchupLines($luser, $round, '2vs7East', $choice_2vs7East, $number_matches, $lconn);
    
    	$choice_3vs6East = mysql_real_escape_string($_POST['m_3vs6East']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_3vs6East']);
    	addMatchupLines($luser, $round, '3vs6East', $choice_3vs6East, $number_matches, $lconn);
    
    	$choice_4vs5East = mysql_real_escape_string($_POST['m_4vs5East']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_4vs5East']);
    	addMatchupLines($luser, $round, '4vs5East', $choice_4vs5East, $number_matches, $lconn);
    
    //Western conference
    	$choice_1vs8West = mysql_real_escape_string($_POST['m_1vs8West']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_1vs8West']);
    	addMatchupLines($luser, $round, '1vs8West', $choice_1vs8West, $number_matches, $lconn);
    
    	$choice_2vs7West = mysql_real_escape_string($_POST['m_2vs7West']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_2vs7West']);
    	addMatchupLines($luser, $round, '2vs7West', $choice_2vs7West, $number_matches, $lconn);
    
    	$choice_3vs6West = mysql_real_escape_string($_POST['m_3vs6West']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_3vs6West']);
    	addMatchupLines($luser, $round, '3vs6West', $choice_3vs6West, $number_matches, $lconn);
    
    	$choice_4vs5West = mysql_real_escape_string($_POST['m_4vs5West']);
    	$number_matches = mysql_real_escape_string($_POST['nbmatch_4vs5West']);
    	addMatchupLines($luser, $round, '4vs5West', $choice_4vs5West, $number_matches, $lconn);
    
    
    }else
    {
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Les choix ont deja ete faits';
    		echo '</fieldset>';
    }
    
    }
    
    
    function addPlayers($conn)
    {
    global $nombre_joueurs;
    $nbjoueurs = $nombre_joueurs;
    global $user;
    $luser = $user;
    
    $lconn = $conn;
    
    $luser = mysql_real_escape_string($user);
    //We retrieve the matchup list for the Western conference
    $sql_players =<<<SQL
    SELECT 'username' from players_choices where players_choices.username ='$luser';
    SQL;
    
    
    $result = mysql_query($sql_players ,$lconn);
    $num_rows = mysql_num_rows($result);
    
    //The user of which we are trying to write the matchup does not exist so we can add it
    if($num_rows == 0){
    //We add the 10 players
    for ($i=1; $i <= $nbjoueurs; $i++)
    {
    	$player = mysql_real_escape_string($_POST['player_'.$i]);
    	addPlayersLines($luser,$player, $lconn);
    }
    
    
    }else
    {
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Les choix de joueurs ont deja ete faits';
    		echo '</fieldset>';
    }
    
    }
    
    
    function addfinalist($conn)
    {
    global $user;
    $luser = $user;
    
    $lconn = $conn;
    
    $luser = mysql_real_escape_string($user);
    //We retrieve the matchup list for the Western conference
    $sql_finalist =<<<SQL
    SELECT 'username' from finalists_choices where finalists_choices.username ='$luser';
    SQL;
    
    
    $result = mysql_query($sql_finalist ,$lconn);
    $num_rows = mysql_num_rows($result);
    
    //The user of which we are trying to write the matchup does not exist so we can add it
    if($num_rows == 0){
    //We add the matchups
    
    //On recupere les finalistes
    	$finalistEast = mysql_real_escape_string($_POST['finalistEast']);
    	$finalistWest = mysql_real_escape_string($_POST['finalistWest']);
    	addfinalistLines($luser, "East", $finalistEast,$lconn);
    	addfinalistLines($luser, "West", $finalistWest,$lconn);
    
    //Western conference
    
    }else
    {
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Les choix des finalistes ont deja ete faits';
    		echo '</fieldset>';
    }
    
    }
    
    function addChampion($conn)
    {
    global $user;
    $luser = $user;
    
    $lconn = $conn;
    
    $luser = mysql_real_escape_string($user);
    //We retrieve the matchup list for the Western conference
    $sql_matchup =<<<SQL
    SELECT 'username' from champions_choices where champions_choices.username ='$luser';
    SQL;
    
    
    $result = mysql_query($sql_matchup ,$lconn);
    $num_rows = mysql_num_rows($result);
    
    //we add the user's champion
    if($num_rows == 0){
    	$champion = mysql_real_escape_string($_POST['champion']);
    	addChampionsLine($luser, $champion,$lconn);
    
    }else
    {
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Les choix du champion ont deja ete faits';
    		echo '</fieldset>';
    }
    
    }
    
    function addgoalie($conn)
    {
    global $user;
    $luser = $user;
    
    $lconn = $conn;
    
    $luser = mysql_real_escape_string($user);
    //We retrieve the matchup list for the Western conference
    $sql_matchup =<<<SQL
    SELECT 'username' from goalies_choices where goalies_choices.username ='$luser';
    SQL;
    
    
    $result = mysql_query($sql_matchup ,$lconn);
    $num_rows = mysql_num_rows($result);
    
    //we add the user's champion
    if($num_rows == 0){
    	$goalie = mysql_real_escape_string($_POST['goalie']);
    	addGoaliesLine($luser, $goalie, $lconn);
    
    }else
    {
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Les choix du champion ont deja ete faits';
    		echo '</fieldset>';
    }
    
    }
    function addfinalistLines($user,$conference, $finalist, $connection)
    {
    	$sql_insert =<<<SQL
    insert into finalists_choices(username, conference, finalist) values 
    ('$user' , '$conference', '$finalist');
    SQL;
    
    	$result = mysql_query($sql_insert ,$connection);
    	if(!$result){
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Erreur a l\'insertion finalistes';
    		echo '</fieldset>';
    
    	}
    
    }
    
    function addChampionsLine($user, $champion, $connection)
    {
    	$sql_insert =<<<SQL
    insert into champions_choices(username, champion) values 
    ('$user' , '$champion');
    SQL;
    
    	$result = mysql_query($sql_insert ,$connection);
    	if(!$result){
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Erreur a l\'insertion champion';
    		echo '</fieldset>';
    
    	}
    
    }
    
    function addGoaliesLine($user, $goalie, $connection)
    {
    	$sql_insert =<<<SQL
    insert into goalies_choices(username, goalie) values 
    ('$user' , '$goalie');
    SQL;
    
    	$result = mysql_query($sql_insert ,$connection);
    	if(!$result){
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Erreur a l\'insertion du gardien';
    		echo '</fieldset>';
    
    	}
    
    }
    
    
    function addMatchupLines($user, $round, $matchup, $choice, $games, $connection)
    {
    	$sql_insert =<<<SQL
    insert into matchup_choices(username, round, matchup, choice, number_matches) values 
    ('$user' , $round, '$matchup', '$choice', $games);
    SQL;
    
    	$result = mysql_query($sql_insert ,$connection);
    	if(!$result){
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Erreur a l\'insertion matchup';
    		echo '</fieldset>';
    
    	}
    
    }
    
    function addPlayersLines($user, $player, $connection)
    {
    	$sql_insert =<<<SQL
    insert into players_choices(username, player) values 
    ('$user' , '$player');
    SQL;
    
    	$result = mysql_query($sql_insert ,$connection);
    	if(!$result){
    		echo '<fieldset class="six" style="width:450px">';
    		echo '<legend>Erreurs</legend>';
    		echo 'Erreur a l\'insertion joueurs';
    		echo '</fieldset>';
    
    	}
    
    }
    
    
    function choosePlayers($error)
    {
    //Choix des dix joueurs
    global $nombre_joueurs;
    $nbjoueurs = $nombre_joueurs;
    
    echo '</br>';
    echo '<fieldset>' . "\n";
    
    echo '<ol>' . "\n";
    for ($i=1; $i <= $nbjoueurs; $i++)
    {
    echo '<li><input name="player_' . $i . '" id="player_' .$i . '"' . (isset($error["player_" . $i]) ? ' class="error"' :'');
    echo 'value="';
    if(isset($_POST['player_' . $i]))
    	echo $_POST['player_' . $i] ;
    echo '" type="text" size="30"></li></br>' . "\n";
    
    }
    echo '</ol>';
    echo '</fieldset>';
    
    }
    ?>
    

     

  9. Hi,

    I've been making some progress with the collapse of my tbody but I have one ultimate problem:

    Right now I can make the detail rows collapse and expand. The only problem is I want when the page load to have everything collapsed. I tried creating a function that collapses all the tbodys but it collapses EVERYTHING in sight. Apparently a table row outside a tbody is also a considered a tbody inside. How could I proceed to not hide my summary rows in the process?

     

    You can try the standalone html below to see what I mean. Also Can anyone try this in IE to tell me if it works? I'm on a mac and I have no way to test it.

     

    Thanks,

    Here's my code

    <style type="text/css">
    
    
    /*tbody.corps{
    display:block;
    }*/
    </style>
    
    
    <script type='text/javascript'>
    
    function showHide(EL)
    {
    ELpntr=document.getElementById(EL);
    if (ELpntr.style.display=='none')
    {
    	ELpntr.style.display="";
    }
    else
    {
    	ELpntr.style.display='none';
    }
    }
    
    function hideall()
    {
    locl = document.getElementsByTagName('tbody');
    for (i=0;i<locl.length;i++)
    {
    	locl[i].style.display='none';
    }
    }
    
    /*onload=hideall;*/
    </script>
    
    
    
    
    <html><head><title>Resultats</title></head> <body></br><table width=400><tr>
    <td width=200>Nom/Choix</td><td width=50>Points</td><td width=50>Points bonis</td><td width=50>total</td></tr>
    
    <tr BGCOLOR="#99CCFF" onclick="showHide('tb_jeanru')">
    <td>jeanru</td><td>0</td><td>0</td><td>0</td></tr>
    <tbody id='tb_jeanru' ><td>Boston en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Washington en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Florida en 4</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>Philadelphie en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Dallas en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Minnesota en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Calgary en 4</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>Chicago en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>adbnmasd</td><td>0</td><td>0</td><td>0</td></tr>
    <td>adlkj</td><td>0</td><td>0</td><td>0</td></tr>
    <td>alexandre daigle</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>bnmsdoij</td><td>0</td><td>0</td><td>0</td></tr>
    <td>jadflkj</td><td>0</td><td>0</td><td>0</td></tr>
    <td>mouch</td><td>0</td><td>0</td><td>0</td></tr>
    <td>nmsd</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>picard</td><td>0</td><td>0</td><td>0</td></tr>
    <td>picouille</td><td>0</td><td>0</td><td>0</td></tr>
    <td>pouti</td><td>0</td><td>0</td><td>0</td></tr>
    <tr>
    <td>Roberto Luongo</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>Finaliste: San Jose</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Finaliste: boston</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Champion: boston</td><td>0</td><td>0</td><td>0</td></tr>
      </tbody>
    
    <tr BGCOLOR="#99CCFF" onclick="showHide('tb_lisa')">
    <td>lisa</td><td>0</td><td>0</td><td>0</td></tr>
    <tbody id='tb_lisa' ><td>Boston en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>New York Rangers en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Florida en 4</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>Montreal en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Dallas en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Detroit en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Calgary en 4</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>Vancouver en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <td> a,mdfnlok</td><td>0</td><td>0</td><td>0</td></tr>
    <td> bamnbdfljk</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>adfkjl</td><td>0</td><td>0</td><td>0</td></tr>
    <td>adkfjl</td><td>0</td><td>0</td><td>0</td></tr>
    <td>aldfjlj</td><td>0</td><td>0</td><td>0</td></tr>
    <td>ddfasddfa</td><td>0</td><td>0</td><td>0</td></tr>
    
    <td>la,dmnfm</td><td>0</td><td>0</td><td>0</td></tr>
    <td>lkkjadlfjk</td><td>0</td><td>0</td><td>0</td></tr>
    <td>mn,adfpolk</td><td>0</td><td>0</td><td>0</td></tr>
    <td>nmad,mn</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tr>
    <td>Roberto Luongo</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Finaliste: San Jose</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Finaliste: boston</td><td>0</td><td>0</td><td>0</td></tr>
    <td>Champion: boston</td><td>0</td><td>0</td><td>0</td></tr>
    
      </tbody>
    <tr BGCOLOR="#99CCFF" onclick="showHide('tb_maggie')">
    <td>maggie</td><td>0</td><td>0</td><td>0</td></tr>
    <tbody id='tb_maggie' >  </tbody>
    </table></br> </body></html> 
    
    

  10. Hi,

    My accented characters are still not working. I am on FF on a mac. When I do page info I see the following encoding: ISO-8859-1. I believe this encoding allows accented french characters right? My firefox is an english version however. Is it the reason I cannot see the accents? Or is there some other setting I have to take care of?

     

    Thanks for helping.

    J-R

  11. Hi,

    I have a table with some total user data and the underlying detail. I want it that when the user click on the summary rows that the table expands to show the underlying data. I am on firefox on a mac. What I do is I use CSS to have all the detail  tbodies to start collapsed:

     

    tbody.corps{
    display:none;
    }
    

     

    On the click event in the summary table rows I have this function, which I have corrected after recommendations from people in this forum. id_tb is a table body id .

    function ShowHide(id_tb)
    {
       var tablebody = document.getElementById(id_tb)
       if (tablebody.style.display == "block"){
          document.getElementById(id_tb).style.display="none";
       }else{
          document.getElementById(id_tb).style.display="block";
       }
    }
    

     

    This code is unfortunately not working. When I use block my summary rows stay the same and the tbody rows expand but at the very bottom of the whole table. Not good. When I use

    function ShowHide(id_tb)
    {
       var tablebody = document.getElementById(id_tb)
       if (tablebody.style.display == ""){
          document.getElementById(id_tb).style.display="none";
       }else{
          document.getElementById(id_tb).style.display="";
       }
    }
    

    nothing happens whatsoever in the onclick event. Can anyone tell me what I am doing incorrectly? I'd like a solution that works cross browser but right now a solution that work in FF would be good for my soul and I could try for cross-browser bliss later. Any help is really welcome cause I'm really stuck.

    Thanks,

    J-R

  12. Hi,

    thank you for your help but I'm not sure I understand how the code you posted is better. To get the state variable you pass as parameter you are still going to test tablebody.style.display == "", no? Please correct me if I'm wrong. I did some troubleshooting tonight: I do enter the function but it just never change the style so the tbody elements don't show. Any idea why?

  13. Hi,

    Anyone can tell me why this function (showHide) isn't being called?

    Thanks

    <style type="text/css">
    
    
    table
    {
    position:relative;
    left:25em;
    top:6em;
    }
    
    .error{
    background-color: red;
    }
    
    
    tbody.corps{
    display:none;
    }
    </style>
    
    
    <script type='text/javascript'>
    
    function ShowHide( id_tb)
    {
    var tablebody = document.getElementById(id_tb)
    if (tablebody.style.display == ""){
    	javascript:document.getElementById(id_tb).style.display="none";
    }else{
    	javascript:document.getElementById(id_tb).style.display="";
    }
    }
    
    function HideTable( id_tb)
    {
    var tablebody = document.getElementById(id_tb)
    	javascript:document.getElementById(id_tb).style.display="none";
    }
    
    </script>
    
    
    
    
    <html><head><title>Resultats</title></head> <body></br><table width=400><tr>
    <td width=200>Nom/Choix</td><td width=50>Points</td><td width=50>Points bonis</td><td width=50>total</td></tr>
    
    <tr TR BGCOLOR="#99CCFF" onclick="ShowHide('tb_isabelle')"><td>isabelle</td><td>0</td><td>0</td><td>0</td></tr>
    <tbody id="tb_isabelle" class="corps">  </tbody><tr TR BGCOLOR="#99CCFF" onclick="ShowHide('tb_jeanru')"><td>jeanru</td><td>0</td><td>0</td><td>0</td></tr>
    <tbody id="tb_jeanru" class="corps"><tr><td>Boston en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>New York Rangers en 4</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tr><td>Florida en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>Philadelphie en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <tr><td>San Jose en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>Detroit en 4</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tr><td>Calgary en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>Chicago en 4</td><td>0</td><td>0</td><td>0</td></tr>
    <tr><td>blloo</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>dark</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tr><td>do</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>elves</td><td>0</td><td>0</td><td>0</td></tr>
    <tr><td>jarome</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>martin</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tr><td>Pavel Datsyuk</td><td>93</td><td>0</td><td>93</td></tr>
    <tr bgcolor="	#B4CFEC"><td>racine</td><td>0</td><td>0</td><td>0</td></tr>
    <tr><td>Sidney Crosby</td><td>99</td><td>0</td><td>99</td></tr>
    <tr bgcolor="	#B4CFEC"><td>warcraf</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tr>
    <td>Carey Price</td><td>23</td><td>2</td><td>25</td></tr>
    <tr bgcolor="	#B4CFEC"><td>Finaliste: San Jose</td><td>0</td><td>0</td><td>0</td></tr>
    <tr><td>Finaliste: boston</td><td>0</td><td>0</td><td>0</td></tr>
    <tr bgcolor="	#B4CFEC"><td>Champion: boston</td><td>0</td><td>0</td><td>0</td></tr>
    
      </tbody><tr TR BGCOLOR="#99CCFF" onclick="ShowHide('tb_patrick01')"><td>patrick01</td><td>0</td><td>0</td><td>0</td></tr>
    <tbody id="tb_patrick01" class="corps">  </tbody><tr TR BGCOLOR="#99CCFF" onclick="ShowHide('tb_patrick02')"><td>patrick02</td><td>0</td><td>0</td><td>0</td></tr>
    
    <tbody id="tb_patrick02" class="corps">  </tbody></table></br> </body></html> 
    
    
    
    
    

  14. Hi,

    I think I need to create a custom even when the table I'm building is done loading so I can collapse the different tbodys in it. Can anyone has a simple example of an event creation and further usage? I tried finding some in the internet but they look either fishy or complicated.

     

    Thanks,

    J-R

  15. Hi,

    I have a radio button that my server has flagged in error. I want that when a radio button is identified as such, its background turns red.

     

    I have added a ternary operator that verify if the field has been returned in error and if it does it adds the class error to it. In my CSS the class error is identified with a red background. That should be enough to color my radio button's background red right? Further more I have added a radio.error rule so that any radio button who's in error has his background turned red. I also wanted to circle it that's why I created this second rule. As I understand CSS my first rule should have turned the background red.

     

    My problem is the background of the radio button doesn't turn red. I used a similar rule on a text field and it works fine. You can  verify with sample code below.

     

    Your help is welcome and thanks and advance.

    <html><head><title>Page des poolers</title><style type="text/css">
    
    .error{
    background-color: red;
    }
    
    radio.error{
    background-color: red;
    }
    
    </style>
    </head>
    <body>
    <b>Entrez vos choix pour la premiere ronde</b></br><fieldset><input type="hidden" name="PHPSESSID" value="0aef40012ce422c3c40eb6eea79940db" /><legend>East</legend>
    
    <label for="m_1vs8East_1"><input name="m_1vs8East" class="error" type="radio" id="m_1vs8East_1" value="Boston">Boston</label>
    <label for="m_1vs8East_2"><input name="m_1vs8East" class="error" type="radio" id="m_1vs8East_2" value="Buffalo">Buffalo</label>
    <select name="nbmatch_1vs8East"><option selected="selected">4<option>5<option>6<option>7</select></br>
    <label for="m_2vs7East_1"><input name="m_2vs7East" class="error" type="radio" id="m_2vs7East_1" value="Washington">Washington</label>
    <label for="m_2vs7East_2"><input name="m_2vs7East" class="error" type="radio" id="m_2vs7East_2" value="New York Rangers">New York Rangers</label>
    <select name="nbmatch_2vs7East"><option selected="selected">4<option>5<option>6<option>7</select></br>
    
    <ol>
    <li><input name="player_9" id="player_9" type="text" size="30"></li></br>
    <li><input name="player_10" id="player_10" class="error" type="text" size="30"></li></br>
    </ol></fieldset><fieldset class="six" style="width:450px"><input type="hidden" name="PHPSESSID" value="0aef40012ce422c3c40eb6eea79940db" />
    <legend>Erreurs</legend>Votre joueur #10 n'a pas ete choisi!<br />Vous devez choisir un gagnant pour l'affrontement 1 Vs 8 Est!<br />Vous devez choisir un gagnant pour l'affrontement 2 Vs 7 Est!<br /></fieldset></form>
    </br> 
    </body></html> 
    
    
    
    
    

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