TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 06-09-2008, 10:46 AM   #1 (permalink)
The Wanderer
 
galleeandfarel's Avatar
 
Join Date: Jun 2008
Posts: 15
Thanks: 4
galleeandfarel is on a distinguished road
Smile registration form help

ive created registration form in php,but i could not post the datas in to database,it tells "can not select DB",
im very beginner on this php,so i wanted some very basic steps to create my site.....
galleeandfarel is offline  
Reply With Quote
Old 06-09-2008, 11:23 AM   #2 (permalink)
The Wanderer
 
Join Date: Mar 2008
Location: United Kingdom
Posts: 22
Thanks: 1
boycoda is on a distinguished road
Default

can you post your code?
Send a message via MSN to boycoda Send a message via Skype™ to boycoda
boycoda is offline  
Reply With Quote
Old 06-09-2008, 11:43 AM   #3 (permalink)
Orc
The Prestige
 
Orc's Avatar
 
Join Date: Dec 2007
Posts: 1,044
Thanks: 193
Orc is on a distinguished road
Default

Usually means you havent made the database yet. I dunno about permissions
__________________
VillageIdiot can have my babbies ;d
Orc is offline  
Reply With Quote
Old 06-10-2008, 03:48 AM   #4 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

you havent placed this piece of code. mysql_selectdb("databasename"); how would your script know which database to use if you havent specified it :p
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 06-10-2008, 03:59 AM   #5 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

...or better yet, use mysqli and add it to your construct...

PHP Code:
$db = new mysqli($host$user$pass$db); 
delayedinsanity is offline  
Reply With Quote
Old 06-10-2008, 10:03 AM   #6 (permalink)
The Wanderer
 
galleeandfarel's Avatar
 
Join Date: Jun 2008
Posts: 15
Thanks: 4
galleeandfarel is on a distinguished road
Default

my code is here.....pl help me to do
<?php
session_start();
$link = mysql_connect('localhost', '', '');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
$dbselect = mysql_select_db('vigrav')or die("Can not select ");
if(!$dbselect){
die('Could not connect: ' . mysql_error());
}
if($_REQUEST["Check"] == 1)
{
$email = $_POST["email"];
$password = $_POST["password"];
$conpassword = $_POST["conpassword"];
$name1 = $_POST["firstname"];
$name2 = $_POST["lastname"];
$name3 = $_POST["surname"];
$lccode = $_POST["lccode"];
$lcitycode = $_POST["lcitycode"];
$land2 = $_POST["land2"];
$mccode = $_POST["mccode"];
$phone = $_POST["phoneno"];
$country = $_POST["countryofresidence"];
$state = $_POST["state"];
$city = $_POST["city"];
$presaddr1 = $_POST["conaddress"];
$presaddr2 = $_POST["conaddress1"];
$presaddr3 = $_POST["conaddress2"];
$prespin = $_POST["pincode1"];
$permaddr1 = $_POST["peraddress"];
$permaddr2 = $_POST["peraddress1"];
$permaddr3 = $_POST["peraddress2"];
$permpin = $_POST["pincode2"];

$query = "insert into jobseekerstep1(email,password,confirmpassword,firs tname,lastname,surname,landlinecode,landlinecityco de,landlineno,mobilecode,mobileno,country,state,ci ty,present1,present2,present3,presentpin,permanent 1,permanent2,permanent3,permanentpin)
values('$email','$password','$conpassword','$name1 ','$name2','$name3','$lccode','$lcitycode','$land2 ','$mccode','$phone','$country','$state','$city',' $presaddr1','$presaddr2','$presaddr3','$prespin',' $permaddr1','$permaddr2','$permaddr3','$permpin')" ;
$result = mysql_query($query);
$query1 = "select id from jobseekerstep1";
$res = mysql_query($query1);
while($row = mysql_fetch_array($res,MYSQL_BOTH))
$jid = $row["id"];
$_SESSION["id"] = $jid;
$_SESSION["email"] = $_POST["RegEmail"];
$_SESSION["password"] = $_POST["RegPassword"];
$_SESSION["name1"] = $_POST["Name1"];
$_SESSION["name2"] = $_POST["Name2"];
$_SESSION["name3"] = $_POST["Name3"];
$_SESSION["phone"] = $_POST["Phoneno"];
$_SESSION["country"] = $_POST["Country"];
$_SESSION["state"] = $_POST["State"];
$_SESSION["city"] = $_POST["City"];
$_SESSION["presaddr1"] = $_POST["pres1"];
$_SESSION["presaddr2"] = $_POST["pres2"];
$_SESSION["presaddr3"] = $_POST["pres3"];
$_SESSION["prespin"] = $_POST["prespin"];
$_SESSION["permaddr1"] = $_POST["perm1"];
$_SESSION["permaddr2"] = $_POST["perm2"];
$_SESSION["permaddr3"] = $_POST["perm3"];
$_SESSION["permpin"] = $_POST["permpin"];
}
else
{
$_SESSION["email"];
$_SESSION["password"];
$_SESSION["name1"];
$_SESSION["name2"];
$_SESSION["name3"];
$_SESSION["phone"];
$_SESSION["country"];
$_SESSION["state"];
$_SESSION["city"];
$_SESSION["presaddr1"];
$_SESSION["presaddr2"];
$_SESSION["presaddr3"];
$_SESSION["prespin"];
$_SESSION["permaddr1"];
$_SESSION["permaddr2"];
$_SESSION["permaddr3"];
$_SESSION["permpin"];
$_SESSION["jobid"];
}

if($_REQUEST["up"] == "res"){
/*echo '<pre>';
echo print_r($_REQUEST);
echo '</pre>';*/

$uploaddir = "C:/wamp/www/vijay/mov_resume/";
$uploadfile = $uploaddir . basename($_FILES['Resume']['name']);
if($_FILES['Resume']['name']!="")
{
if(copy($_FILES['Resume']['tmp_name'], $uploadfile)){

$date = $_POST["date"];
$month = $_POST["month"];
$year = $_POST["year"];
$dob = $_POST["date"]."-".$_POST["month"]."-".$_POST["year"];
$gender = $_POST["gender"];
$qual1 = $_POST["qualification1"];
$coname1 = $_POST["coname1"];
$cotype1 = $_POST["cotype1"];
$spec1 = $_POST["spec1"];
$institute1 = $_POST["institute1"];
$passout1 = $_POST["passout1"];
$qual2 = $_POST["qual2"];
//$coname2 = $_POST["coname2"];
//$cotype2 = $_POST["cotype2"];
//$spec2 = $_POST["spec2"];
//$institute2 = $_POST["institute2"];
//$passout2 = $_POST["passout2"];
//$qual3 = $_POST["qual3"];
//$coname3 = $_POST["coname3"];
//$cotype3 = $_POST["cotype3"];
//$spec3 = $_POST["spec3"];
//$institute3 = $_POST["institute3"];
//$passout3 = $_POST["passout3"];
$expyear = $_POST["expyear"];
$expmonth = $_POST["expmonth"];
$tags = $_POST["tags"];
$jobtitles = $_POST["jobtitles"];
$preferedcountry1 = $_POST["preferedcountry1"];
$preferedstate1 = $_POST["preferedstate1"];
$preferedcity1 = $_POST["preferedcity1"];
$preferedcountry2 = $_POST["preferedcountry2"];
$preferedstate2 = $_POST["preferedstate2"];
$preferedcity2 = $_POST["preferedcity2"];
$preferedcountry3 = $_POST["preferedcountry3"];
$preferedstate3 = $_POST["preferedstate3"];
$preferedcity3 = $_POST["preferedcity3"];
$rupees = $_POST["rupees"];
$dollar = $_POST["dollar"];
$skills = $_POST["skills"];
$Functional = array();
$Functional = $_POST["Functional"];
$len = count($Functional);
for($i=0; $i<$len; $i++){
if($Functional[$i]==1){
$Functional[$i] = "IT, Software Services";
}
if($Functional[$i]==2){
$Functional[$i] = "Construction,engineering";
}
if($Functional[$i]==3){
$Functional[$i] = "Retail";
}
if($Functional[$i]==4){
$Functional[$i] = "Sales, BD";
}
if($Functional[$i]==5){
$Functional[$i] = "Insurance";
}
if($Functional[$i]==6){
$Functional[$i] = "Site Engineering";
}
if($Functional[$i]==7){
$Functional[$i] = "Web, Graphic Design";
}
if($Functional[$i]==8){
$Functional[$i] = "Telecom";
}
if($Functional[$i]==9){
$Functional[$i] = "Oil, Energy, Power";
}
if($Functional[$i]==10){
$Functional[$i] = "Pharma, Biotech";
}
if($Functional[$i]==11){
$Functional[$i] = "Marketing";
}
if($Functional[$i]==12){
$Functional[$i] = "Media, Entertainment";
}
if($Functional[$i]==13){
$Functional[$i] = "Purchase, Supply Chain";
}
if($Functional[$i]==14){
$Functional[$i] = "TV Films";
}
if($Functional[$i]==15){
$Functional[$i] = "Banking, Financial Services";
}
if($Functional[$i]==16){
$Functional[$i] = "Automobiles";
}
if($Functional[$i]==17){
$Functional[$i] = "Hospitality";
}
if($Functional[$i]==18){
$Functional[$i] = "HR, Admin";
}
if($Functional[$i]==19){
$Functional[$i] = "IT-Hardware, Telecom";
}
if($Functional[$i]==20){
$Functional[$i] = "Architecture, Interior Design";
}
if($Functional[$i]==21){
$Functional[$i] = "Fashion Garments";
}
if($Functional[$i]==22){
$Functional[$i] = "BPO, KPO";
}
if($Functional[$i]==23){
$Functional[$i] = "Industrial Products";
}
if($Functional[$i]==24){
$Functional[$i] = "Overseas, International";
}
if($Functional[$i]==25){
$Functional[$i] = "Accounts, Finance";
}
if($Functional[$i]==26){
$Functional[$i] = "Manufacturing";
}
if($Functional[$i]==27){
$Functional[$i] = "Content, Journalism";
}
if($Functional[$i]==28){
$Functional[$i] = "Top Management";
}
}
$FunctionalIn = serialize($Functional);

print $Industry = $_POST["Industry"];
$IndustryIn = serialize($Industry);



// echo "File is valid, and was successfully uploaded.\n";
$str ="
resume_path,jobseeker,resume,dob,gender,qualificat ion1,coursename1,coursetype1,specification1,instit ute1,passout1,qualification2,coursename2,coursetyp e2,specification2,institute2,passout2,qualificatio n3,coursename3,coursetype3,specification3,institut e3,passout3,expyear,expmonth,Functional,Industry,p referedcountry1,preferedstate1,preferedcity1,prefe redcountry2,preferedstate2,preferedcity2,preferedc ountry3,preferedstate3,preferedcity3,rupees,dollar ,tags,jobtitle,copypaste,skills";
$str1 = "'$uploadfile','".$_SESSION["id"]."','".$_POST["Resume22"]."','$dob','$gender','$qual1','$coname1','$cotype1 ','$spec1','$institute1','$passout1','$qual2','$co name2','$cotype2','$spec2','$institute2','$passout 2','$qual3','$coname3','$cotype3','$spec3','$insti tute3','$passout3','$expyear','$expmonth','$Functi onalIn','$IndustryIn','$preferedcountry1','$prefer edstate1','$preferedcity1','$preferedcountry2','$p referedstate2','$preferedcity2','$preferedcountry3 ','$preferedstate3','$preferedcity3','$rupees','$d ollar','$tags','$jobtitles','$copypaste','$skills' ";
$query = "insert into jobseekerstep2($str)values($str1)";
$res = mysql_db_query('vigrav',$query);
}else{
echo 'file is invalid';
}
}else {
$str ="resume_path,jobseeker,resume,date,month,year,gen der";
$str1 = "'$uploadfile','".$_SESSION["jobid"]."','','$date','$month','$year','$gender'";
$query = "insert into jobseekerstep2($str)values($str1)";
$res1 = mysql_db_query('vigrav',$query1);
if($res1){
echo 'ok';
}else{
echo 'not ok ';
mysql_error();
}
}
}
if($_REQUEST["up"] == "res"){
// upload yr photo //
$uploaddir = 'C:/wamp/www/vijay/mov_img/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
// upload yr ten certifiacte //
$uploaddir1 = "C:/wamp/www/vijay/mov_ten/";
$uploadfile1 = $uploaddir1 . basename($_FILES['tenfile']['name']);
// upload yr ten certifiacte //
$uploaddir2 = "C:/wamp/www/vijay/mov_degree/";
$uploadfile2 = $uploaddir2 . basename($_FILES['degreefile']['name']);
if($_FILES['userfile']['name']!="" && $_FILES['tenfile']['name']!="" && $_FILES['degreefile']['name']!=""){
if(copy($_FILES['userfile']['tmp_name'], $uploadfile) && copy($_FILES['tenfile']['tmp_name'], $uploadfile1) && copy($_FILES['degreefile']['tmp_name'], $uploadfile2) ) {
echo "File is valid, and was successfully uploaded.\n";
echo $query = "insert into jobseeker1(img_path,ten_path,degree_path,jobseeker )values('$uploadfile','$uploadfile1','$uploadfile2 ','')";
$res = mysql_query($query);
}else{
//echo 'file is invalid';
}
}
}
mysql_close($link);
?>
galleeandfarel is offline  
Reply With Quote
Old 06-10-2008, 10:49 AM   #7 (permalink)
The Contributor
 
quantumkangaroo's Avatar
 
Join Date: Feb 2008
Location: Pretoria, South Africa
Posts: 42
Thanks: 1
quantumkangaroo is an unknown quantity at this point
Default

my eyes are hurting thank you for that

PHP Code:
<?php
session_start
();
$link mysql_connect('localhost''''');
if (!
$link) {
    die(
'Could not connect: ' mysql_error());
}
$dbselect mysql_select_db('vigrav')or die("Can not select ");
if(!
$dbselect){
    die(
'Could not connect: ' mysql_error());
}
if(
$_REQUEST["Check"] == 1)
{
    
$email $_POST["email"];
    
$password $_POST["password"];
    
$conpassword $_POST["conpassword"];
    
$name1 $_POST["firstname"];
    
$name2 $_POST["lastname"];
    
$name3 $_POST["surname"];
    
$lccode $_POST["lccode"];
    
$lcitycode $_POST["lcitycode"];
    
$land2 $_POST["land2"];
    
$mccode $_POST["mccode"];
    
$phone $_POST["phoneno"];
    
$country $_POST["countryofresidence"];
    
$state $_POST["state"];
    
$city $_POST["city"];
    
$presaddr1 $_POST["conaddress"];
    
$presaddr2 $_POST["conaddress1"];
    
$presaddr3 $_POST["conaddress2"];
    
$prespin $_POST["pincode1"];
    
$permaddr1 $_POST["peraddress"];
    
$permaddr2 $_POST["peraddress1"];
    
$permaddr3 $_POST["peraddress2"];
    
$permpin $_POST["pincode2"];

    
$query "insert into jobseekerstep1(email,password,confirmpassword,firs tname,lastname,surname,landlinecode,landlinecityco de,landlineno,mobilecode,mobileno,country,state,ci ty,present1,present2,present3,presentpin,permanent 1,permanent2,permanent3,permanentpin)
    values('
$email','$password','$conpassword','$name1 ','$name2','$name3','$lccode','$lcitycode','$land2 ','$mccode','$phone','$country','$state','$city',' $presaddr1','$presaddr2','$presaddr3','$prespin',' $permaddr1','$permaddr2','$permaddr3','$permpin')" ;
    
$result mysql_query($query);
    
$query1 "select id from jobseekerstep1";
    
$res mysql_query($query1);
    while(
$row mysql_fetch_array($res,MYSQL_BOTH))
    
$jid $row["id"];
    
$_SESSION["id"] = $jid;
    
$_SESSION["email"] = $_POST["RegEmail"];
    
$_SESSION["password"] = $_POST["RegPassword"];
    
$_SESSION["name1"] = $_POST["Name1"];
    
$_SESSION["name2"] = $_POST["Name2"];
    
$_SESSION["name3"] = $_POST["Name3"];
    
$_SESSION["phone"] = $_POST["Phoneno"];
    
$_SESSION["country"] = $_POST["Country"];
    
$_SESSION["state"] = $_POST["State"];
    
$_SESSION["city"] = $_POST["City"];
    
$_SESSION["presaddr1"] = $_POST["pres1"];
    
$_SESSION["presaddr2"] = $_POST["pres2"];
    
$_SESSION["presaddr3"] = $_POST["pres3"];
    
$_SESSION["prespin"] = $_POST["prespin"];
    
$_SESSION["permaddr1"] = $_POST["perm1"];
    
$_SESSION["permaddr2"] = $_POST["perm2"];
    
$_SESSION["permaddr3"] = $_POST["perm3"];
    
$_SESSION["permpin"] = $_POST["permpin"];
}
else
{
    
$_SESSION["email"];
    
$_SESSION["password"];
    
$_SESSION["name1"];
    
$_SESSION["name2"];
    
$_SESSION["name3"];
    
$_SESSION["phone"];
    
$_SESSION["country"];
    
$_SESSION["state"];
    
$_SESSION["city"];
    
$_SESSION["presaddr1"];
    
$_SESSION["presaddr2"];
    
$_SESSION["presaddr3"];
    
$_SESSION["prespin"];
    
$_SESSION["permaddr1"];
    
$_SESSION["permaddr2"];
    
$_SESSION["permaddr3"];
    
$_SESSION["permpin"];
    
$_SESSION["jobid"];
}

if(
$_REQUEST["up"] == "res"){
    
/*echo '<pre>';
     echo print_r($_REQUEST);
     echo '</pre>';*/

    
$uploaddir "C:/wamp/www/vijay/mov_resume/";
    
$uploadfile $uploaddir basename($_FILES['Resume']['name']);
    if(
$_FILES['Resume']['name']!="")
    {
        if(
copy($_FILES['Resume']['tmp_name'], $uploadfile)){

            
$date $_POST["date"];
            
$month $_POST["month"];
            
$year $_POST["year"];
            
$dob $_POST["date"]."-".$_POST["month"]."-".$_POST["year"];
            
$gender $_POST["gender"];
            
$qual1 $_POST["qualification1"];
            
$coname1 $_POST["coname1"];
            
$cotype1 $_POST["cotype1"];
            
$spec1 $_POST["spec1"];
            
$institute1 $_POST["institute1"];
            
$passout1 $_POST["passout1"];
            
$qual2 $_POST["qual2"];
            
//$coname2 = $_POST["coname2"];
            //$cotype2 = $_POST["cotype2"];
            //$spec2 = $_POST["spec2"];
            //$institute2 = $_POST["institute2"];
            //$passout2 = $_POST["passout2"];
            //$qual3 = $_POST["qual3"];
            //$coname3 = $_POST["coname3"];
            //$cotype3 = $_POST["cotype3"];
            //$spec3 = $_POST["spec3"];
            //$institute3 = $_POST["institute3"];
            //$passout3 = $_POST["passout3"];
            
$expyear $_POST["expyear"];
            
$expmonth $_POST["expmonth"];
            
$tags $_POST["tags"];
            
$jobtitles $_POST["jobtitles"];
            
$preferedcountry1 $_POST["preferedcountry1"];
            
$preferedstate1 $_POST["preferedstate1"];
            
$preferedcity1 $_POST["preferedcity1"];
            
$preferedcountry2 $_POST["preferedcountry2"];
            
$preferedstate2 $_POST["preferedstate2"];
            
$preferedcity2 $_POST["preferedcity2"];
            
$preferedcountry3 $_POST["preferedcountry3"];
            
$preferedstate3 $_POST["preferedstate3"];
            
$preferedcity3 $_POST["preferedcity3"];
            
$rupees $_POST["rupees"];
            
$dollar $_POST["dollar"];
            
$skills $_POST["skills"];
            
$Functional = array();
            
$Functional $_POST["Functional"];
            
$len count($Functional);
            for(
$i=0$i<$len$i++){
                if(
$Functional[$i]==1){
                    
$Functional[$i] = "IT, Software Services";
                }
                if(
$Functional[$i]==2){
                    
$Functional[$i] = "Construction,engineering";
                }
                if(
$Functional[$i]==3){
                    
$Functional[$i] = "Retail";
                }
                if(
$Functional[$i]==4){
                    
$Functional[$i] = "Sales, BD";
                }
                if(
$Functional[$i]==5){
                    
$Functional[$i] = "Insurance";
                }
                if(
$Functional[$i]==6){
                    
$Functional[$i] = "Site Engineering";
                }
                if(
$Functional[$i]==7){
                    
$Functional[$i] = "Web, Graphic Design";
                }
                if(
$Functional[$i]==8){
                    
$Functional[$i] = "Telecom";
                }
                if(
$Functional[$i]==9){
                    
$Functional[$i] = "Oil, Energy, Power";
                }
                if(
$Functional[$i]==10){
                    
$Functional[$i] = "Pharma, Biotech";
                }
                if(
$Functional[$i]==11){
                    
$Functional[$i] = "Marketing";
                }
                if(
$Functional[$i]==12){
                    
$Functional[$i] = "Media, Entertainment";
                }
                if(
$Functional[$i]==13){
                    
$Functional[$i] = "Purchase, Supply Chain";
                }
                if(
$Functional[$i]==14){
                    
$Functional[$i] = "TV Films";
                }
                if(
$Functional[$i]==15){
                    
$Functional[$i] = "Banking, Financial Services";
                }
                if(
$Functional[$i]==16){
                    
$Functional[$i] = "Automobiles";
                }
                if(
$Functional[$i]==17){
                    
$Functional[$i] = "Hospitality";
                }
                if(
$Functional[$i]==18){
                    
$Functional[$i] = "HR, Admin";
                }
                if(
$Functional[$i]==19){
                    
$Functional[$i] = "IT-Hardware, Telecom";
                }
                if(
$Functional[$i]==20){
                    
$Functional[$i] = "Architecture, Interior Design";
                }
                if(
$Functional[$i]==21){
                    
$Functional[$i] = "Fashion Garments";
                }
                if(
$Functional[$i]==22){
                    
$Functional[$i] = "BPO, KPO";
                }
                if(
$Functional[$i]==23){
                    
$Functional[$i] = "Industrial Products";
                }
                if(
$Functional[$i]==24){
                    
$Functional[$i] = "Overseas, International";
                }
                if(
$Functional[$i]==25){
                    
$Functional[$i] = "Accounts, Finance";
                }
                if(
$Functional[$i]==26){
                    
$Functional[$i] = "Manufacturing";
                }
                if(
$Functional[$i]==27){
                    
$Functional[$i] = "Content, Journalism";
                }
                if(
$Functional[$i]==28){
                    
$Functional[$i] = "Top Management";
                }
            }
            
$FunctionalIn serialize($Functional);

            print 
$Industry $_POST["Industry"];
            
$IndustryIn serialize($Industry);



            
// echo "File is valid, and was successfully uploaded.\n";
            
$str ="
resume_path,jobseeker,resume,dob,gender,qualificat ion1,coursename1,coursetype1,specification1,instit ute1,passout1,qualification2,coursename2,coursetyp e2,specification2,institute2,passout2,qualificatio n3,coursename3,coursetype3,specification3,institut e3,passout3,expyear,expmonth,Functional,Industry,p referedcountry1,preferedstate1,preferedcity1,prefe redcountry2,preferedstate2,preferedcity2,preferedc ountry3,preferedstate3,preferedcity3,rupees,dollar ,tags,jobtitle,copypaste,skills"
;
            
$str1 "'$uploadfile','".$_SESSION["id"]."','".$_POST["Resume22"]."','$dob','$gender','$qual1','$coname1','$cotype1 ','$spec1','$institute1','$passout1','$qual2','$co name2','$cotype2','$spec2','$institute2','$passout 2','$qual3','$coname3','$cotype3','$spec3','$insti tute3','$passout3','$expyear','$expmonth','$Functi onalIn','$IndustryIn','$preferedcountry1','$prefer edstate1','$preferedcity1','$preferedcountry2','$p referedstate2','$preferedcity2','$preferedcountry3 ','$preferedstate3','$preferedcity3','$rupees','$d ollar','$tags','$jobtitles','$copypaste','$skills' ";
            
$query "insert into jobseekerstep2($str)values($str1)";
            
$res mysql_db_query('vigrav',$query);
        }else{
            echo 
'file is invalid';
        }
    }else {
        
$str ="resume_path,jobseeker,resume,date,month,year,gen der";
        
$str1 "'$uploadfile','".$_SESSION["jobid"]."','','$date','$month','$year','$gender'";
        
$query "insert into jobseekerstep2($str)values($str1)";
        
$res1 mysql_db_query('vigrav',$query1);
        if(
$res1){
            echo 
'ok';
        }else{
            echo 
'not ok ';
            
mysql_error();
        }
    }
}
if(
$_REQUEST["up"] == "res"){
    
// upload yr photo //
    
$uploaddir 'C:/wamp/www/vijay/mov_img/';
    
$uploadfile $uploaddir basename($_FILES['userfile']['name']);
    
// upload yr ten certifiacte //
    
$uploaddir1 "C:/wamp/www/vijay/mov_ten/";
    
$uploadfile1 $uploaddir1 basename($_FILES['tenfile']['name']);
    
// upload yr ten certifiacte //
    
$uploaddir2 "C:/wamp/www/vijay/mov_degree/";
    
$uploadfile2 $uploaddir2 basename($_FILES['degreefile']['name']);
    if(
$_FILES['userfile']['name']!="" && $_FILES['tenfile']['name']!="" && $_FILES['degreefile']['name']!=""){
        if(
copy($_FILES['userfile']['tmp_name'], $uploadfile) && copy($_FILES['tenfile']['tmp_name'], $uploadfile1) && copy($_FILES['degreefile']['tmp_name'], $uploadfile2) ) {
            echo 
"File is valid, and was successfully uploaded.\n";
            echo 
$query "insert into jobseeker1(img_path,ten_path,degree_path,jobseeker )values('$uploadfile','$uploadfile1','$uploadfile2 ','')";
            
$res mysql_query($query);
        }else{
            
//echo 'file is invalid';
        
}
    }
}
mysql_close($link);
?>
As far as i can see your code is way too congested to make any sense of it, you should try and use techniques to minimize the code usage. One question though,

PHP Code:
else
{
    
$_SESSION["email"];
    
$_SESSION["password"];
    
$_SESSION["name1"];
    
$_SESSION["name2"];
    
$_SESSION["name3"];
    
$_SESSION["phone"];
    
$_SESSION["country"];
    
$_SESSION["state"];
    
$_SESSION["city"];
    
$_SESSION["presaddr1"];
    
$_SESSION["presaddr2"];
    
$_SESSION["presaddr3"];
    
$_SESSION["prespin"];
    
$_SESSION["permaddr1"];
    
$_SESSION["permaddr2"];
    
$_SESSION["permaddr3"];
    
$_SESSION["permpin"];
    
$_SESSION["jobid"];

what the hell and why are you declaring $_POST values to their own variables if they can be used directly? eg.

$expyear = $_POST["expyear"];

is exactly the same thing as $_POST["expyear"];

http://roshanbh.com.np/2007/12/clean...ue-in-php.html
__________________
virtueCart v1.0.5 developed by WebDevSA

Send a message via MSN to quantumkangaroo Send a message via Skype™ to quantumkangaroo
quantumkangaroo is offline  
Reply With Quote
Old 06-17-2008, 02:42 AM   #8 (permalink)
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default

first of all, instead of doing this

$link = mysql_connect("localhost",... etc)
if(!$link) { bla bla }

there is a better way. you do this.

Code:
mysql_connect("localhost","username","password") or die(mysql_error());
also its best practice to leave your connection string into another file. what i do is i've made a config.php file and in here i've placed my connection string. so whenever i want to use it i just do include("config.php");


as for the rest, try not to use the session function. although there might be a debate on this lol. but i would suggest not to use it and use cookies instead.
__________________
no signature set
sarmenhb is offline  
Reply With Quote
Old 06-17-2008, 04:49 AM   #9 (permalink)
is cute and cuddly
 
delayedinsanity's Avatar
 
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
delayedinsanity is on a distinguished road
Default

sarmen: That's not always a better way. The first method allows you to incorporate your own error handling as well as continue to execute the script/current page if you so desire. In addition, in a live environment, echoing sensitive error information directly to the browser can provide potential mischief makers with important information about your backend.

Also, just out of curiousity, why not use the built-in session functionality of PHP? It's really quite useful, and IIRC session data is stored locally on the server so it's actually more reliable than straight client-side cookies.
-m
delayedinsanity is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 10:59 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design