PHP - Moved: Hey Guys, Who Could Test My Skills ? :)
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=328252.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 PHPFreaks.com Questions, Comments, & Suggestions. http://www.phpfreaks.com/forums/index.php?topic=351181.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=343436.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=308788.0 This topic has been moved to Beta Test Your Stuff!. http://www.phpfreaks.com/forums/index.php?topic=342258.0 This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=318425.0 This topic has been moved to Microsoft SQL - MSSQL. http://www.phpfreaks.com/forums/index.php?topic=319147.0 Hello Php Freaks! I have decided to create a website and got exactly how i want it in my head, but the problem is.... i can't really program any php, so i've been reading different tutorials for every bit of those things i need for my site.... Still its very hard.... So i were wondering if anyone could give me some help? A tutorial, or help me with the errors i encounter and so on. Here is what i plan on getting: (The site will be for a guild in a game) 1. Login 2. News 3. Some sort of photo/video archieve 4. Rankings 5. Profile pages (With name, age, character name and so on). 6. Medals (Hooked up with Rankings mostly). 7. Private messages 8. Application site 9. calender And thats it, its quite alot of work... But i believe that if i read though alot of tutorials i miiight get it all done one day... But first i guess i gotta learn how to set up a site so it looks good xD!... - Seems like im a lost cause, anyways... anybody who got any kind of help ?... Would be soo appriciated. I have started learning OOP, by following a few tutorials, My problem with most tutorial is they show you how, but don't tell you the what and the why. It's all good an well seeing what to do, but if you have no idea why it's being done, you don't learn much. I started a tutorial on Udemy but am not actually gaining a lot from it. I want to alter the code so that it will do it the way I want it to. I am not wanting you to write the code for me, if you do please explain it so that I can understand the logic, preferably show me where to make changes and point me at the php tutorial that can solve my problem. I have been trying to solve this for a couple of weeks now, I tried a few things but none worked.
The full followLinks function function followLinks($url) { global $alreadyCrawled; global $crawling; $host = parse_url($url)["host"]; $parser = new DomDocumentParser($url); $linkList = $parser->getLinks(); foreach($linkList as $link) { $href = $link->getAttribute("href"); if((substr($href, 0, 3) !== "../") AND (strpos($href, $host) === false)) { continue; } else if(strpos($href, "#") !== false) { continue; } else if(substr($href, 0, 11) == "javascript:") { continue; } // I need to change this below somehow, the two arrays are identical, // What I want to do is move $href(crawled) to $alreadyCrawled and remove it from $crawling // I also want to check if the current $href (crawling) is in $alreadyCrawled and if it is skip crawling and move on to the next one. //In essence I want to prevent the crawler from crawling anything already crawled in order to speed up the crawler. $href = createLink($href, $url); if(!in_array($href, $alreadyCrawled)) { $alreadyCrawled[] = $href; $crawling[] = $href; } else { continue;} echo $href . "<br>"; } array_shift($crawling); foreach($crawling as $site) { followLinks($site); } } $startUrl = "https://imagimedia.co.za"; followLinks($startUrl); ?>
Result.
https://imagimedia.co.za/../seo/ https://imagimedia.co.za/../pages/marketing.html https://imagimedia.co.za/../pages/web-design.html http://imagimedia.co.za/ https://imagimedia.co.za/../website-cost-quote.php https://imagimedia.co.za/../blogs/history.html https://imagimedia.co.za/../blogs/payment.html https://imagimedia.co.za/../blogs/copy.html https://imagimedia.co.za/../blogs/cycle.html https://imagimedia.co.za/../blogs/information.html https://imagimedia.co.za/../blogs/privacy.html https://imagimedia.co.za/../blogs/terms.html https://imagimedia.co.za/../blogs/content-is-king.html https://imagimedia.co.za/../blogs/pretoria-north-web-design.html https://imagimedia.co.za/../blogs/annlin-web-design.html https://imagimedia.co.za/../blogs/ http://imagimedia.co.za http://imagimedia.co.za/../seo/ http://imagimedia.co.za/../pages/marketing.html http://imagimedia.co.za/../pages/web-design.html http://imagimedia.co.za/../website-cost-quote.php http://imagimedia.co.za/../blogs/history.html http://imagimedia.co.za/../blogs/payment.html http://imagimedia.co.za/../blogs/copy.html http://imagimedia.co.za/../blogs/cycle.html http://imagimedia.co.za/../blogs/information.html http://imagimedia.co.za/../blogs/privacy.html http://imagimedia.co.za/../blogs/terms.html http://imagimedia.co.za/../blogs/content-is-king.html http://imagimedia.co.za/../blogs/pretoria-north-web-design.html http://imagimedia.co.za/../blogs/annlin-web-design.html http://imagimedia.co.za/../blogs/ I know I am also going to have to exclude duplicates created by the http and https pages. But that is not my main issue. 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 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 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'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.
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 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 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.
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)']; } 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? |