Jump to content

Search the Community

Showing results for tags 'php'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

  1. Hello everyone, I am having a pretty basic problem. Below is a piece of my code, the first few lines of "Get Value for Bodyfitting" basically gets a value and assigns it to some variables through a select statement (this later on you will see that the values are being shown through echo on the screen in a form of a javascript dropdown for "Style Selection"), now the second few lines is where I have some issues in the "Value for Field 1", I want to get back a value by getting the answer from the first sql but I can't get the value for "$newBodyfitting" because it is only assigned later on, this will allow me to get a dropdown for a "Select Front", this is dependent on the "Select Style" if you see below, I know it might sound confusing. Thanks in advance. //Get Division $div_query = "SELECT distinct DIVISION, CLOTHDB FROM MTM_DIVISIONS_S ORDER BY CLOTHDB"; $div_result = oci_parse($connect,$div_query); oci_execute($div_result); while ($div_row = oci_fetch_array($div_result, OCI_ASSOC)) { $divArray[] = "{$div_row['CLOTHDB']}"; $divDivArray[] = "{$div_row['DIVISION']}"; } oci_free_statement($div_result); //Get Value for Bodyfitting $bodyfitting_query="SELECT BODYFITTING, BFCODE FROM MTM_STYLES_S WHERE DIVISION= '".$divDivArray[$i]."' AND STYLE_TYPE='BODY' GROUP BY BODYFITTING, BFCODE ORDER BY BODYFITTING"; $bodyfitting_result = oci_parse($connect,$bodyfitting_query); oci_execute($bodyfitting_result); //Get Value for Field1 $field1_query="SELECT MTM_STYLES_S.CODE,MTM_SUFFEX_S.TEXT FROM MTM_STYLES_S,MTM_SUFFEX_S WHERE MTM_SUFFEX_S.DIVISION='".$divDivArray[$i]."' AND (MTM_STYLES_S.FIELD=MTM_SUFFEX_S.FIELD AND MTM_STYLES_S.CODE=MTM_SUFFEX_S.CODE) AND MTM_STYLES_S.STYLE_TYPE='BODY' AND MTM_STYLES_S.BODYFITTING='".$newBodyfitting."' AND MTM_STYLES_S.FIELD=1 ORDER BY MTM_STYLES_S.FIELD,MTM_STYLES_S.CODE"; $field1_result = oci_parse($connect,$field1_query); oci_execute($field1_result); //Setup new dropdown for Style Selection echo "\tClearOptionsFastAlt('bodyfitting');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.bodyfitting;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Style -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($bodyfitting_row = oci_fetch_array($bodyfitting_result, OCI_ASSOC)) { $newBodyfitting=$bodyfitting_row['BODYFITTING']; $newBfcode=$bodyfitting_row['BFCODE']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newBfcode.' '.$newBodyfitting."', '".$newBfcode."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } //Setup dropdown new Front dependent on Style above echo "\t\t\tdocument.pickDivision.bodyfitting.options[0].selected = true;\n\n"; echo "\t\tdocument.pickDivision.field1;\n"; echo "\tClearOptionsFastAlt('field1');\n"; echo "\t\tdocument.pickDivision.textInput.value='';\n"; echo "var divcomp = division.replace(/^\s+|\s+$/g, '');"; echo "var selectObj = document.pickDivision.field1;\n"; echo "var numShown = selectObj.options.length;\n"; echo "selectObj.selectedIndex = -1;\n"; echo "\t\t\tselectObj.options[numShown] = new Option('- Select Front -', '');\n"; echo "\t\t\tnumShown++;\n"; while ($field1_row = oci_fetch_array($field1_result, OCI_ASSOC)) { $newField1=$field1_row['TEXT']; $newField2=$field2_row['CODE']; echo "\t\t\tselectObj.options[numShown] = new Option('".$newField1.''.$newField2."');\n"; echo "\t\t\tnumShown++;\n"; $y++; } echo "\t\t\tdocument.pickDivision.field1.options[0].selected=true;\n\n"; oci_free_statement($field1_result); oci_free_statement($bodyfitting_result);
  2. Hello! l was wondering if you might be able to help me. l am trying to find out how to make PHP read a file, and then check if that text is already there, and if so don't re-write it. l'll give out my code for an example. <?php //text file that counts the peeps that visit the site $lne = "line.txt"; $File = "counter.txt"; $handle = fopen($File, 'r+') ; //file open $data = fread($handle, 512) ; //file read $count = $data + 1; //Adds one person :DDDDD fseek($handle, 0) ; fwrite($handle, $count) ; //saves the new person echo 'Count #'.$count; // // // // // // $File2 = "ips.txt"; fclose($handle) ; if (isset($_POST['ip'])) { $ip = $_POST['ip']; $port = $_POST['port']; echo 'Connecting to ' . $ip . ':' . $port; exit(); } $ip = getenv("REMOTE_ADDR"); echo '<br>'.$ip; $handle2 = fopen($File2, 'r+') ; //file open $data2 = fread($handle2, 512) ; //file read fwrite($handle2,"\n" . $ip .':' . $count); //saves the new ip ?> <html> <form method="POST"> <input type="hidden" name="ip"> <input type="hidden" name="port"> </html> lt just re-writes the lP with the new counter, very annoying. l can filter it out with VB but l want it all to be server sided. Thank you for your time ~Papa Beans
  3. That's the error I get: For the following code: function post($type, $brand, $gender, $size, $hand, $isNew, $price, $desc, $imgname, $name, $userid, $phone) { $con=connect(); if (!$con) die('Could not connect: ' . mysql_error()); // Check connection $type = check_input ($type); $brand = check_input ($brand); $gender = check_input ($gender); $size = check_input ($size); $hand = check_input ($hand); $price = check_input ($price); $desc = check_input ($desc); $imgname = check_input ($name); $userid = check_input ($usid); $name = check_input ($name); $phone = check_input ($phone); $date = date("Y/m/d"); $sql="INSERT INTO spikes (type, brand, gender, size, hand, new, price, description, imgname, date, name, userid, phone) VALUES('$type', '$brand', '$gender', '$size', '$hand', '$isNew', '$price', '$desc', '$imgname', '$date', '$name', '$userid', '$phone')"; if (!mysql_query($sql,$con)){ die('Error3: ' . mysql_error($con)); } mysql_close($con); } function check_input($value) { // Stripslashes if (get_magic_quotes_gpc()) $value = stripslashes($value); // Quote if not a number if (!is_numeric($value)) $value = "'" . mysql_real_escape_string($value) . "'"; return $value; } I really don't understand what I'm doing wrong..
  4. I am confuse of web server and application server and looking for the solution. It would be great if someone explain me detail about the differences and use of the appserver.
  5. Hi We moved a site that was developed by outsource company from old to new server and seem to be experiencing some issues on the new server. The products don’t show up anymore and no changes have been done on the code. When I turn errors on like http://mlungisi-001-site1.smarterasp.net/products.php there are some notices but surprisingly it worked on the old server. Windows 2008, IIS7 Server Errors turned on Notice: A session had already been started - ignoring session_start() in H:\root\home\mlungisi-001\www\site1\libs\products.php on line 27 session_start(); Notice: Undefined variable: iAUID in H:\root\home\mlungisi-001\www\site1\libs\users.php on line 73 GetAU($iAUID, $AUID, $Email, $Firstname, $Surname, $COID, $CellNo, $PWord, $Active_Tag); Notice: Undefined offset: 0 in H:\root\home\mlungisi-001\www\site1\libs\users.php on line 74 GetAU($iAUID, $AUID, $Email, $Firstname, $Surname, $COID, $CellNo, $PWord, $Active_Tag); Notice: Undefined offset: 0 in H:\root\home\mlungisi-001\www\site1\libs\users.php on line 75 $_SESSION['uSurName'] = $Surname[0]; Notice: Undefined index: uUserTypeID in H:\root\home\mlungisi-001\www\site1\libs\products.php on line 1244 if ($_SESSION['uUserTypeID'] == 2) I have tried to kill sessions before starting a new one but that didn’t help either. I am caught between a latch and a door, don’t know whether its code issue or PHP configurations or MySQOL. Please share ideas Attachments Products.php Users.php users.php products.php
  6. i want to update my database,but unfortunately not change. anyone can help me.i can't solved it over 1 week. please. this is my code: <? include "new.php"; $response = array(); if (isset($_GET['ID_Person']) && isset($_POST['FirstName']) && isset($_POST['MiddleName']) && isset($_POST['LastName']) && isset($_POST['AliasName']) && isset($_POST['Gender']) && isset($_POST['CityBirth']) && isset($_POST['DateBirth']) && isset($_POST['MonthBirth'])&& isset($_POST['YearBirth'])) { $id = $_GET ['ID_Person']; $name = $_POST['FirstName']; $middle = $_POST['MiddleName']; $last = $_POST['LastName']; $alias = $_POST['AliasName']; $gender = $_POST['Gender']; $citybirth = $_POST['CityBirth']; $datebirth = $_POST['DateBirth']; $monthbirth = $_POST['MonthBirth']; $yearbirth = $_POST['YearBirth']; $query = "update T_Person set First_Name_Person = '$name' , Middle_Name_Person = '$middle' , Last_Name_Person = '$last' , Alias_Person = '$alias' , Gender_Person = '$gender' , City_Birth_Person = '$citybirth', Date_Birth_Person = '$datebirth', Month_Birth_Person = '$monthbirth', Year_Birth_Person = '$yearbirth' where ID_Person = '$id'"; $hasil = sqlsrv_query($conn,$query,$response); $rows_affected = sqlsrv_rows_affected($hasil); if ($rows_affected() === false) { // jika gagal update $response["sukses"] = 1; $response["pesan"] = "Member berhasil diupdate"; // memprint/mencetak JSON respon echo json_encode($response); } else { // jika gagal di update $response["sukses"] = 0; $response["pesan"] = "Gagal update"; // memprint/mencetak JSON respon echo json_encode($response); } } else { // jika data tidak terisi/tidak terset $response["sukses"] = 0; $response["pesan"] = "data belum terisi"; // memprint/mencetak JSON respon echo json_encode($response); } ?>
  7. We have a complete site we are about to start....about 3-4 months of work and need an additional developer to assist. Must be US based(but remote, anywhere)...avail during biz hours and knows the CAKE framework. We need a self starter that can work on their own and work quickly. Would consider this full time work and could be beyond the 3-4 month project. Send information to: resume@excelaweb.com US based but can be remote...
  8. I downloaded this source package for a poll system that runs on jquery and php. Here is the "to do" list to make the program work. 1. Setup mysql database to have one row and x number of columns (however many questions in poll). 2. Configure updatePoll.php with database location, name, and password. 3. Include in index.php file the required JS: createPoll.js style.css from jQuery: jquery-1.4.4.min.js jquery.ui.core.js jquery.easing.1.3.js jquery.core.js 4. Load index.html in your browser! i 5. Style poll questions using the style.css, and/or change to be traditional poll (i.e. radio buttons). 6. Demo: http://www.bheberto.com/devblog.php?id=5 I got steps 1 and 2 done. I also got part of 3 done. How do you include the jquery-1.4.4.min.js? is that something your download? I know nothing about jquery, I only know php, html, and css right now. index.html style.css updatePoll.php
  9. Hello guys, I need a small help here. So, i want to add the code below to one of the pages in my website. This is the page that I want modify: I tried to add it many times, but there are errors show up and the page became not organized. Thank you in advance
  10. Hello there, I use an element attached in this zip (assets file is missing due to the file size and i don't think its necessary for what i need to ask). Its actually a button with a pop up form, where the user fills in the name, lastname, e-mail and e-mail confirmation, telephone(optional), question/comment, send copy to my e-mail fields. Inside this, i need to add an extra field, where the user can upload his/her cv (doc, docx, txt, rtf, pdf file types) and when click on send the user will receive the CV file also along with the other information. I tried to add an Upload field called cv inside the code, but when i click on send, i have message: Invalid file type but the message is sent and at the e-mail i see all the info but i see the file name of cv, not the file. Any help with this please?A friend of mine that took a look told me that this form sends info via ajax and that i have to change the way that the information is being sent in order to be able to send the file. Thank you in advance contact-form.zip
  11. Hi all! Happy Tuesday! I wanted to reach out and see if any of you could assist me in finding new ways to network with PHP & Drupalistas in the DC/Metro area. I CURRENTLY HAVE SEVERAL OPENINGS FOR PHP AND DRUPAL DEVELOPERS IN THE DC AREA! I am looking for enthusiastic developers who are passionate about the cutting edge techonogies and want to grow within the company! Positions are contract to hire so I am really looking for dedicated workers who are looking to find a stable place in this modern, fast paced and tight knit compent. Great Work Atmosphere! Do you know any people who would be interested in learning more? Can you help me spread the word? I attached a sample description for you to review below. Please send resume to: Romina.nally@clovisgroup.com JOB TITLE – SR. PHP / DRUPAL DEVELOPER Locations: Vary. DC, VA, MD Duration: Contract to Permanent Hire Start Date: Immediately Job Summary: The Senior Associate, Technology provides technical leadership to the project team by taking responsibility for a specific component or track of the project architecture. This includes planning, estimation, people management, issue resolution and quality assurance. Responsibilities: • Ability to lead a small team of 3-5 individuals • Ability to serve as a lead developer, responsible for large scale development and data migration tasks in Drupal and PHP • Construct conceptual and technical designs that include the use of Object-Oriented (OO) techniques • Write Java and/or PHP code based on requirements defined in use cases • Develop Object-Oriented (OO) code and/or provide maintenance and enhancements to existing code based upon a solid understanding of OO design • Work with business users to gather requirements, write functional and technical specifications • Conduct multiple levels of testing including unit, system, integration and performance • Estimate and plan iterative / agile releases • Configure Drupal and create custom modules to meet requirements Design, develop, and test an overall solution that includes a content management system (CMS), including capabilities such as social collaboration, analytics, CMS content entry, CMS content migration, explicit / implicit personalization, developing content types or content objects, site architecture, and page templates • Estimate and plan releases for a CMS implementation • Anticipate issues and risks at the module level and escalate appropriately • Facilitate workshops and client meetings • Mentor junior team members Experience Guidelines: • Demonstrates ability to configure Drupal and create custom Drupal modules using the core API • Experience with Drupal 6/7 - knowledge of all major contributed modules including CTools, Views, Panels, and CCK, extending them through code • Mastery of PHP, HTML/5, CSS/3, and JavaScript/jQuery: 5 years of programming experience across these languages • Strong skills with GIT preferred • Ability to learn new technologies quickly • Minimum 2 years’ experience with the LAMP (Linux, MySQL, PHP) technology stack • Minimum 1 year design and development experience with Drupal web content management solution (WCMS) • Experience with database technologies such as Oracle or Microsoft SQL Server • Solid understanding of all parts of Software Engineering (e.g. Requirements, Design, Implementation, Testing) and the Software Development Life Cycle (SDLC) • Experience working in agile or iterative SDLCs • Experience with Object Oriented Technologies • Knowledge working with PHP and/or Drupal solutions in a cloud-based environment • Ability to work with key owners and stakeholders to document requirements • Proven leadership skills to independently manage a track of work with 3 - 5 people, during various phases of the project lifecycle Education: • Bachelor’s degree required and degree in Computer Science or related technology field preferred.
  12. hello my friends i'm trying to get some data from the active directory but i have a problem when the stored eamil in capital letters or mixed letters , i want the ldap_search() to search the AD ignoring the case of the letters here's my function and thank you in advance function LDAPget($email) { $ldap['server'] = 'xx.xx.xx.xx'; $ldap['user'] = 'x'; $ldap['pass'] = 'any'; $ds = ldap_connect($ldap['server']); $bind = ldap_bind($ds, $ldap['user'], $ldap['pass']); $filter = "(mail=$email)"; $sr = ldap_search($ds, $ldap['base_dn'], $filter, array('*')); $rows = ldap_get_entries($ds, $sr); }
  13. Hello I want to start an affiliate programme for my online shopping website. If some customer comes to my site from a link from that affiliate site, how can I come to know and differentiate that customer from a customer who has directly come to my site? Should it be maintained in session? Or some php variable especially for tracking this? Thanks in advance
  14. I've got this sample of array data Array ( [0] => stdClass Object ( [fileid] => 333 [filename] => Douglas [datecreated] => 2013-10-25 09:53:27 [datemodified] => 2013-10-25 09:53:27 [fileAccess] => 1 [user_id] => 70 ) [1] => stdClass Object ( [fileid] => 326 [filename] => Yeah baby [datecreated] => 2013-10-24 09:02:05 [datemodified] => 2013-10-24 09:02:05 [fileAccess] => 1 [user_id] => 70 ) [2] => stdClass Object ( [fileid] => 329 [filename] => UNTITLED File [datecreated] => 2013-10-25 07:14:53 [datemodified] => 2013-10-25 07:14:53 [fileAccess] => 1 [user_id] => 70 ) [3] => stdClass Object ( [fileid] => 330 [filename] => UNTITLED FILE [datecreated] => 2013-10-25 07:17:55 [datemodified] => 2013-10-25 07:17:55 [fileAccess] => 1 [user_id] => 70 ) [4] => stdClass Object ( [fileid] => 332 [filename] => UNTITLED FILE [datecreated] => 2013-10-25 08:42:35 [datemodified] => 2013-10-25 08:42:35 [fileAccess] => 1 [user_id] => 70 [statuss] => 1 ) ) and by fileid I would like to check if the fileid is also existing on the other mysql. . so I did this foreach($array as $key => $row){ $query = $this->model->get($row->fileid); //query return true or false; if($query){ $array[$key]['stared'] = 1; } } but it gives an error. How will I going to insert a new variable on the current array loop if the fileid is existing. e.g. [4] => stdClass Object ( [fileid] => 332 [filename] => UNTITLED FILE [datecreated] => 2013-10-25 08:42:35 [datemodified] => 2013-10-25 08:42:35 [fileAccess] => 1 [user_id] => 70 [statuss] => 1 [stared] => 1 //IF STARED RETURN TRUE ) Thanks
  15. simple question what is the meaning and purpose of this: if($_FILES) thanks, cheers!
  16. Given an input of an expression consisting of a string of letters and operators (plus sign, minus sign, and letters. IE: ‘b-d+e-f’) and a file with a set of variable/value pairs separated by commas (i.e: a=1,b=7,c=3,d=14) write a program that would output the result of the inputted expression. For example, if the expression input was ("a + b+c -d") and the file input was ( a=1,b=7,c=3,d=14) the output would be -3. Thus far I have got this, it calculates the numbers but not sure how to calculate it by the letters abcd, <html> <head> </head> <body> <form action = "" method = "GET"> Number 1: <input type = "first" name = "input[]" size=3> <br/> Number 2: <input type = "second" name = "input[]" size=3> <br> Number 3: <input type = "third" name = "input[]" size=3> <br> Number 4: <input type = "fourth" name = "input[]" size=3> <br> <input type="hidden" name="calc" value ="yes"> <input type = "submit" name = "Calculate"/> </form> </body> </html> <?php print_r($_GET); $myInputs = $_GET['input']; // assigning $_GET value print_r($myInputs); echo $myInputs[0]+ $myInputs[1]; $myArray = array(); $myArray['a'] = 5; $myArray['b'] = 10 ; $myArray['c'] = 15 ; $myArray['d'] = 20 ; // using a,b,c,d only... using $_GET here echo $myArray['a']+$myArray['b']; // get directly from$_GET values. echo $_GET['input'][0]+ $_GET['input'][1]; ?>
  17. the form get's executed correctly n also shows the expected message(echo). but it does not insert any value in database. why it is so.PLZ help. <?php // Connects to your Database mysql_connect("localhost", "root", "") or die(mysql_error()); mysql_select_db("simple_login") or die(mysql_error()); //This code runs if the form has been submitted if (isset($_POST['submit'])) { //This makes sure they did not leave specific fields blank if (!$_POST['username'] | !$_POST['pass'] | !$_POST['pass2'] ) { die('You did not complete all of the required fields'); } // checks if the username is in use if (!get_magic_quotes_gpc()) { $_POST['username'] = addslashes($_POST['username']); } $usercheck = $_POST['username']; $check = mysql_query("SELECT username FROM users WHERE username = '$usercheck'") or die(mysql_error()); $check2 = mysql_num_rows($check); //if the name exists it gives an error if ($check2 != 0) { die('Sorry, the username '.$_POST['username'].' is already in use.'); } // this makes sure both passwords entered match if ($_POST['pass'] != $_POST['pass2']) { die('Your passwords did not match. '); } // here we encrypt the password and add slashes if needed $_POST['pass'] = md5($_POST['pass']); if (!get_magic_quotes_gpc()) { $_POST['pass'] = addslashes($_POST['pass']); $_POST['username'] = addslashes($_POST['username']); } //post date to variables $username= $_POST['username']; $pass= $_POST['pass']; $firstname= $_POST['firstname']; $middlename= $_POST['middlename']; $lastname= $_POST['lastname']; $email= $_POST['email']; if(isset($_POST['designation'])){ $designation=$_POST['designation'];} if (isset($_POST['gender'])){ $gender = $_POST['gender'];} if (isset($_POST['tskills'])) { $tskills=$_POST['tskills'];} // now we insert it into the database $insert = "INSERT INTO users (username, password,firstname,middlename,lastname,gender,tskills) VALUES ('$username' , '$pass' , '$firstname' , '$middlename' , '$lastname' , '$gender' , '$tskills' , '$designation' , '$email')"; $add_member = mysql_query($insert); ?> <h1>Registered</h1> <p>Thank you, you have registered - you may now login</a>.</p> <?php } else { ?> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <table border="0"> <tr><td> <legend>NAME</legend> FirstName: <input type="text" name="firstname" id="firstname"> <br/> MiddleName:<input type="text" name="middlename" id="middlename"> <br/> LastName: <input type="text" name="lastname" id="lastname"> <br/> </td></tr> <tr><td> <legend>PHYSICAL INFO</legend> Male <input type="radio" id="male" name="gender" value="male"><br/> Female<input type="radio" id="female" name="gender" value="female"><br/> </td></tr> <tr><td> <legend>TECHNICAL SKILLS</legend> <input type="checkbox" name="tskills[]" value="html">html<br/> <input type="checkbox" name="tskills[]" value="css">CSS<br/> <input type="checkbox" name="tskills[]" value="javascript">Javascript<br/> <input type="checkbox" name="tskills[]" value="jquery">Jquery<br/> <input type="checkbox" name="tskills[]" value="php">PHP<br/> <input type="checkbox" name="tskills[]" value="mysql">MySQL<br/> <input type="checkbox" name="tskills[]" value="codeignitor">CodeIgnitor<br/> </td></tr> <tr><td> <legend>CURRENT DESIGNATION</legend> <select name="designation"> <option type="text" value="developer" name="developer" id="developer"> Developer </option> <option type="text" value="designer" name="designer" id="designer"> Designer </option> <option type="text" value="analyst" name="analyst" id="analyst"> Analyst </option> <option type="text" value="manager" name="manager" id="manager"> Manager </option> <option type="text" value="marketing" name="marketing" id="marketing"> Marketing </option> <option type="text" value="trainee" name="trainee" id="trainee"> Trainee </option> </select> </td></tr> <tr><td>Email ID:<input type="email" name="email" id="name"></td></tr></br> <tr><td> <legend>LOGIN DETAILS</legend> <tr><td>Username:</td><td> <input type="text" name="username" maxlength="60"> </td></tr> <tr><td>Password:</td><td> <input type="password" name="pass" maxlength="10"> </td></tr> <tr><td>Confirm Password:</td><td> <input type="password" name="pass2" maxlength="10"> </td></tr> <tr><th colspan=2><input type="submit" name="submit" value="Register"></th></tr> </table> </form> <a href="login.php">PLEASE LOGIN</a><br/> <a href="form.php">FORGET PASSWORD</a> <?php } ?>
  18. Hello fellow freaks, I have been using my limited PHP skills for years in order to maintain existing code (not my own) and get basic functionality. I am now taking a formal course in PHP with an emphasis on Object Oriented design. Would love to here any feedback on OOP vs. procedural PHP. Kevin
  19. Hello everyone, i have a quiestion regarding a bug fixing. We have an online website and right now we are have a bug issue in one of the pages. Basically when we tried to to make changes in the page from the admin panel, and then click "save" we are redirected to the page and all the changes we have made are now blank and there are no changes to the front end. I am running into the issue that nothing can be edited because it will not be saved in the end. Any ideas how to remedy this?
  20. Basically my website is worldwide and I need to be able to detect users' time zones and display accurate times. I have this really neat script which used to work flawlessly well until now. It needs a timezone offset which I fetch with javascript and pass through a cookie. if(!empty($_COOKIE['tz']) && $_COOKIE['tz']>=-12 && $_COOKIE['tz']<=13){ $offset = $_COOKIE['tz']; $tz = timezone_name_from_abbr(null, $offset * 3600, true); if($tz === false) $tz = timezone_name_from_abbr(null, $offset * 3600, false); date_default_timezone_set($tz); }else{ date_default_timezone_set('UTC'); } The problem is that currently the timezone I'm testing in is Europe/Helsinki, which is UTC+2 (without daylight savings), but for some reason timezone_name_from_abbr() decides 2*3600 is Europe/Paris. I'm really bad with dates and time zones, I desperately need help, please!
  21. im using the jquery UI datepicker to submit a date to my database but i keep storing 0000-00-00 instead of the date how do I make the date show up in the database? can someone help me?
  22. Hello, I have one tar.Z file. I have to run shell script daily as it is required to update the database. customer_yyyymmdd_hhmi.tar.Z sales_ yyyymmdd_hhmi.csv (5 MB - 20 MB) purchase_ yyyymmdd_hhmi.xml (650 MB - 950 MB) I have made small part of XML file. There are 4 parts. There is PHP Script which is working but i need to change each time file like PART1.xml, PART2.xml etc. Things to do: 1) Extract tar.Z file and Read CSV and XML file. 2) Read whole XML file automatically. I hope i am clear. Thanks in advanced for your time and input.
  23. I want to create a real esatte website. This is part of my code. The user selects a category.Then ajaxhelp is called and sends the cariable category to ajax.php. There it gets the type of estate wuering the database. however i want to enable the selected="selected" option, in order in category php in id=category in the bottom to print the option the user has already selected. i don't know how to it. The selected option doesnt work <script> function ajaxhelp(str) { if (str=="") { document.getElementById("category").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("category").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","prosthiki_akinitou_form_ajax.php?category="+str,true); xmlhttp.send(); } </sqript> //category.php <tr > <td><h4>Category:<small class="red">*</small></h4></td> <td ><select name="category" onChange="ajaxhelp(this.value);"> <?php $category_array = get_categories(); //estate_fns echo '<option value=""><h4>- Choose Estate Category -</h4></option>'; foreach ($category_array as $row) { if($estate_array['catid'] === $row['catid']) { echo '<option selected="selected" value="'. $row['catid'].'"><h4>' . $row['catname'].'</h4></option>'; } else { echo '<option value="'. $row['catid'].'"><h4>' . $row['catname'].'</h4></option>';} } ?> </select> </td></tr> <?php echo '<tr >'; echo '<td><h4>Estate type:</h4></td> <td ><select name="eidos" id="category" >'; echo '</select> </td></tr>'; ?> //ajax.php include ('estate_sc_fns.php'); $katigoria = $_GET['category']; //get the value from ajax.php $estate_array = get_estate_details($_SESSION['estate_code']); //get the estate type the user already has entered from mysql $eidos_array = get_estate_type($category); //get all possible estate types from mysql foreach ($eidos_array as $row) { if($estate_array['estate_type'] === $row['estate_type'] ) { echo '<option selected="selected" value="'. $row['estate_type'].'"><h4>' . $row['estate_name'].'</h4></option>'; } else { echo '<option value="'. $row['estate_type'].'"><h4>' . $row['estate_name'].'</h4></option>';} } But the selected="selected" doesn't work! Please help how to do it?
  24. HI, Guys Im back! After i successfully found my solution to problem earlier. I want to ask what code i will add to have limitation to employee to admin can access, My problem is when My Employee Logged in he will direct to localhost/MIS/Webpage/Employee/home.php This is the correct for my employee but when i changed the address to localhost/MIS/Webpage/Admin/home.php My Employee can access the admin homepage. this is the problem i want to have limitation of my employee access. so this is my codes of my index.php <?php require 'core.php'; require 'connect.php'; if (loggedin()) { if($_SESSION['type'] == 'ADMINISTRATION'){ header('Location:../Mis/Webpage/Employee/home.php'); }else if($_SESSION['type'] == 'EMPLOYEE'){ header('Location:../Mis/Webpage/Admin/home.php'); } } else{ header('Location:Webpage/index.php'); } ?> this is my loginform <?php include '../../Mis/connect.php'; include '../../Mis/core.php'; if(isset($_POST['eusername']) && isset($_POST['epassword'])){ if(!empty($_POST['eusername']) && !empty($_POST['epassword'])){ $user = mysql_real_escape_string($_POST['eusername']); $pass = mysql_real_escape_string(md5($_POST['epassword'])); $query = "SELECT * FROM tbl_account WHERE LogUsername='".$user."' AND LogPassword = '".$pass."' AND type = 'EMPLOYEE'"; if($query_run = mysql_query($query)){ $query_num_rows = mysql_num_rows($query_run); if($query_num_rows == 0){ echo "<script>alert('Incorrect Pass or User')</script>"; }else{ $user_id = mysql_result($query_run, 0, 'LogUsername'); $_SESSION['user_id']=$user_id; $_SESSION['type'] = "EMPLOYEE"; echo "<script>alert('Employee Login')</script>"; header('Location: ../../Mis/index.php'); } }else{ echo "<script>alert('Connecting Failed')</script>"; } }else{ echo "<script>alert('Sorry, You must supply Username/Password...')</script>"; } } if(isset($_POST['username']) && isset($_POST['password'])){ if(!empty($_POST['username']) && !empty($_POST['password'])){ $user = mysql_real_escape_string($_POST['username']); $pass = mysql_real_escape_string(md5($_POST['password'])); $query = "SELECT * FROM tbl_account WHERE LogUsername='".$user."' AND LogPassword = '".$pass."' AND type = 'ADMINISTRATION'"; if($query_run = mysql_query($query)){ $query_num_rows = mysql_num_rows($query_run); if($query_num_rows == 0){ echo "<script>alert('Incorrect Pass or User')</script>"; }else{ $user_id = mysql_result($query_run, 0, 'LogUsername'); $_SESSION['user_id']=$user_id; $_SESSION['type'] = "ADMINISTRATION"; echo "<script>alert('Admin Login')</script>"; header('Location: ../../Mis/index.php'); } }else{ echo "<script>alert('Connecting Failed')</script>"; } }else{ echo "<script>alert('Sorry, You must supply Username/Password...')</script>"; } } ?> <div id="employee"> <form action="<?php echo $current_file; ?>" method="POST"> Employee ID: <input type="text" name="eusername"> </br> Password: <input type="password" name="epassword"> <input type="submit" id="employeesubmit" value="Log in"> </form> </div> <div id="admin"> <form action="<?php echo $current_file; ?>" method="POST"> Admin ID: <input type="text" name="username"> </br> Password: <input type="password" name="password"> <input type="submit" id="adminsubmit" value="Log in"> </form> </div> This is my core.php <?php ob_start(); session_start(); $current_file = $_SERVER['SCRIPT_NAME']; function loggedin() { if (isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) { return true; } else { return false;; } } function adminloggedin() { if (isset($_SESSION['user_id'])&&!empty($_SESSION['user_id'])) { return true; } else { return false;; } } ?>
  25. Hi I'm looking for some help. I am looking to query a mysql database and get distinct elements from a particular column and have the result set populate a dropdown box. After that I am looking for the ability of a user to click on one of those drop down options and from that it will produce all rows in the table that have that element in it. I'm new to php but the site I am developing is using PHP. First thing I need to know is that if this is even possible to do and if so would anyone have any tutorials that would guide me? thanks!
×
×
  • 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.