PHP - Moved: Anyone Have Any Ideas For Short Projects/assignments?
This topic has been moved to Miscellaneous.
http://www.phpfreaks.com/forums/index.php?topic=359016.0 Similar TutorialsSo this is a bit of a puzzler for me? I have a code that takes a form submit and chucks it to a DB that all works fine but the second part is it also takes the submit and sends it to a email. now this is the crazy part it works fine 80% of the time but some times it sends back a blank email or one that is only hafe there, but still all shows fine in the DB and I have been trying to work this out for 5 days now and ..... nothing worked and I am lost for any ideas on what it could be This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=343169.0 This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=332844.0 This topic has been moved to Application Design. http://www.phpfreaks.com/forums/index.php?topic=353714.0 Is it okay to post projects for hire in here? I have about a dozen small tasks I need done. Jared Hi
so i've been learning php for 3 mouth now by reading php 6 Bible and watching lynda and so on...
i was looking for a job in few past weeks and i found out i don't have that kind of self confidence to go for it ! you know when they say : PHP Project Manager , it scar's me...
the thing is , i know all about basic to medium php , array...MySQL....all those essentials but i don't know what do they want from a php web developer .
so i began to search for intern job somewhere and i told myself i should bust my ass 24/7 for few mouth and after that i ll be real php guy and it seems like there is no place to reach not php but almost all programming languages
a year ago i was searching for the same thing but in networking section and there was 100's of intern ship jobs but in programming there is none !
so i want some one to give me (us) simple to pro real life projects .
what do they want php junior or senior developer's for ? what do they do?
what is the most common needs ?
what is the most essential things to know?
what is a hired php developer should do in the office?
some people doesn't need you in the office and want you to work from home , they give you project's , what's that?
is there any source in the web to offer what is need ?
i know its too much , but this was my last option , so if anyone can help i would practically owe him/her my whole future salaries...
My website is http://www.infotechnologist.biz.
We handle Web Site Development, web app development, and mobile development. No project is too big, or too small.
Contact me today with details.
My number is 4049390637.
Hey folks,
I'm looking for an open-source php project to contribute to. I'm not looking for a really well-known project (ex: Wordpress, Zencart)
Something small would be greatly appreciated!
Hi, everyone.
I'm having some trouble finding tutorial projects for PHP Functions. Can anyone point me in the right direction if you know of any? I apologize if this is the wrong category to post in for my particular question.
Hello all. I'm looking to build a website in php that will be large in scope and I'm looking for some direction as to how to go about coding it. What I'm referring to exactly is the programming model. I'm new to the language, but not to programming, and I've read up on it and familiarized myself with the syntax over the past few days. Normally when I go about building a project I like to plan ahead how I'm going to build It so I don't run into tedious issues later on and this is what I need help with.
My concerns:
I am looking to use the alternative syntax for control structures as to make the php code inside my html readable and easier to manage but in terms of OOP when is it best for me to use classes vs functions?
I am leaning towards using both classes and functions. Classes to handle polling data, sanitizing it and storing it while the functions will be used , with the alternative syntax, to display the data.
How should I go about properly setting my project assuming I will have many concurrent users using the website at once?
Is using xml / INI files as a directory to look up information a good practice? Is it better to declare constant variables instead?
When working with multiple includes is there an easier way to include a file than having to explicity write "dirname( dirname(__FILE__) )" everytime?
I'm essentially looking for guidance / tips as to good programming practices with this language Advanced practices are welcomed as well.
Development Tools:
XAMPP ( Windows 7 Pro )
PHPStorm
Current directory structure plan:
Here is what I currently have:
The API class is a collection of functions that returns an object to be used at a later data.
<?php /* * Development API Key * @since 1.0 * * Rate Limit(s): * 10 request(s) every 10 second(s) * 500 request(s) every 10 minute(s) */ define( "__API_KEY__" , "---------------------------------" ); require_once dirname( dirname(__FILE__) ) . "\\settings.php"; class API { // If successfull it returns an object from the url that's passed to this function. private function api_call($url) { $result = null; // end result // Create a new curl handle. $ch = curl_init(); curl_setopt($ch , CURLOPT_URL, "https://" . $url . "?api_key=" . __RIOT_API_KEY__); // set the URL curl_setopt($ch , CURLOPT_RETURNTRANSFER , true ); // return the transfer as a string of the return value curl_setopt($ch , CURLOPT_SSL_VERIFYPEER , false ); // turn off ssl certificate verification // Execute the api call $response = curl_exec($ch); // Get info to analyze the result $ci = curl_getinfo($ch); $httpcode = $ci["http_code"]; // If a curl error occured if(curl_errno($ch) || ($httpcode != "200")) { $die = "Curl Error Code: " . $httpcode . "<br/>"; $die .= "Curl Error Message: " . curl_errno($ch) . "<br/>"; $die .= "Curl URL: " . $ci["url"] . "<br/>"; die($die); } else { // Check if the api call we made was valid $response = json_decode($response, true); // If our response is an array check if it's an error response if(is_array($response)) { $error_key = "status"; if(array_key_exists($error_key, $response)) { $er = $response[$error_key]; $die = "API Error Message: " . $er["message"] . "<br/>"; $die .= "API Error Code: " . $er["status_code"] . "<br/>"; die($die); } } // Our response is a valid object $result = $response; } private function sanitize_url($url) { // removes all whitespaces return trim(preg_replace( '/\s+/','',$url)); } private function regional_endpoints() { static $regionini; if(is_null($regionini)) $regionini = parse_ini_file(INI_REGIONAL_ENDPOINTS, true); return $regionini; } private function region_host($shortcode) { /* * regionalendpoints.ini * @since 1.0 * * [SHORTCODE] * Description=<region_description> * Host=<host_url> */ return $this->regional_endpoints()[strtoupper($shortcode)]["Host"]; } public function region_description($shortcode) { /* * regionalendpoints.ini * @since 1.0 * * [SHORTCODE] * Description=<region_description> * Host=<host_url> */ return $this->regional_endpoints()[strtoupper($shortcode)]["Description"]; } public function api_object_by_name($name, $region) { /* * @Description: Get summoner objects mapped by standardized summoner name for a given list of summoner names. * * * @Returns: Map[string, SummonerDto] * * Object * ------------------------------------------------------------------------------------------------------ * Name Data Type Description * ------------------------------------------------------------------------------------------------------ * id long ID. * name string Name. * profileIconId int ID of the summoner icon associated with the summoner. * revisionDate long Date summoner was last modified specified as epoch milliseconds. * Level long Level associated with the summoner. */ $api_url = "%s/api/col/%s/v1.4/obj/by-name/%s"; return $this->api_call(sprintf($api_url, $this->region_host($region), strtolower($region), $this->sanitize_url($name))); } }Class that acts as the middle man between the api and the front end. Currently how it is set up it handles an internal queue. <?php include dirname(__FILE__) . "\\class-riotapi.php"; define( "SUMMONER_NAME" , 0 ); define( "SUMMONER_ID" , 1 ); class Summoner { private $riotapi = null; private $summoner = null; private $arr_summoners = null; private $region = null; public function __construct() { // Create our riot api object $this->riotapi = new RiotAPI(); } public function summoner_exists($summoners, $region, $type = SUMMONER_NAME) { static $eoa; // end of array // If our array of summoners is empty or we have reached the end of the array. if( empty($this->arr_summoners) || $eoa ) { // Get an array of summoner information from the riot api based on the type of information // supplied. switch($type) { case SUMMONER_NAME : $this->arr_summoners = $this->riotapi->api_summoner_by_name($summoners, $this->region = $region); break; case SUMMONER_ID : $this->arr_summoners = $this->riotapi->api_summoner_by_id($summoners, $this->region = $region); break; } // If our array of summoners isn't empty. if( !empty($this->arr_summoners) ) { // Set our current summoner the first element in the array. $this->summoner = reset($this->arr_summoners); } else { // We failed to acquire any summoner information so return false. return false; } $eoa = false; } else { // If we have not reached the end of the summoners array set our current // summoner to the next element. $next = next($this->arr_summoners); // Have we reached the end of the array? if( $next ) { // No. Set our current summoner to the next element. $this->summoner = $next; } else { // Yes. Set our end of array variable to true. $eoa = true; // End the loop return false; } } return true; } public function summoner_id() { return $this->summoner["id"]; } public function summoner_name() { return $this->summoner["name"]; } public function summoner_profile_icon_id() { return $this->summoner["profileIconId"]; } public function summoner_last_updated() { return $this->summoner["revisionDate"]; } public function summoner_level() { return $this->summoner["summonerLevel"]; } public function summoner_mastery_pages() { return $this->riotapi->api_summoner_masteries($this->summoner_id(), $this->region)[$this->summoner_id()]["pages"]; } }Functions.php file that is a collection of functions that echo out information. <?php require_once "settings.php"; include DIR_INCLUDE . "class-summoner.php"; function summoner_exists($summoners, $region = "NA", $type = SUMMONER_NAME) { global $cs; if(!isset($cs)){ $cs = new Summoner(); } return $cs->summoner_exists($summoners, $region, $type); } function summoner_name() { global $cs; if(isset($cs)){ echo $cs->summoner_name(); } } ?>index.php - Example of how I'm currently using the functions.php file. <?php include "functions.php"; ?> <html xmlns="http://www.w3.org/1999/xhtml"> <body> <?php while(summoner_exists("cyllo")) : ?> <div>Summoner Name: <?php summoner_name(); ?></div> <div>Summoner ID: <?php summoner_id(); ?></div> <div>Summoner Profile icon ID: <?php summoner_profile_icon_id(); ?></div> <div>Last Updated: <?php summoner_last_updated(); ?></div> <div>Summoner Level: <?php summoner_level(); ?></div> <div> <?php mastery_pages(); ?> </div> <?php endwhile; ?> </body> </html> Hello,
Can you guys point me to something where I can follow some tutorial or something and learning CI?
I've already made tons of 'Cars' models... 'Dogs' .. 'Cats'.. etc but I really need some project where I can follow steps to creat and learn while I create.
p.s. I think I post this thread in right place but please correct me if is wrong.
Thank's!
I must confess, I've not really done much unit testing at all in the last 3 years. Can anyone give me an idea of what they would test and why that would be faster or more efficient than running the code as a user? One area I can see it having huge benefits is when I'm testing methods which interact with a database, like user registration, which I would probably test by registering several times - fixing any bugs, making amendments and repeating. Ok, so I kinda sold the idea to myself there But, what about for small applications? I've seen people testing whether a variable is countable...why would I not just check the output immediately? Appreciate any advice. 'm trying to set up short urls on my page and what I need to do is insert a url from a parent frame page into an input. So on the child iframe I'm using this to pull the referers url Code: [Select] <?php $url="".$_SERVER['HTTP_REFERER']; echo $url; ?> which works great Then I want to insert it in an input on the same page Code: [Select] $site = my_SITE; echo <<<HTML <form method="post" action=""> <input type="text" name="url" value="Insert Here" size="30" /> <input type="submit" value="submit" /> </form> HTML; Any Help? How do I re write my code so it's
$itemAnnual0 = $values[0] * $periods[0]; $itemAnnual1 = $values[1] * $periods[1]; $itemAnnual2 = $values[2] * $periods[2]; ... $itemAnnual79 = $values[79] * $periods[79];
And for my previous post, I solved it. HI,
I'm using;
https://github.com/o.../PHP-Pagination
It works on my local test server, but on EC2, short tags are apparently not enabled by default.
The pagination is printing php:
<div class="pagination"><ul class="<?php= implode(' ', $classes) ?>"> <li class="<?php= implode(' ', $classes) ?>"><a href="<?php= ($href) ?>"><?php= ($previous) ?></a></li> <li class="number active"><a data-pagenumber="<?php= ($current) ?>" href="#"><?php= ($current) ?></a></li> <li class="number"><a data-pagenumber="<?php= ($current + $x + 1) ?>" href="<?php= ($href) ?>"><?php= ($current + $x + 1) ?></a></li> <li class="number"><a data-pagenumber="<?php= ($current + $x + 1) ?>" href="<?php= ($href) ?>"><?php= ($current + $x + 1) ?></a></li> <li class="<?php= implode(' ', $classes) ?>"><a href="<?php= ($href) ?>"><?php= ($next) ?></a></li>I tried replacing <? with <?php to no avail. Not sure if the fact that one dependency is named "render.inc.php" instead of just ".php" which is causing the issue. Any ideas why apache is doing this? I'd rather not edit the .ini. Thanks.. Edited by arbitrageur, 03 November 2014 - 01:00 AM. What is the best way to handle an auto database check? could php do this without the help of JQUERY or JAVASCRIPT? Hey eveyone, I have this great idea I would love to do but I have some questions and whenever I have questions I come here and they always get answered :-) Anyway what do you guys know about SMS short codes (you know those commercials on TV that are like text ringtone1 to 555)? I did some quick reading and it seems they are super expensive?!? Is there anyway to get them free or cheaper if you can write your own code? Has anyone had any experience with sms short codes? Also is there anyway for a site to receive a SMS and then charge that persons service provider with php? Thanks I am re-using a simple script that works good to get random files from a folder to get embed codes into a jquery slider(to embed videos)to create a video slider/gallery( http://www.awkward.se/demo/showcase/).The reason for the embed is there will be 50 and more videos in gallery and that's bad for page weight/page load. I have taken out the random element for this code because i just want videos to get embeded when icons are clicked(the onclick is already set up with the jquery script-->no worry about that). I have change a few things (in red) and i thought i would work, but i am really not sure how to make it work at this point??? I get this error message: Quote Fatal error: Cannot use object of type DirectoryIterator as array The original random code to get files which works perfect: Quote <?php function getRandomFile($path) { $files = array(); foreach( new DirectoryIterator($path) as $file ) { if($file->isFile()) { $files[] = $path . $file->getFilename(); } } $i = array_rand($files); return $files[$i]; } $path = "vids"; $file = getRandomFile($path); $final= substr($file, 4); ?> It inserts into the html like this: Quote <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="280" height="210" id="FLVPlayer"> ... <param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_2&streamName=vids/<?php echo ($final); ?>&autoPlay=false&autoRewind=false" /> <param name="swfversion" value="8,0,0,0" /> ... I modified it like this to get files to embed in the jquery gallery(changed values in blue): Quote <?php function getEmbedFile($path) { $filesEmbed = array(); foreach( new DirectoryIterator($path) as $filesEmbed ) { if($filesEmbed->isFile()) { $filesEmbed[] = $path . $filesEmbed->getFilename(); } } $i = array_rand($filesEmbed); return $filesEmbed[$i]; } $path = "thumbEmbed"; $filesEmbed = getEmbedFile($path); ?> <div> <?php echo ($filesEmbed); ?> It inserts into the html like this: Quote <div class="showcase-thumbnail" > <img src="images/ShowcaseThumbs/video1.GIF" alt="01" width="55px" /> <div class="showcase-thumbnail-caption">Play video 1</div> To give you a better idea this a pic of the jquery slider: Long Version Associative Array:
/* associative array */ $row = mysqli_fetch_array($result, MYSQLI_ASSOC); echo $row["name"]." ".$row["author_name"]." ".$row['price'];
Short Version Associative Array:
($row = mysqli_fetch_assoc($result))
As in:
while ($row = mysqli_fetch_assoc($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />";
Q1. Correct ?
Q2. Long Version Numeric Array:
/* numeric array */ $row = mysqli_fetch_array($result, MYSQLI_NUM); echo $row[0]." ".$row[1]." ".$row[2];
Can you not do short Version like this :
($row = mysqli_fetch_num($result))
As in:
while ($row = mysqli_fetch_num($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />";
Q3. Long Version "Both":
/* associative and numeric array */ $row = mysqli_fetch_array($result, MYSQLI_BOTH); echo $row[0]." ".$row["author_name"]." ".$row[2];
Can you not do short Version like this:
($row = mysqli_fetch_both($result))
As in:
while ($row = mysqli_fetch_both($result)) { echo $row["name"]." ".$row["class"]." ".$row['roll_no']."<br />";
Edited February 3, 2019 by phpsane I haven't really messed with PHP in like 2 years. Just little fixes on old scripts every now and then. I've been kind of in an argument with myself the past couple of days while writing a script. The thing is I only have around 3 or 4 sets of information I need. Such as: Code: [Select] option1: information for option 1 option2: information for option 2 option3: information for option 3 etc.. NOW, at first I was doing this all in a text file. This information doesn't necessarily need to be private but i also don't want people to know what file needs to be edited right off the bat. I don't see any reason at all for using databases here, I'd much rather stick to files. I'm thinking it may be best to store this is strings in a seperate PHP file and include it? Then if I need to edit it, I can simply write a new file. Any suggestions? |