PHP - Moved: You Guys Are Awesome!
This topic has been moved to PHPFreaks.com Questions, Comments, & Suggestions.
http://www.phpfreaks.com/forums/index.php?topic=351181.0 Similar TutorialsThis topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=322691.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317497.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=328252.0 As a freelancer working alone, I've got to wear all the hats, doing all the front end and back end design and development. So perhaps I'm never really specializing in any one thing, and I tend to miss some good stuff, like MySQL GROUP BY. Doing counts of things using GROUP BY is very handy. I saw somebody doing that in a thread, and adapted it to two things that I was working on in the last week. Sweet!
What other fun MySQL stuff am I missing out on?
Hi there. I am working on a PHP web form and trying to implement search functionality. It is called Search-as-you-Type. For example, when we do a search in facebook, we get all the pictures and names of the people. in a drop-down like style. I believe this is implemented using some AJAX. Please see the screenshot I've attached. Could any one please share the code or give me some advice on how I can accomplish this. Thank you! All comments and feedbacks are always welcomed finder.com.au is making waves in the comparison space, and we are expanding our Design & Technology team massively this year. We are looking for several full-stack Senior PHP Developers who will be responsible for building a wide variety of web-based applications (using PHP and MySQL) in addition to maintaining existing PHP code, optimizing website and database performance and developing custom PHP solutions. This is a great opportunity for web people at heart to join a growing team delivering awesome products that get used by hundreds of thousands of users. As a developer at finder.com.au you will have the freedom, autonomy, and responsiblity to improve the code, tools, and architecture without having to cut through red tape.
Why finder.com.au?
We've just been named one of the top service companies in the Asia Pacific for 2014, taking silver in the Stevie Awards for Australian Service Company of the year.
We’ve also been dubbed one of Anthill’s 50 coolest companies in Australia for 2013 thanks to our amazing team, wonderful users and cool company culture. As a development team, we move quickly, releasing code several times per day. You need to be willing to move fast, rely on automation, make decisions on less than perfect information, trust your teammates, and constantly strive to improve.
A new Head of Design and Technology, with experience at two of local startup scene’s biggest success stories, recently joined us to lead the team on a mission to speed up the entire company to become the Australian brand for comparison. The team runs hackdays every other month that give all developers free time to show off their creativity and innovation. You will have choice of OS, laptop or desktop, IDE and toolset, and up to 3 monitors. What’s more, you will experience an ultra modern office located in the heart of the Sydney CBD, catered lunches and breakfast supplied every day and all the snacks and drinks you want!
Who are you?
You live and breathe development and your code has soul. You are a great PHP coder that wants to join a team where you can flex your skills and grow further. You are an expert who understands complex problems and enjoys deploying solutions to business problems. You are keen to get your projects live and solve business problems and improve the development environment and tooling. You also have experience in getting code live multiple times per day.
You may be applying from overseas – We are happy to provide support with sponsored relocation services. We already have a number of people on our team from overseas so you will be joining a community.
Must have experience:
4+ years of PHP development experience for Senior Roles
Experience with phpunit
Knowledge of CI tools (Bamboo, Travis, CircleCI)
Knowledge of CD tools (Beanstalk, Capistrano)
Knowledge of Git
Ability and desire to use and extend Git tools (GitHub, Bitbucket) to enhance workflow
Ability to mentor junior developers
Experience with Wordpress beneficial
Knowledge of Front End technologies beneficial
Knowledge of monitoring tools beneficial
Please send us a resume to iwantin@finder.com.au and optionally provide us with a link to your GitHub or Bitbucket profile and a personal note as to why you would want to work with us at finder.com.au.
Hello to all... Can someone help me on this one? I have a hard time on modifying this code. This code was given to me as the reply on my old post.. However i put the wrong string on that post.. Now my problem is how to parse again this string Quote #1# "3032117","+639217195804","+447537404702","test","2012-01-13","03:26:15","test another sample sms. this is a sample sms","" "3032118","+639105701066","+447537404702","test","2012-01-14","03:27:12","test sms sample 2. test only.","" I need to drop the #1#, and split the string into an array on +447537404702..Please refer on the code below Code: [Select] function parse_csv($line,$delimiter=',',$quote = '"',$newline="\n") { $line = str_replace("\r\n",$newline,$line); //change extended newlines. $line = str_replace("\n",$newline,$line); //this is here in case you pass a different newline to the function. $line = str_replace('"",""','',$line); //remove double quoted commas. $line = str_replace($quote,'',$line); //remove quotes. $line = preg_replace('~,{2,}~',',',$line); //remove double commas. if(strstr($line,$newline)) { $parts = explode($newline,$line); //all new lines should be an array. } if(isset($parts) && is_array($parts)) { //if a newline exists foreach($parts as $value) { //rerun the function on each line. $result = parse_csv($value,$delimiter,$quote,$newline); //only include the results, if there is more than 1 line; if(isset($result[1])) { $arr[] = $result; } } } else { $arr = explode($delimiter,$line); //make an array based on the delimiter. //cleanup = delete lines that has no values. foreach($arr as $k => $v) { if(empty($v)) { unset($arr[$k]); } } } return $arr; } $file ='#1# "3032117","+639217195804","+447537404702","test","2012-01-13","03:26:15","test another sample sms. this is a sample sms","" "3032118","+639105701066","+447537404702","test","2012-01-14","03:27:12","test sms sample 2. test only.",""'; $array = parse_csv($file,',','"',"+447980123456"); echo '<pre>' . print_r($array,true) . '</pre>'; //show the array construct. //echoing the values out. foreach($array as $key => $value) { echo '<h4>' . $key . '</h4>'; foreach($value as $v2) { echo $v2 . '<br />'; } echo '<hr />'; } This is the wrong string Quote #1# "4","+447980123456","+447781484145","","2009-06-08","10:38:15","hello "","" world","Orange" "5","+447980123456","+447781484146","","2009-07-08","10:38:55","hello world","Orange" Can someone help me on this one? any help will be appreciated... Thanks in advance! This is the link on my old post http://www.phpfreaks.com/forums/index.php?topic=351398.new;topicseen#new I'm Jay, new to PHP hoping to start up and get some things done by handling some actual problems for a change.. So hey! Thanks.
I'm trying to $_GET a value and then input it into my database but this obviously doesn't work, I have no idea why. As soon as I run a "if (isset($_POST['submit']" action the value of the $_GET dissapears completly, I have no idea why, I've tried both XAMPP and WAMP with Apache and MySQL but it doesn't seem to work. Is this simply just not possible or am I doing something wrong...Help me!!! I have a simple question how would I do this? If a row in mysql i have "type" is set to "yes" do that stuff or if it's not do some other stuff Hey everyone A little advice would be great. okay... I have a system that registers users and then allows them to take part in a quiz, which uses sessions and a database however what the problem is, is that i would like the user to be able to see the results of there quiz rather than destroying a session on logout.php for example when they login, they will click member area for example and this will display info about the quiz they completed.... i.e. Scores How would i do keep this info so its not lost on logging out?? Thanks in advance guys Lance Hi, I have a lot while loops, for loops and PHP hard coded with HTML. The HTML now has become super hard to read sometimes I get confused where I am lol. My question is it better to make few other PHP files, with the loops and just call them with Include or Request or could you just tell me how you guys work around this? Hello world,
Im a development fan,but not a coder.
Im planning to hire a developer for a project but i want some advice from experts first.
My project is a market place where sellers and stores could place their ads, I want it very very custom,so here are the questions.
1. Do i use php from scratch or maybe a CMS?
2.Is there a possibly to develop a custom cms to admin this project if it has been developed on php or i have to learn to code by the way?
3.how i can detail exactly what i want to the coder,is there a glossary or something like that for the modules?
this is the question that came up now,but fell free of give me all advice you think i might know.
Thanks.
I have a script on my website, freestudentcloud.com. But i want: 1) that new users must activate there account. 2)If the user lose his pass that he can Change/renew his password. I hope someone can help me with my problems. I have no knowledge of php, but i have tried many thinks. like http://www.learnphponline.com/scripts/email-activation-for-php-forms This is the users.php Code: [Select] <?php if( ! defined( '_AppPath' ) ) { exit( 'Direct access to this script is not permitted' ); } class Users { var $app; function __construct( $app ) { $this->app = $app; } //****************************** // Insert new user //****************************** function create($return = false) { //Data validation $error; if(empty($_POST['password'])) $error = 'Please enter a password'; if(!empty($_POST['maxupload']) && !ctype_digit($_POST['maxupload'])) $error = 'Please enter numeric values only for max. upload limit'; if(empty($_POST['name'])) $error = 'Please enter a username'; //Check for errors if($error) { return array("error" => $error); } $user = array(); $user['name'] = $this->app->db->real_escape_string($_POST['name']); $user['password'] = md5('_password_'.$_POST['password']); $user['maxupload'] = $_POST['maxupload'] ? $_POST['maxupload'] : ''; $user['admin'] = $_POST['admin']; //remove white space from username $user['name'] = str_replace(" ","",$user['name']); //Check for illegal characters $valid = array('-', '_'); if(!ctype_alnum(str_replace($valid,'',$user['name']))) return array("error" => 'Only alphanumeric characters and "-" or "_" are allowed'); if(strlen($user['name']) > 30) return array("error" => 'Username is too big (30 characters allowed)'); //Insert user into database $query = "INSERT INTO users VALUES (NULL, '".$user['name']."', '".$user['password']."', '".$user['admin']."', '0', '".($user['maxupload']*1000)."')"; if(!$user['maxupload']) $query = "INSERT INTO users VALUES (NULL, '".$user['name']."', '".$user['password']."', '".$user['admin']."', '0', NULL)"; //Save user record in database $result = $this->app->db->query($query); if(!$result) return array("error" => "The username you chose is taken already"); //Set user id $user['id'] = sprintf("%011d", $this->app->db->insert_id); //Create meta entries for new user $this->app->meta->create("downloads_".$user['id'],0,$user['id']); //downloads entry $this->app->meta->create("uploads_".$user['id'],0,$user['id']); //uplodads entry $user['password'] = ''; //If is ajax call return upload data if($return == true) { return $user; } } //****************************** // Get users //****************************** function get() { $user = $this->app->session->get_var( 'id' ); $query = "SELECT id,name, admin, space, maxspace FROM users WHERE id != '$user'"; $response = $this->app->db->query($query); //Check if database has records if ($response->num_rows > 0) { //Records were found $users = array(); while($row = $response->fetch_array()) { //Change bytes to kylobytes if maxspace is set if($row['maxspace']) $row['maxspace'] = $row['maxspace'] / 1000; $users[] = $row; } return $users; } else return false; } function getinfo($user) { $query = "SELECT id,name, admin, space, maxspace FROM users WHERE name = '$user' LIMIT 1"; $response = $this->app->db->query($query); if ($response && $row = $response->fetch_assoc()) { return $row; } } //****************************** // Delete user //****************************** function delete($user) { $query = "DELETE FROM users WHERE id = '$user'"; $this->app->db->query($query); //Remove user meta entries $this->app->meta->delete("uploads_".$user); //uplodads entry $this->app->meta->delete("downloads_".$user); //uplodads entry } //****************************** // Change user password //****************************** function updatepassword() { //Data validation $error; if(empty($_POST['password'])) $error = 'Please enter a password'; //Check for errors if($error) { return array("error" => $error); } $password = md5('_password_'.$_POST['password']); $user = $this->app->session->get_var( 'id' ); $query = "UPDATE users SET password = '$password' WHERE id = '$user'"; $response = $this->app->db->query($query); return $response; } //****************************** // Update user info //****************************** function update($return = false) { //Data validation $error; if(!empty($_POST['maxupload']) && !ctype_digit($_POST['maxupload'])) $error = 'Please enter numeric values only for max. upload limit'; //Check for errors if($error) { return array("error" => $error); } $user = array(); $user['id'] = $_POST['value']; $user['maxupload'] = $_POST['maxupload'] ? $_POST['maxupload'] : NULL; $user['admin'] = $_POST['admin']; //Update user in database $query = "UPDATE users SET maxspace = '".($user['maxupload']*1000)."', admin = '".$user['admin']."' WHERE id = '".$user['id']."'"; if(is_null($user['maxupload'])) $query = "UPDATE users SET maxspace = NULL, admin = '".$user['admin']."' WHERE id = '".$user['id']."'"; $response = $this->app->db->query($query); //If is ajax call return upload data if($return == true) return $user; } //****************************** // Update user used space //****************************** function updatespace($space) { $user = $this->app->session->get_var( 'username' ); $query = "UPDATE users SET space = '$space' WHERE name = '$user' LIMIT 1"; $response = $this->app->db->query($query); if($response) return $response; } //****************************** // Login user //****************************** function login($user,$password) { $user = $this->app->db->real_escape_string($user); $password = md5('_password_'.$password); $query = "SELECT * FROM users WHERE name = '$user' AND password = '$password'"; $response = $this->app->db->query($query); if ($response && $row = $response->fetch_assoc()) { // Credentials matched $this->app->session->add_var( array( 'username' => $row['name'],'id' => $row['id'] )); if( $_SESSION ) { session_regenerate_id( true ); } # Redirect to dashboard $path = $this->app->path."manage/"; header ("Location: $path"); } else { return "Incorrect"; } } //****************************** // Logout user //****************************** function logout() { $path = $this->app->path."manage/"; session_destroy(); header("Location: $path"); } } ?> Register.php Code: [Select] <?php if( ! defined( '_AppPath' ) ) { exit( 'Direct access to this script is not permitted' ); } ?> <!DOCTYPE HTML> <html> <head> <meta charset="utf-8" /> <title>Login</title> <!--STYLES--> <link rel="stylesheet" href="<?php echo $viewsdir ?>views/css/reset.css" type="text/css"> <link rel="stylesheet" href="<?php echo $viewsdir ?>views/css/styles.css" type="text/css"> <!--SRIPTS--> <script src="<?php echo $viewsdir ?>views/plugins/jquery.js" type="text/javascript"></script> <script src="<?php echo $viewsdir ?>views/plugins/jquery.form.js" type="text/javascript"></script> <script src="<?php echo $viewsdir ?>views/plugins/core.js" type="text/javascript"></script> <script> path = ''; </script> </head> <body> <div id="main" class="notice container"> <!--Wrapper--> <div id="wrapper" class="notice"> <!--Content--> <div id="content" class="padding"> <?php if($error) : ?> <div id="message" class="one message invalid clearfix" style="display: block;"> <?php echo $error ?> </div> <?php endif ?> <form id="on-login" method="post"> <!--Username--> <p class="placeholders"> <label for="user">Username</label> <input name="name" type="text" autocomplete="off" value="<?php echo $_POST['name'] ?>"> </p> <!--Password--> <p class="placeholders"> <label for="password">Password</label> <input name="password" type="password" autocomplete="off"> </p> <p> <label for="robot">Are you human ? <span class="help">- how much is 2 + 3 ?</span></label> <input type="text" name="robot" value="<?php echo $_POST['robot'] ?>"> </p> <input type="submit" class="submit" name="action" value="register"> <a class="help one" href="<?php echo $path."manage/"; ?>">Log in</a> </form> <!--End #content--> </div> <!--End #wrapper--> </div> <!--End .container--> </div> </body> </html> The database is: table: users Column: | id | name | email | password | admin | space | maxspace | What can i do? i do not ask to make the whole sript , i wanna learn, but i don't get it at all. Thank you, Tim im trying to make a salary system which would display a month salary according to login hours so i got two different tables storing data like
1. users table id, name, password, salary
2.attendance table id, user_id, Employee_Name, Remark, Login_Hours, Date
so what im looking to do is fetch all users id, name and salary from users table and then match it with attendance user_id,Employee_Name ,Login_Hours, table and then also count numbers of result for a particular year-month so that i could do the hourly wage calculation.
could someone help out i got no idea how to achieve it
apprieciate your help,
thanks
i tried something like this it does output something but still dunno how to match results of both tables and get result
$date = '2014-11'; $query1 = "SELECT COUNT(*) as num FROM attendance WHERE Date LIKE '%".$date."%' AND Employee_Name='moses'"; $total_pages = mysql_fetch_array(mysql_query($query1)); $total_res = $total_res[num]; // total rows counting of total office days of a month $result2=mysql_query("SELECT id, user_id, Employee_Name, Remark, SUM(Login_Hours), Date FROM attendance WHERE Employee_Name='moses'"); while($row = mysql_fetch_array($result2)){ echo $sal_to_month = 9000/$total_res; //9000 is salary should be fetched from users table echo '<br/>'; echo $sal_to_month/9*$row['SUM(Login_Hours)']; } Hello everyone I am totally new in php i need some help in coding, Suppose I have 100 check boxes and one Textbox, I want to send the combined value of check box and textbox to another page. Like if i check a check box then the value of that check box and text box will be submitted to another page. Please see the attached b screenshot so you can get the idea Thanks in Advance Attached Files capture 2.jpg 38.69KB 0 downloads looking for suggestions and experiences from those of you that use a Password Manager
goodguybadguy.net they can tell when you enter an email address that hasnt been registered yet. how the hell are they doing this? does gmail or yahoo have some sort of database they allow access to for this? Fatal error: Can't use function return value in write context on line 21
Hello, I am creating a login_parse php file that will facilitate user authentication on a website. I have received the above error with the code below.
The line that yields the error is $_SESSION('uid') = $row['id'];
As always, I am grateful for the assistance.
<?php session_start(); include_once("connect.php"); if (!isset($_POST['username'])) { $username = $_POST['username']; $password = $_POST['password']; $sql = "SELECT * FROM users WHERE username='".$username."' AND password ='".$password."' LIMIT 1"; $res = mysql_query($sql) or die(mysql_error()); $ifstmt = mysql_num_rows(mysql_query($res)); if($ifstmt == 1) { $row = mysql_fetch_assoc($res); $_SESSION('uid') = $row['id']; $_SESSION('username') = $row['username']; header("Location: demo.php"); exit(); } else { echo "Invalid login information. Please return to the previous page"; exit(); } } ?> |