Création de pages profiles à partir des comptes utlisateurs

lucas999222 Messages postés 10 Date d'inscription   Statut Membre Dernière intervention   -  
 Barnard -
Bonjour,

J'ai un site d'annonces emploi, les utilisateurs peuvent uploader leur CV, et remplir différents champs afin de contacter les entreprises avec toutes les informations préremplies (cv en pièce jointe, expérience, prenom, nom etc...)

Je voudrais maintenant permettre de mettre ces informations accessibles en ligne par les entrepreneurs (avec accord de l'utilisateur qui cochera pour rendre public son compte). Les pages de profiles publics auront un url du genre : site.com/id-utilisateur_Nom-utisateur

Je n'ai pas de grandes connaissances en php mais si vous pouviez me guider ce serait sympathique

voici le code de la page account.php qui recense les toutes les informations des comptes
<?
require_once("initvars.inc.php");
require_once("{$path_escape}config.inc.php");
checkLogin( $userviewaccountlink );
$width_gen = 250;
?>
<style>

</style>
<script type="text/javascript">
$(document).ready(function(){


$('.editable :selected').each(function(index,elem){
//alert();
var $this=$(this);
var link=$('<a href="#" class="editable-link" />');
var selected_text=$this.text();

var container=$this.parent().parent();

//if(!!$this.val()&&!container.parent().hasClass('validation-error')){
link.text(selected_text);

if($this.parent().hasClass('dob-fields')){
link.append(' ');
}

if(container.parent().find('input[type=checkbox]').attr('checked')){link.addClass('grey-out');}

$this.parent().hide();
container.append(link);

});

$('.editable-link').bind('click',function(e){
e.preventDefault();
var $this=$(this);
$this.parent().find(".editable").show();
$this.parent().find('.editable-link').hide();
return false;
});


//if($.browser.chrome){
$('#id_cv_upload').hide();
$('#id_cv_upload_label, .cv_upload_lbl, .btn-add-new').removeClass('hidden').show();
if($('.profile-p').length){
$('#id_cv_upload').removeClass('hidden');
}
/*}else{
$('#id_cv_upload, .upload-new').removeClass('hidden').show();
$('#id_cv_upload_label, .cv_upload_lbl').hide();
}*/

$('#id_cv_upload_label, .cv_upload_lbl').bind('click',function(e){
e.preventDefault();
var $this=$(this);
$('#id_cv_upload').click();
return false;
});

});
</script>

<script>
$(document).ready(function(){
$(".delet_but1").click(function(){
var ser_button=this;

$.ajax({
//this is the php file that processes the data and send mail
url: "<?=$vpath?>delsearch.php",

//GET method is used
type: "GET",

//pass the data
data: $(this).closest("form").serialize(),

//Do not cache the page
cache: false,

//success
success: function (data) {

//alert(data);

//$(".ERR"+serviceid).html(data);
$(ser_button).closest(".information_box").html(data);
}
});

});
});
</script>

<script>
$(document).ready(function(){
$(".one_sdel").click(function(){
var ser_button=this;
var one=$(this).closest("a").attr("id").split("_");
//alert(one[2])
//alert($(this).closest("input.single_del").val());
$.ajax({
//this is the php file that processes the data and send mail
url: "<?=$vpath?>delsearch.php",

//GET method is used
type: "GET",

//pass the data
data:{one_sid:one[1],cat_id:one[2]},

//Do not cache the page
cache: false,

//success
success: function (data) {

//alert(data);

//$(".ERR"+serviceid).html(data);
$(ser_button).closest(".information_box").html(data);
}
});

});
});
</script>


<!--profile update php code-->
<?
if( $_POST['do'] == 'post' ) {
$err = '';
$data = $_POST;

if( $data['password'] != '' ) {
if( $data['cpassword'] == '' )
$err .= "• $lang[ERROR_PASSWORD_CONFIRM_BLANK]<br />";
else if( $data['password'] !== $data['cpassword'] )
$err .= "• $lang[ERROR_PASSWORDS_MISMATCH]<br />";
}

if($err)
$err = "Cant update profile <br />" . $err;

foreach ($data as $k => $v)
if(!is_array($v)) $data[$k] = stripslashes($v);
}

if( $_POST['do'] == "post" && empty( $err ) ) {
$back_to_home_link = showSEFURL('main', $xcityid);

// Generate code
$ip = $_SERVER['REMOTE_ADDR'];
$code = uniqid("$ip.", TRUE);
$codemd5 = md5($code);

foreach ($data as $k => $v)
$data[$k] = mysql_escape_string(htmlspecialchars($v));
//print_r($_FILES["filecv"]);
if($_FILES['filecv']['name']!="")
{
if ($_FILES["filecv"]["error"] > 0)

{

$_SESSION['after_post_msg']="Return Code: " . $_FILES["filecv"]["error"] . "<br />";

}

else

{

$fl=$_FILES['filecv']['name'];
$ext=end(explode(".",$fl));
$img_ext=array( "txt", "doc", "docx", "pdf");

if(in_array(strtolower($ext),$img_ext)){
//$rand=rand();
//$path="../upload_images/".$rand.".".$ext;
$cvpath="cv/".$_SESSION[$sess_user_id].".".$ext;
move_uploaded_file($_FILES["filecv"]["tmp_name"],$cvpath);

}else{

$_SESSION['after_post_msg']="This is not a valid document file. <br /><br />";
}

}
}
//print_r($data);

if($_SESSION['after_post_msg'] ==""){
$up_queryq = "Update ".$t_user."
SET dob='$data[year]-$data[month]-$data[day]',
gender='$data[gender]',
nationality='$data[nat]',
country='$data[country]',
role='$data[role]',
cv='$cvpath',
username='$data[username]',
education='".$_REQUEST['education']."',
cover_note='".$_REQUEST['cover_note']."' where user_id = ".$_SESSION[$sess_user_id];
//print_r();
$update = mysql_query($up_queryq);
for($i=1;$i<=3;$i++)
{
if($_REQUEST['year_range'.$i]!='' && $_REQUEST['domain_field'.$i]!='')
{

//echo "<br/>";
$up_query = mysql_query("Update ".$t_user." SET year_range".$i."='".$_REQUEST['year_range'.$i]."', domain_field".$i."='".$_REQUEST['domain_field'.$i]."' where user_id = ".$_SESSION[$sess_user_id]);
}

}




if($update) {
$_SESSION['after_post_msg'] = '<h4>Profile updated!!</h4>';
}
}
}

?>
<!--profile update php code:end-->


<?

$sql = "SELECT * FROM $t_user
WHERE user_id = '".$_SESSION[$sess_user_id]."'";
$res = mysql_query($sql);
$data = mysql_fetch_array($res);

?>

<script type="text/javascript" src="<?php echo $vpath; ?>/js/script.js"></script>
<script type="text/javascript">
function validateUserRegister() {

var txt = '';
var targetElement = '';

if( document.getElementById('gender').value == 0 ) {
if( txt == '' )
targetElement = 'gender';
txt += "Please provide your Gender.\n";
}

if( txt != '' ) {
txt = "Please check and correct the following Errors to continue:-\n\n" + txt;
alert( txt );

if( targetElement != '' )
document.getElementById(targetElement).focus();
return false;
}
else {
document.getElementById('do').value = 'post';
}
}


</script>


<style>
.information_bar2 {
background: url(star-blue.png) no-repeat #EEF5FB 10px;
border: 1px solid #C1E1F3;
border-radius: 5px 5px 5px 5px;
clear: both;
color: #111111;
font-size: 12px;
line-height: 17px;
padding: 5px 5px 5px 38px;
margin: 4px 0px;
}
</style>

<!------Start Container Right-------->
<div class="dashboard_cont">

<p align="left" style="padding:10px 0px 0px 5px; " class="text_001" style="margin-top:4px;" ><?php echo $lang['HOME_LINK']; ?>  <img src="<?=$vpath?>images/arrow_icon.PNG"> <?php echo $lang['USER_MY_ACCOUNT']; ?>  <img src="<?=$vpath?>images/arrow_icon.PNG"> </p>

<!------Start Tabber-------->
<div class="featured">
<div class="tabber">


<div class="tabbertab" style="width:935px;">
<h2><?php echo $lang['USER_MY_ACCOUNT']; ?></h2>
<div class="my_profile">

<p id="p-info"> <?php echo $lang['WELCOME']; ?>, <?php echo $data['first_name']; ?>! (<?php echo $lang['NOT']; ?> <?php echo $data['first_name']; ?> <a href="<?=$vpath?>logout"><?php echo $lang['LOGOUT']; ?></a>)<a style="float:right" href="<?=$vpath?>settings/" class="acc-settings"><?php echo $lang['ACCOUNT_SETTINGS']; ?></a></p>



<br />

<? if($_SESSION['after_post_msg']){
echo $_SESSION['after_post_msg'];
unset($_SESSION['after_post_msg']);
}
?>


<?php
//include('db.php');
session_start();
$session_id='1'; //$session id
?>


<script type="text/javascript" src="<?=$vpath?>scripts/jquery.min.js"></script>
<script type="text/javascript" src="<?=$vpath?>scripts/jquery.form.js"></script>

<script type="text/javascript" >
$(document).ready(function() {

$('#photoimg').live('change', function() {
$("#preview").html('');
$("#preview").html('<img src="<?=$vpath?>loader.gif" alt="Uploading...."/>');
$("#imageform").ajaxForm({
target: '#preview'
}).submit();

});
});
</script>

<style>

body
{
font-family:arial;
}
.preview
{
width:200px;
border:solid 1px #dedede;
padding:10px;
}
#preview
{
color:#cc0000;
font-size:12px
}

</style>
<body>


<div style="float: left;">

<form id="imageform" method="post" enctype="multipart/form-data" action='<?=$vpath?>ajaximage.php'>
<div id="preview" class="my_profile_row1"><?php if($data[img]){ ?><img src="<?=$vpath?>uploads/<?=$data[img]?>" width="110" height="110" /><?php }else{ ?><img src="../images/my_profile.jpg" width="110" height="110" /><?php } ?></div>

<div>
<label class="file-upload focus">
<input type="file" style="width:111px; left:-150px" name="photoimg" id="photoimg" />
</label>
</div>

</div>
</form>

<div class="my_profile_row2">

<form name="profile_update" method="post" enctype="multipart/form-data" onSubmit="javascript:return validateUserRegister();" >
<table width="450" align="left" class="my_profile_table" cellpadding="5" >

<tr>
<td width="150"><strong ><?php echo $lang['POST_YOURNAME']; ?> : </strong></td>

<td> <strong style="color:#FA0000;"><?php echo $data['first_name']; ?> <?php echo $data['last_name']; ?></strong></td>

</tr>

<tr>
<td><strong><?php echo $lang['USER_NATIONALITY']; ?> : </strong></td>
<td class="dropdown" >
<?
$sql1 = "SELECT * FROM {$tprefix}nationality WHERE enabled = '1' ";
//echo $sql1;
$resc1 = mysql_query($sql1);
?>
<select class="editable" name="nat" id="nat" style="width:150px;">
<option value="0">--<?php echo $lang['SELECT']; ?>--</option>
<? while($nat = mysql_fetch_array($resc1)){ ?>
<option value="<?=$nat[country_id]?>" <? if($data['nationality']==$nat[country_id]) echo 'selected'?>><? echo $nat['country_name'];?></option>
<? } ?>
</select>

</td>

</tr>

<tr>
<td><strong><?php echo $lang['USER_GENDER']; ?> : </strong></td>
<td class="dropdown">
<select class="editable" name="gender" id="gender" style="width:150px;">
<option value="0">--<?php echo $lang['SELECT']; ?>--</option>
<option value="m" <? if($data['gender']=='M') echo 'selected'?>><?php echo $lang['MALE']; ?></option>
<option value="f" <? if($data['gender']=='F') echo 'selected'?>><?php echo $lang['FEMALE']; ?></option>
</select>
</td>

</tr>
<tr>
<td><strong><?php echo $lang['USER_DATE_OF_BIRTH']; ?>: </strong></td>
<td class="dropdown">
<?php
// lowest year wanted
$cutoff = 1975;

// current year
$now = date('Y');
$dt=explode("-",$data['dob']);
?>
<select class="editable" name="day" id="day" style="width:65px; margin-right:8px;">
<option><?php echo $lang['DATE']; ?></option>

<? for ($d=1; $d<=31; $d++) {
echo ' <option value="' . $d . '"';
if($dt[2]==$d)
echo 'selected';
echo '>' . $d . '</option>' . PHP_EOL;
} ?>

</select>

<select class="editable" name="month" id="month" style="width:74px; margin-right:8px;">
<option><?php echo $lang['MONTH']; ?></option>
<option value="1" <? if($dt[1]==1) echo 'selected';?>>January</option>
<option value="2" <? if($dt[1]==2) echo 'selected';?>>February</option>
<? for ($m=3; $m<=12; $m++) {
echo ' <option value="' . $m . '"';
if($dt[1]==$m)
echo 'selected';
echo '>' . date('F', mktime(0,0,0,$m)) . '</option>' . PHP_EOL;
} ?>
</select>

<select class="editable" name="year" id="year" style="width:97px; margin-right:8px;">
<option><?php echo $lang['YEAR']; ?></option>
<? for ($y=$now; $y>=$cutoff; $y--) {
echo ' <option value="' . $y . '"';
if($dt[0]==$y)
echo 'selected';
echo '>' . $y . '</option>' . PHP_EOL;
} ?>
</select>
</td>

</tr>

<tr>
<td><strong><?php echo $lang['ROLE']; ?>: </strong></td>
<?
$sql2 = "SELECT * FROM {$tprefix}role WHERE enabled = '1' ";
//echo $sql1;
$resc2 = mysql_query($sql2);
?>
<td class="dropdown">
<select class="editable" name="role" id="role" style="width:150px;">
<option value="0">--<?php echo $lang['SELECT']; ?>--</option>
<? while($role = mysql_fetch_array($resc2)){ ?>
<option value="<?=$role[role_id]?>" <? if($data['role']==$role[role_id]) echo 'selected'?>><? echo $role['role_name'];?></option>
<? } ?>
</select>
</td>


</tr>

<tr>

<? if($data['cv']!=""){?>
<td><?php echo $lang['YOURCV']; ?> <br><a target="_blank" href="<?=$vpath.$data['cv']?>"><img src="<?=$vpath?>images/cv.jpg"><br><?=end(explode("/",$data['cv']));?></a>
<input value="<?=$data['cv']?>" type="hidden" name="cvname">
</td>
<? }else{ ?>
<td><?php echo $lang['YOURCV']; ?> <br><img src="<?=$vpath?>images/cv.jpg"></td>
<? } ?>

<td>
<a id="id_cv_upload_label" class="cv_upload_lbl" style="display: inline;"><?php echo $lang['UPLOADANEWCV']; ?></a>
<input id="id_cv_upload" class="fileupload" type="file" name="filecv" value="Upload a new CV">
</td>
</tr>


<tr>
<td><?php echo $lang['YOURBACKGROUND']; ?>:</td>
<td> </td>
</tr>
<?php $k=0; for($i=0;$i<3;$i++){ $k++; ?>
<tr>
<td><strong><?php echo $lang['IHAVEGOT']; ?></strong> 
<select class="locat_input002" name="year_range<?php echo $k?>" id="year_range<?php echo $k?>">
<option value="">....</option>
<?php
$sql_range=mysql_query("SELECT * FROM ".$tprefix."year ORDER BY id ASC");

while($row_range=mysql_fetch_array($sql_range))
{

?>
<option value="<?php echo $row_range['year']; ?>" <?=($row_range['year']==$data['year_range'.$k])? "selected='selected'":""?>><?php echo $row_range['year']; ?> <?php echo $lang['YEAR']; ?></option>
<?php
}
?>
</select>
</td>
<td><strong><?php echo $lang['EXPERIENCEIN']; ?></strong> 
<select class="locat_input002" name="domain_field<?php echo $k?>" id="domain_field<?php echo $k?>">
<option value="">....</option>
<?php
$sql_domain=mysql_query("SELECT * FROM ".$tprefix."domain ORDER BY id ASC");
while($row_domain=mysql_fetch_array($sql_domain))
{
?>
<option value="<?php echo $row_domain['domain']; ?>" <?=($row_domain['domain']==$data['domain_field'.$k])? "selected='selected'":""?>><?php echo $lang [$row_domain['domain']]; ?></option>
<?php
}
?>
<?php
?>

</select>
</td>

</tr>
<?php } ?>
<tr>
<td colspan="2"><strong><?php echo $lang['YOUREDUCATION']; ?>:</strong></br>
<select class="locat_input002" name="education" id="education">
<option value=""><?php echo $lang['MYHIGHESTACHIEVEMENTIS']; ?></option>
<?php
$sql_education=mysql_query("SELECT * FROM ".$tprefix."education ORDER BY id ASC");
while($row_education=mysql_fetch_array($sql_education))
{
?>
<option value="<?php echo $row_education['education']; ?>"
<?=($row_education['education']==$data['education'])? "selected='selected'":""?>>
<?php echo $lang [$row_education['education']]; ?>
</option>
<?php
}
?>
<?php
?>
</select>
</td>

</tr>
<tr>
<td colspan="2">
<strong><?php echo $lang['YOURCOVERNOTE']; ?></strong><br/>
<textarea class="locat_input002" style="width:400px;" name="cover_note" id="cover_note" rows="10" cols="50"><?php echo $data['cover_note']; ?></textarea>
</td>
</tr>
<tr><td align="left">
<input type="hidden" name="do" id="do" />
<input style="margin-top:8px; float:left;" type="submit" class="signbott" value="<?php echo $lang['BUTTON_UPDATE_AD']; ?>"></td>
</tr>
</table>

</form>




</div>

<div class="my_profile_row3">

<ul class="stats">
<li class="first">
<span id="prAds" class="col-title"><?php echo $lang['MYADS']; ?></span>

<span class="num-ads" id="ad-count"><?=$add_count;?></span>
<!--<span class="num-views"><?php echo $lang['ADSVIEWED']; ?> <strong>597</strong> <?php echo $lang['TIMES']; ?></span>-->

</li>
<li>
<span id="prSrch" class="col-title"><?php echo $lang['MYSEARCHES']; ?></span>
<span class="num-ads">0</span>
<span class="num-views"><?php echo $lang['SAVEDSEARCHES']; ?></span>
</li>
<li class="last">
<span id="prWch" class="col-title"><?php echo $lang['MYWATCHLIST']; ?></span>
<span class="num-ads">0</span>
<span class="num-views"><?php echo $lang['ADSSAVED']; ?></span>
</li>
</ul>

</div>

</div>
</div>

<!--end-me-->
</div>
<!------End Tabber-------->


</div>
<!------End Container Right-------->




</div><!------End Container-------->






</div><!------End Wrapper-------->

</div><!------End Maincontent-------->



<!------Start Footer-------->

A voir également:

1 réponse

Barnard
 
Au fond, c'est quoi le problème ?

de créer l'url du profil ou d'afficher les informations relative au profil ?
0
lucas999222 Messages postés 10 Date d'inscription   Statut Membre Dernière intervention  
 
En fait, c'est les deux, je veux permettre au public de voir les pages profils
0
Barnard
 
Tu peux créer la page du profil, lorsque tu enregistres les infos de tes candidats en base de données.


exemple:

$infos_candidat = "";
$infos_candidat .= "<html><head></head><body><p>$nom $prenom</p> etc.</body></html>";
$file = fopen("le_prenom_nom_du_candidat.html", "w");
fwrite($file, $infos_candidat); // écrire ici toutes les infos concernant le candidats
fclose($file); // ferme le fichier

Ensuite pour appeler les fichiers html, générer, il suffira de créer une page, contenant un simple formulaire et quelques requetes sur la base afin d'afficher les fichiers html.

va falloir bosser un peu et revenir quand tu bloques !
0