SitePoint Sponsor

User Tag List

Results 1 to 13 of 13
  1. #1
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    displaying the code .

    hi , i want to install PHP and Appache to connect with oracle11g database . so currently i installed PHP 5.3.6 and apache_2.2.19-x86-openssl-1.0.0d , but m unable to execute phpinfo.php , its displaying the same code in page ( http://localhost/phpinfo.php)
    <?php
    phpinfo();
    ?>

    please help me .

  2. #2
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,154
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    You need to make sure apache is setup to handle the PHP code (see http://www.thesitewizard.com/php/ins...-windows.shtml)

    You will also need to install the Oracle Client (see this thread)

  3. #3
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for solution .

  4. #4
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I created one registration form as once form is filled and click on submit button it has to store in database . so i have written the code as shown below .




    <?php
    // list of jobs //
    $jobList = array('Developer',Database Administrator','Business Systems Analyst','Software Engineer'*/);
    // sorting the jobs //
    sort($jobList);

    // list of countries //
    $countryList = array('USA','UK,'French Polynesia','Gabon','Gambia','Georgia','Germany',);
    // sorting the countries //
    sort($countryList);
    // looping the countries //

    // jobs dropdown runtime //
    $jdropdown = '';

    // country dropdown runtime //
    $cdropdown = '';

    foreach($jobList as $job)
    {
    $jobName = ucwords($job);
    $jdropdown .= "<option value=\"$jobName\">$jobName</option>";
    }

    foreach($countryList as $country)
    {
    $countryName = ucwords($country);
    // storing country in dropdown //
    $cdropdown .= "<option value=\"$countryName\">$countryName</option>";
    }

    $exp = '';
    for($i=1; $i<35; $i++)
    {
    $exp .= "<option>$i</option>";
    }
    ?>

    <html>
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title> registration form</title>
    <link href="menu_scripts/styles.css" rel="stylesheet" type="text/css" />
    <script src="menu_scripts/ga.js" async="" type="text/javascript"></script>
    <!--<script type="text/javascript" src="apply_files/select.js"></script>
    <!--<script type="text/javascript" src="menu_scripts/rsv.js"></script>
    <script type="text/javascript">
    var rules = [];
    rules.push("required,form_of_address,Please enter your form of address");
    rules.push("required,fromname,Please enter your first name.");
    rules.push("required,lastname,Please enter your last name.");
    rules.push("required,fromemail,Please enter your email address.");
    rules.push("valid_email,fromemail,Please enter a valid email address.");
    </script>-->
    </head>
    <body>

    <table width="585" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
    <td class="php_form_midbg"><div class="mid_content2"><form class="test" action="mail.php" method="post" enctype="multipart/form-data" name="form2" onsubmit="return rsv.validate(this, rules)">
    <table width="560" border="0" align="center" cellpadding="0" cellspacing="0">

    <tbody><tr><td style="height: 3px;"></td></tr>
    <tr>
    <td colspan="3" class="mid_black_bold">Please fill thee form</td>
    </tr>
    <tr>
    <td colspan="3" class="body">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="3" align="right" class="body"><span style="color: rgb(255, 66, 0);">All Fields are mandatory</span></td>
    </tr>
    <tr>
    <td width="34%" align="right" class="body"> Job Applying for</td>
    <td class="body" width="2%">/td>
    <td style="font-size: 0.9em;" width="64%">
    <span style="font-size: 0.9em;"> <select name="jobname" id="jobname" tabindex="1" onchange="showCD(this.value)">
    <option selected="selected">Select</option>
    <?php echo $jdropdown; ?>
    </select> </span>

    <div id="txtHint"></div>


    </td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body">Gender</td>
    <td class="body" width="2%">/td>
    <td width="64%"><select name="gender" tabindex="2" id="gender">
    <option selected="selected" value="">Select</option>
    <option value="M">Male</option>
    <option value="F">Female</option>

    </select></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> First Name</td>
    <td class="body" width="2%">/td>
    <td width="64%"><input tabindex="3" name="firstname" type="text"></td>
    </tr>
    <tr align="right"><td height="2" style="height: 3px;"></td>
    </tr>
    <tr>
    <td width="34%" align="right" class="body"> Last Name</td>
    <td class="body" width="2%">/td>
    <td width="64%"><input tabindex="4" name="lastname" type="text"></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> City</td>
    <td class="body" width="2%">/td>
    <td width="64%"><input tabindex="5" name="strcity" class="textfield" type="text"></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> State</td>
    <td class="body" width="2%">/td>
    <td width="64%"><input name="strstate" tabindex="6" class="textfield" type="text"></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> Country</td>
    <td class="body" width="2%">/td>
    <td width="64%">
    <select name="country" id="country" tabindex="7">
    <option value="Select" selected="selected">Select</option>
    <?php echo $cdropdown; ?>
    </select>
    </td>
    </tr>

    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> Phone No</td>
    <td class="body" width="2%">/td>
    <td width="64%"><input name="strno" tabindex="8" class="textfield" type="text"></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> Email</td>
    <td class="body" width="2%">/td>
    <td width="64%"><input tabindex="9" name="fromemail" type="text"></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> Total work experience in years</td>
    <td class="body" width="2%">/td>
    <td width="64%">

    <select name="totalexp" id="totalexp" tabindex="10">
    <option selected="selected" value=" ">Select</option>
    <?php echo $exp; ?>
    </select>
    </td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> Comments</td>
    <td class="body" width="2%">/td>
    <td width="64%"><textarea rows="4" cols="25" name="strcomments" tabindex="11"></textarea></td>
    </tr>
    <tr align="right"><td style="height: 3px;"></td></tr>
    <tr>
    <td width="34%" align="right" class="body"> Resume</td>
    <td class="body" width="2%">/td>
    <td width="64%">

    <input name="filename" tabindex="12" type="file"></td>

    </tr>
    <tr><td style="height: 3px;"></td></tr>
    <tr>
    <td colspan="3" align="center"><table width="120" border="0">
    <tr>
    <td><input tabindex="13" name="btnSub2" value="Submit" type="submit" /></td>
    <td><input tabindex="14" name="btnSub3" value="Cancel" type="submit" /></td>
    </tr>
    </table></td>
    </tr>
    <tr>
    <td colspan="3" align="center">&nbsp;</td>
    </tr>
    <tr>
    <td colspan="3" align="center">&nbsp;</td>
    </tr>

    </tbody>
    </table>


    </form></td>
    </tr>

    <tr>
    <td>&nbsp;</td>
    </tr>
    </table>
    </body>
    </html>

  5. #5
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I have written the code to store the form info .. to mysql database .. so m getting error as unexpected variable . please help me .

    <?php
    function control($val,$min,$max,$ctype,$check)
    {
    if($check == 'Y')
    {
    // no spaces are allowed //
    $secure = strip_tags(stripslashes(str_replace(' ','',(htmlentities($val)))));
    }
    else
    {
    // spaces are allowed //
    $secure = strip_tags(stripslashes(trim(htmlentities($val))));
    }

    if($secure == '')
    {
    echo "Enter ".$ctype;
    exit();
    }
    else if(strlen($secure) < $min)
    {
    echo "Enter Minimum ".$min." Characters ".$ctype;
    exit();
    }
    else if(strlen($secure) > $max)
    {
    echo "Enter Maximum ".$max." Characters ".$ctype;
    exit();
    }
    return $secure;
    }
    function userdata()
    {
    if(isset($_POST['btnSub2']))
    {
    $job_name=control($_POST['jobname'],2,100,'Job Applying For','N');
    $gender=control($_POST['gender'],1,1,'Gender','Y');
    $first_name=control($_POST['firstname'],1,30,'First Name','N');
    $last_name=control($_POST['lastname'],1,30,'Last Name','N');
    $city=control($_POST['strcity'],2,50,'City','N');
    $state=control($_POST['strstate'],2,50,'State','N');
    $country=control($_POST['country'],2,50,'Country','N');
    $phone_mobile=control($_POST['strno'],8,15,'Phone','Y');
    $email=control($_POST['fromemail'],5,60,'Email Address','Y');
    $experience=control($_POST['totalexp'],1,2,'Experience','Y');
    $comment=control($_POST['strcomments'],10,500,'Comment','N');

    $file_name = str_replace('_','',$_FILES['filename']['name']);
    $file_error = $_FILES['filename']['error'];

    if(!is_numeric($strno))
    {
    echo "Phone/Mobile Should be Numeric";
    }
    else
    (
    $upload = false;
    $explode_file = explode('.',$file_name)
    $extension_supplied = $explode_file[count($explode_file) - 1];
    $extension_allowed = array('doc','docx');
    for($check=0; $check<count($extension_allowed); $check++)
    {
    if($extension_supplied == $extension_allowed[$check])
    {
    $upload = true;
    }
    }
    // current timestamp //
    $timestamp = time();
    // temporary file name //
    $tmp_file_name = strtolower($fname)."_".strtolower($lname)."_".$timestamp."_".$file_name;
    // target directory //
    $target = "resume_coll/".$tmp_file_name;
    if($upload == true)
    {
    // connecting to database server //
    mysql_connect('db.domain.net','dbo3','glo');
    mysql_select_db('db1234566');
    $sql = "select email from tbl_user_details where email='$email'";
    if(mysql_num_rows(mysql_query($sql)) == 0)
    {
    $sql = "select phone_mobile from tbl_user_details where phone_mobile='$phone'";
    if(mysql_num_rows(mysql_query($sql)) == 0)
    {
    $sql = "insert into tbl_user_details values('','$job','$gender','$fname','$lname','$city','$state','$country',$phone,'$email',$experience,'$comment','$tmp_file_name',now())";
    if(mysql_query($sql))
    {
    if(is_uploaded_file($_FILES['filename']['tmp_name']))
    {
    if(move_uploaded_file($_FILES['filename']['tmp_name'],$target))
    {
    $message ="
    <table>
    <tr><th colspan=3 style='text-align:left;'>User Details</th></tr>
    <tr><td>First Name</td><td>/td><td>$fname</td></tr>
    <tr><td>Last Name</td><td>/td><td>$lname</td></tr>
    <tr><td>City</td><td>/td><td>$city</td></tr>
    <tr><td>State</td><td>/td><td>$state</td></tr>
    <tr><td>Country</td><td>/td><td>$country</td></tr>
    <tr><td>Phone/Mobile</td><td>/td><td>$phone</td></tr>
    <tr><td>Email</td><td>/td><td>$email</td></tr>
    <tr><td>Experience</td><td>/td><td>$experience Year(s)</td></tr>
    <tr><td>Comment</td><td>/td><td>$comment</td></tr>
    <tr><td>Resume</td><td>/td><td><a href=http://mydomain.com/resume_coll/$tmp_file_name>Download Now</a></td></tr>
    </table>";
    $receiver = 'mydomain.com';
    $subject = "Resume Uploaded by ".ucwords($fname)." ".ucwords($lname);
    echo "in resume upload";
    $headers = "From:".$email."\r\n"."Reply-To:".$email."\r\n";
    $headers .= "Content-type: text/html\r\n";
    //$message = htmlentities($message);
    $mail = mail($receiver,$subject,$message,$headers);
    if($mail)
    {
    echo "You will receive a confirmation E-mail with User Name and Password information ";
    }
    else
    {
    echo "Internet Connection Problem";
    }
    }
    else
    {
    echo "Resume not Transfer to Server";
    }
    }
    else
    {
    echo "Resume is not Uploaded.";
    }
    }
    }
    else
    {
    echo "This Phone/Mobile is Already Existed";
    }
    }
    else
    {
    echo "This Email Already Uploaded Resume";
    }
    }
    else
    {
    echo "Invalid File Extension (<b>$extension_supplied</b>) to Upload.";
    }
    }
    }
    }
    function execute_code()
    {
    return userdata();
    }
    echo execute_code();
    ?>

  6. #6
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,154
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Put your PHP code in [ php ] [/ php ] (without the spaces) and tell me what line number (or give the entire error message). Its' too hard to read this, the way it is posted.

  7. #7
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok sorry, m unable to upload the file to database ( i want to store the file in the given target path) and now its giving error as ( Invalid File Extension () to Upload. )

  8. #8
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php
    function control($val,$min,$max,$ctype,$check)
    {
    -----
    }

    function userdata()
    { if(isset($_POST['btnSub2']))
    {$resume_file_name = str_replace('_','',$_FILES['filename']['name']);
    $file_error = $_FILES['filename']['error'];
    if(!is_numeric($strno))
    {
    echo "Phone/Mobile Should be Numeric";
    }
    else
    {
    $upload = false;
    echo "4Phone/Mobile Should be Numeric";
    $explode_file = explode('.',$filename);
    $extension_supplied = $explode_file[count($explode_file) - 1];
    $extension_allowed = array('.doc','.docx');
    for($check=0; $check<count($extension_allowed); $check++)
    {if($extension_supplied == $extension_allowed[$check])
    {$upload = true;}
    }
    // current timestamp //
    $timestamp = time();
    // temporary file name //
    $tmp_file_name = strtolower($firstname)."_".strtolower($lastname)."_".$timestamp."_".$filename;
    // target directory //
    $target = "abc/resume_coll/".$tmp_file_name;
    echo ".$target ,.$temp_file_name ";
    if($upload == true)
    {// connecting to database server //
    $sql=mysql_connect('db42.db.com','dbo4256938','abcd123');
    if (!$sql)
    {die('Connection failed: ' . mysql_error());
    }else
    { echo "Connection to MySQL server successful!";
    } $sql = mysql_select_db($db4256938);
    ---------
    -------
    if(is_uploaded_file($_FILES['filename']['tmp_name']))
    {
    if(move_uploaded_file($_FILES['filename']['tmp_name'],$target))
    {
    $message ="
    <table>-----<tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/$tmp_file_name>Download Now</a></td></tr>
    ----- </table>
    $receiver = 'abc@xyz.com';
    $subject = "Resume Uploaded by ".ucwords($firstname)." ".ucwords($lastname);
    echo "in resume upload";
    $headers = "From:".$email."\r\n"."Reply-To:".$email."\r\n";
    $headers .= "Content-type: text/html\r\n";
    //$message = htmlentities($message);
    $mail = mail($receiver,$subject,$message,$headers);
    if($mail)
    {
    echo "You will receive a confirmation E-mail with User Name and Password information "; }
    else
    {
    echo "Invalid File Extension (<b>$extension_supplied</b>) to Upload.";
    }function execute_code()
    {
    return userdata();
    }
    echo execute_code();
    ?>

    I want to upload the file in target path but getting error as Invalid File Extension () to Upload. please help me .

  9. #9
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,154
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Please re-post your code putting them in [ php ] and [/ php ] tags (but remove the extra spaces inside the tags, so it formats it so it is easier to read

  10. #10
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    $resume_file_name str_replace('_','',$_FILES['filename']['name']);
    $file_error $_FILES['filename']['error'];
    if(
    is_numeric($strno))
    {echo 
    "Phone/Mobile Should be Numeric";
    } else{
    $upload == false;
    $explode_file explode('.',$filename);
    $extension_supplied $explode_file[count($explode_file) - 1];
    $extension_allowed = array('.doc','.docx');
    for(
    $check=0$check<count($extension_allowed); $check++)
    {if(
    $extension_supplied == $extension_allowed[$check])
    {
    $upload == true;
    }} 
    //$timestamp = time();
    $tmp_file_name strtolower($firstname)."_".strtolower($lastname)."_".$timestamp."_".$filename;
    $target "mine/resume_coll/".$tmp_file_name;        
    if(
    $upload == true)
    {
    $sql=mysql_connect('db425.db.com','dbo425','abc123456'); 
    hi, i am trying to upload the file in target path(folder) but m getting error as invalid File Extension to upload(). kindly help me .is this code correct .?

  11. #11
    SitePoint Member
    Join Date
    Nov 2012
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP Code:
    function control($val,$min,$max,$ctype,$check)
    {
    }function 
    userdata() 
    { if(isset(
    $_POST['btnSub2']))
    {
    $resume_file_name str_replace('_','',$_FILES['filename']['name']);
    $file_error $_FILES['filename']['error'];
    if(!
    is_numeric($strno))
    {echo 
    "Phone/Mobile Should be Numeric";} 
    else{
    $upload false;
    $explode_file explode('.',$filename);
    $extension_supplied $explode_file[count($explode_file) - 1];
    $extension_allowed = array('.doc','.docx');
    for(
    $check=0$check<count($extension_allowed); $check++)
    {if(
    $extension_supplied == $extension_allowed[$check])
    {
    $upload true;}
    }
    $timestamp time();
    $tmp_file_name strtolower($firstname)."_".strtolower($lastname)."_".$timestamp."_".$filename;
    $target "abc/resume_coll/".$tmp_file_name;
    echo 
    ".$target ,.$temp_file_name ";
    if(
    $upload == true)
    // connecting to database server //
    $sql=mysql_connect('db42.db.com','dbo4256938','abcd123');
    if (!
    $sql
    {die(
    'Connection failed: ' mysql_error());
    }else
    { echo 
    "Connection to MySQL server successful!";
    $sql mysql_select_db($db4256938);
    ---------
    -------
    if(
    is_uploaded_file($_FILES['filename']['tmp_name']))
    {
    if(
    move_uploaded_file($_FILES['filename']['tmp_name'],$target))
    {
    $message ="
    <table> <tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/
    $tmp_file_name>Download Now</a></td></tr>
     </table>
    $receiver = 'abc@xyz.com';
    $subject = "Resume Uploaded by ".ucwords($firstname)." ".ucwords($lastname);
    echo "
    in resume upload";
    $headers = "From:".$email."\r\n"."Reply-To:".$email."\r\n";
    $headers .= "Content-typetext/html\r\n";
    //
    $message = htmlentities($message);
    $mail = mail($receiver,$subject,$message,$headers);
    if(
    $mail)
    {echo "
    You will receive a confirmation E-mail with User Name and Password information "; }
    else
    {echo "
    Invalid File Extension (<b>$extension_supplied</b>) to Upload.";
    }function execute_code()
    {return userdata();
    }echo execute_code(); 

  12. #12
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,154
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Okay, do you see in your paste how the formatting just seems to go crazy after $message ="?

    You forgot to close the ending " for your $message variable for one.
    PHP Code:
    $message ="
    <table> <tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/
    $tmp_file_name>Download Now</a></td></tr>
     </table> 
    Should be
    PHP Code:
    $message ="
    <table> <tr><td>Resume</td><td>/td><td><a href=http://abc.com/abc/resume_collect/
    $tmp_file_name>Download Now</a></td></tr>
     </table>"


  13. #13
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    Location
    Ohio
    Posts
    5,154
    Mentioned
    152 Post(s)
    Tagged
    0 Thread(s)
    Second, your error message isn't based on any validation of the file extension but rather the validation of whether the e-mail was sent or not.
    PHP Code:
    if($mail// checks mail variable...
    {
      echo 
    "You will receive a confirmation E-mail with User Name and Password information "
    }
    else
    {
      echo 
    "Invalid File Extension (<b>$extension_supplied</b>) to Upload.";



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •