Post variables

Author Message

Fabien Mas

Thursday 29 March 2007 5:56:46 am

I want to send a form to register a new user in the session variables, but It doesn't work
Sometimes the php code detect a my post variable "BtConnecter", sometimes not !
Is it because of the cache ?

Here my php code

...
include_once('extension/fichedecommunication/classes/iagmanifestation_user.php');

//-- init
$http =eZHttpTool::instance();


if($http->postVariable('BtConnecter')!="")
{	
 iagManifestation_User::CheckLogin($http->postVariable("TLogin"),$http->postVariable("TPassword"));
	$user= iagManifestation_User::CurrentUser();
	if (  $user )
	{	
		$http->headerVariable("Location","/fichedecommunication/manifestation");
	}
}

Here is a part of my iagManifestation_User class

        function CheckLogin($log,$passw)
	{			
		$http =& eZHttpTool::instance();	
		$db =& eZDB::instance();		
		$logArray = $db->arrayQuery("SELECT ID FROM iagManifestation_User WHERE Login='$log' AND Password='$passw';" );		
		if(count($logArray)>0 && $logArray[0]["ID"]>0)
		{							
			$http->setSessionVariable('iagManifestationUser', new iagManifestation_User($logArray[0]["ID"]));														
		}
		else
		{
			$http->setSessionVariable('iagManifestationUser', '');

		}		
	}
	function CurrentUser()
    {   
    	$http =eZHttpTool::instance();    	
    	$currentuser = $http->sessionVariable('iagManifestationUser');    	
        if (  get_class( $currentuser ) == strtolower('iagManifestation_User') )
        {                
            return $currentuser;
        }
        return ;
    }

Here is my template

{set-block scope=root variable=cache_ttl}0{/set-block}
<form method="post" action="" name="fmanifestationlogin">
<table cellpadding="8" cellspacing="10">
	<tr>
		<td>{'Login'|i18n( 'iagManifestation_manifestation' )}</td>
		<td><input type="text" name="TLogin" value="{$login}" /></td>
	</tr>
	<tr>
		<td>{'Mot de passe'|i18n( 'iagManifestation_manifestation' )}</td>
		<td><input type="password" name="TPassword" value="" /></td>
	</tr>
	<tr>
		<td></td>
		<td><input type="submit" name="BtConnecter" value="Se connecter" /></td>
	</tr>
</table>
</form>

Fabien Mas

Thursday 29 March 2007 6:10:08 am

It works now, but I had to change my session variable :
before I saved the object( iagManifestation_User )
Now I save the object ID and create a new user in the currentuser function

Powered by eZ Publish™ CMS Open Source Web Content Management. Copyright © 1999-2014 eZ Systems AS (except where otherwise noted). All rights reserved.

eZ debug

Timing: Jan 19 2025 01:09:51
Script start
Timing: Jan 19 2025 01:09:51
Module start 'layout'
Timing: Jan 19 2025 01:09:51
Module start 'content'
Timing: Jan 19 2025 01:09:52
Module end 'content'
Timing: Jan 19 2025 01:09:52
Script end

Main resources:

Total runtime0.9108 sec
Peak memory usage4,096.0000 KB
Database Queries52

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0101 589.0313152.6094
Module start 'layout' 0.01010.0053 741.640639.4063
Module start 'content' 0.01540.8941 781.0469431.6875
Module end 'content' 0.90950.0013 1,212.734412.2031
Script end 0.9107  1,224.9375 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00410.4509160.0003
Check MTime0.00150.1610160.0001
Mysql Total
Database connection0.00180.198010.0018
Mysqli_queries0.863594.8047520.0166
Looping result0.00050.0519500.0000
Template Total0.867795.320.4338
Template load0.00190.206620.0009
Template processing0.865895.060120.4329
Template load and register function0.00020.017710.0002
states
state_id_array0.00110.124010.0011
state_identifier_array0.00120.132620.0006
Override
Cache load0.00160.1706160.0001
Sytem overhead
Fetch class attribute can translate value0.00110.123910.0011
Fetch class attribute name0.00090.099220.0005
XML
Image XML parsing0.00020.021310.0002
class_abstraction
Instantiating content class attribute0.00000.000620.0000
General
dbfile0.00170.1905100.0002
String conversion0.00000.001840.0000
Note: percentages do not add up to 100% because some accumulators overlap

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
2content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
2content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
4content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
1print_pagelayout.tpl<No override>extension/community/design/community/templates/print_pagelayout.tplEdit templateOverride template
 Number of times templates used: 13
 Number of unique templates used: 6

Time used to render debug report: 0.0001 secs