Jump to content

azeem123456

Members
  • Posts

    21
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

azeem123456's Achievements

Member

Member (2/5)

0

Reputation

  1. hi i want to uplaod file i am having problem in setting directory path when u user press upload button the fiile or image which user attached save on C:\wamp\www\pra\public\images could you tell me how to set this path i an sucessful to save the file on c:\wamp\uploades_images with this code here is code $upload_errors= array (UPLOAD_ERR_OK => "No errors.", UPLOAD_ERR_INI_SIZE =>"Larger than upload_max_filesize.", UPLOAD_ERR_FORM_SIZE =>"Lager than form MAX_FILE_SIZE.", UPLOAD_ERR_PARTIAL=>"Partial upload.", UPLOAD_ERR_NO_FILE=>"No file.", //UPLOAD_ERR_N0_TMP_DIR =>"No temporary directory.", UPLOAD_ERR_CANT_WRITE=>"Can't write to disk.", UPLOAD_ERR_EXTENSION=>"File upload stopped by extension."); if(isset($_POST['submit'])){ $tmp_file=$_FILES['file_upload']['tmp_name']; $target_file= basename($_FILES['file_upload']['name']); $upload_dir="uploads"; if(move_uploaded_file($tmp_file, $upload_dir."/".$target_file)){ $message="Uploaded sucessfully"; }else { $error=$_FILES['file_upload']['error']; $message=$upload_errors[$error]; } } kindly help me ?>
  2. i am setting session for a user when a user login it redirect to staff.php file in the start of staff.php there msg should display welcomes to the staff area and my user namee i mean if i login with name azeem then it shud say welcome to staff area ,azeem problem is this when i hit login button it takes me to staff.php area with this warning or error msg kindly help methis is the msg i got Staff Menu Welcome to staff Area., Notice: Undefined index: username in C:\wamp\www\az\staff.php on line 14 this is my few lines of code where i set my session $username = trim(mysql_prep($_POST['username'])); $password = trim(mysql_prep($_POST['password'])); $hashed_password = sha1($password); if ( empty($errors) ) { $query = "SELECT id,username "; $query .= "FROM users "; $query .= "WHERE username = '{$usrname}' "; $query .= "AND hashed_password ='{$hashed_password}' "; $query .= "LIMIT 1"; $result_set=mysql_query($query); confirm_query($result_set); if(mysql_num_rows($result_set)==1){ $found_user=mysql_fetch_array($result_set); $_SESSION['user_id']= $found_user['id']; $_SESSION['username'] =$found_user['username']; redirect("staff.php"); } else { $message="username/Password combination incorrect.<br/> check may be caplocks is on and try again."; } and in staff.php i m calling it this session is like this <td width="891" align="left" bgcolor="#FFFFFF" id="pages"> <h2>Staff Menu</h2> <p> Welcome to staff Area.,<?php echo $_SESSION['username'];?></p>
  3. hi i am making content management system and i m having issue in deletion of page when i press delete then it gives me error Page deletion failed. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'LIMIT 1' at line 1 Return to Main Site ...kindly help me please my code is <?php require_once("includes/connection.php"); ?> <?php require_once("includes/functions.php"); ?> <?php // make sure the subject id sent is an integer if (intval($_GET['page']) == 0) { redirect_to('content.php'); } $id = mysql_prep($_GET['page']); // the page's subject_id for the redirect if ($page = get_page_by_id($id)) { $query = "DELETE FROM pages WHERE id = {$page['id']} LIMIT 1"; $result = mysql_query ($query); if (mysql_affected_rows() == 1) { // Successfully deleted redirect_to("edit_subject.php?subj={$page['subject_id']}"); } else { // Deletion failed echo "<p>Page deletion failed.</p>"; echo "<p>" . mysql_error() . "</p>"; echo "<a href=\"content.php\">Return to Main Site</a>"; } } else { // page didn't exist, deletion was not attempted redirect_to('content.php'); } ?> <?php mysql_close($db); ?>
  4. hi i am making content management system so when i edit some subject or i want to update subject if the subject update sucessfully it display msg subject update sucessfully i dnt know give any name to then it shud display error subject not updated i have written code but it not working like supppose i want to change the name of subject previous it was hello if i remove hello and click on update button it should display error cant not update in my script when i do this it just rremove the name its run update statement this is my code kindly help me out it doesnt shows errors msgs query= "UPDATE subjects SET menu_name= '{$menu_name}', position ={$position}, visible ={$visible} WHERE id = {$id}"; $result=mysql_query($query,$connection); if(mysql_affected_rows()==1){ // sucess $message = " The subject was sucessfully updated"; }else { //failed $message = " The subject updated failed"; $message .="<br/>".mysql_error(); } }else {//error occur $message = "there were".count($errors)." errors in the form."; } }//end of the if (isset(_spost) find_selected_page(); include("includes/header.php"); ?> <table width="100%" id="Structure"> <tr> <td width="19%" bgcolor="#660000" id="nevigation"> <?php navigation($sel_subject,$sel_page);?> </td> <td width="81%" bgcolor="#CCCCCC"id="pages"> <h2> Edit Subject:<?php echo $sel_subject['menu_name'];?></h2> <?php if(!empty($message)) { echo "<p class=\">" .$message ."</p>"; } ?> <form action="edit_subject.php?subj=<?php echo urlencode($sel_subject['id']);?>" method="post"> <p> Subject name:<input type="text" name="menu_name" value="<?php echo $sel_subject['menu_name'];?>" id="menu_name" /></p> <p> position: <select name="position"> <?php $subject_set= get_all_subjects(); $subject_count= mysql_num_rows($subject_set); for ($count=1;$count<= $subject_count+1;$count++){ echo"<option value=\"{$count}\""; if($sel_subject['position']==$count){ echo "selected";} echo ">{$count}</option>"; }?> </select> </p> <p> visible : <input type="radio" name="visible" value="0"<?php if($sel_subject['visible']==0){echo "checked";}?> />No <input type="radio" name="visible" value="1" <?php if($sel_subject['visible']==1){echo "checked";}?> />YES </p> <input type="submit" name="submit" value="Edit Subject" /> </form> <br/> <a href="content.php">Cancel</a> </td> </tr> </table> <?php require("includes/footer.php");?>
  5. i m stucked in form validation i am trying to make content management system so which i have 2 subjects products services without form validation when i add new subject my code work i want to validate the form like what if user send long string as an menu name or what if user didn't enter the name but the send the position of new subject so i want to validate these things so i wrote these code it compiles correct and doesn't give me error when i add some subject it doesn't respond anything it doesn't add anything i write data on menu name select position number then click on Yes radio button to make it visible and hit submit button it doesn't do anything not add any thing or doesn't redirect back to content.php it doesnt work :(help me out please <?php include("includes/connection.php"); include("includes/functions.php"); // form validation $errors=array(); $required_feilds=array('menu_name','postion','visible'); foreach($required_feilds as $feildname){ if(!isset($_POST[$feildname])|| empty($_POST[$feildname])){ $errors[]=$feildname; } } $feild_with_lengths=array('menu_name'=>30); foreach($feild_with_lenghts as $feildname=>$maxlenght){ if(strlen(trim(mysql_prep($_POST[$feildname])))>$maxlenght){ $errors[]=$feildname;} } if(!empty($errors)){ redirect("new_subject.php"); } //$_POST = array_map('mysql_real_escape_string', $_POST); $menu_name= mysql_prep($_POST['menu_name']); $position = mysql_prep($_POST['position']); $visible = mysql_prep($_POST['visible']); $query = "INSERT INTO subjects ( menu_name, position, visible) Values ( '{$menu_name}',{$position},{$visible})"; if(mysql_query($query,$connection)){ header("Location:content.php"); exit; }else { echo "<p> Subject creation is failed .</p>"; echo "<p>".mysql_error()."</p>"; } mysql_close($connection); ?>
  6. my final project is to make content management system and i am almost compelete i just need one thing to add up forums module as i new learner of php i need to know tha basic logic of how to make a forums in php i hope this is not again the rules of this site to ask logic of something so i need to know to algorithm to make forum portion if any one could help me and tell me logic i want to make it myself but i need to know how forums basically works so if any one could help me please
  7. his time same warning is appear but insteade of connection.php is saying create_subject.php Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\htdocs\widget_corp\create_subject.php:1) in C:\xampp\htdocs\widget_corp\create_subject.php on line 11 check out it was C:\xampp\htdocs\widget_corp\connection.php:1) before now this is in C:\xampp\htdocs\widget_corp\create_subject.php:1)
  8. di du send me on my email adress? i didnt recieve if you are senidng me thorugh yahoo id then sent me mahii@live.com please i dont know what is porblem in currenly email i d i gave you it doesnt receive emails from yahoo sometime kindly send on mahii@live.com sorry for inconvience
  9. oh yeh sorry im using xampp 1.7.2 i told you my control panel version thanks for correcting me so do i have to install latest version?
  10. i am using xampp and writing code on dreamwaver xampp version 2.5.8 well to be ho nest i m new learner so all i know about about version i have told you kindly quide me please
  11. i tried still not work could you remove all whitespace for me please and send file again i run on it and check it because i do not think i have left any whitespace ?
  12. i have sent my project azeem rathore is my name i send from hotmail id so kindly check it out please thanks
  13. oh i read it wrong sir i thought u asking me content.php sir i didnt make seperate db connection file as i m new learner of php so i m not perfect in it there is nothing important for me sir.... all i want to learn and gain knowlegde sir could you tell me your email adress i send you my whole project and file to your email adress then u mite eaisly sort out my problem ths is how i made my dataabase connection sir <?php $connection = mysql_connect("localhost","root",""); if (!$connection){ die ("Database connection failed".mysql_error()); } $db_select= mysql_select_db("widget_corp",$connection); if (!$db_select){ die ("Database selection failed".mysql_error()); } ?> in html body there is my queries as u have seen above i provide you what you just asked me or give me email id please at the end i close my conection ?php mysql_close($connection); ?>
  14. after filling form my new file create_subject.php take all information this is code <?php require_once("includes/connection.php");?> <?php require_once("includes/functions.php");?> <?php $menu_name= $_POST['menu_name']; $position = $_POST['position']; $visible = $_POST['visible']; $query = "INSERT INTO subjects ( menu_name, position, visible) Values ( '{$menu_name}',{$position},{$visible})"; if(mysql_query($query,$connection)){ header("Location": "content.php"); exit; }else { echo "<p> Subject creation is failed .</p>"; echo "<p>".mysql_error()."</p>"; } ?> <?php mysql_close($connection);?> it add subject corrctly it add all subjects but it doesnt redirect me bak to my content.php page after adding information it gives error cannot modify header as i mention before
  15. this is my new_subject.php file which has form in it to add new subject ?php require_once("includes/connection.php");?> <?php require_once("includes/functions.php");?> <?php find_selected_page(); ?> <?php include("includes/header.php"); ?> <table id="Structure"> <tr> <td id="nevigation"> <?php navigation($sel_subject,$sel_page); ?> </td> <td id="pages"> <h2> Add Subject</h2> <form action="create_subject.php" method="post"> <p> Subject name:<input type="text" name="menu_name" value="" id="menu_name" /></p> <p> position: <select name="position"> <?php $subject_set= get_all_subjects(); $subject_count= mysql_num_rows($subject_set); for ($count=1;$count<= $subject_count+1;$count++){ echo"<option value=\"{$count}\">{$count}</option>"; } ?> </select> </p> <p> visible : <input type="radio" name="visible" value="0" />No <input type="radio" name="visible" value="1" />YES </p> <input type="submit" value="Add Subject" /> </form> <br/> <a href="content.php">Cancel</a> </td> </tr> </table> <?php require("includes/footer.php");?> //////////////////////////////////////////////////////// when i run this file it works correctly and give me form [attachment deleted by admin]
×
×
  • 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.