ignace
Moderators-
Posts
6,457 -
Joined
-
Last visited
-
Days Won
26
Everything posted by ignace
-
Commenting out "artistname"=>"The Smiths" would have sufficed.
-
Did you setup Layout to work with MVC?
-
$this->isTesting; $this->isTesting(); Are two different things at a memory-level. You only fool yourself using an approach like this use getIsTesting(), setIsTesting() instead.
-
Place the check higher and make sure there is an exit(0) or die(0) statement after the header('Location: ..') function.
-
1) What do I save the code you have supplies as? The data is saved to excel.csv in the same directory as the .php file executes. 2) In the excel.csv within the code should this be the excel spreadsheet with all my URL's Where do your URL's come from? A spreadsheet or a database, array, ..? 3) Do I open a new excel workbook and open the code file that I have saved as you have suggested and it will work? Run the .php file and then find the excel.csv, double-click it to open it in Excel.
-
escape(): make that mysql_real_escape_string() query(): make that mysql_query() row_count(): make that mysql_num_rows($result) build_url(): make that index.php?' . http_build_url(array_merge($_GET, array('p' => ..))
-
Did you define all missing functions? Or replaced them with the appropriate ones and do these return the expected data?
-
Need help writing PHP script for a school project!
ignace replied to canadian_angel's topic in PHP Coding Help
I'm sure you do You appreciate us exactly 20 points. -
http://code.google.com/p/o3d/ -- does this seem capable enough to you?
-
If you have Excel installed on your system, it will auto-recognize the file when you browse to it and you will be able to double-click it to open it in Excel.
-
Implementing an ACL is not that hard. Your database tables would something like: users (user_id, user_name, user_password, user_role_id) roles (role_id, role_name) resources (resource_id, resource_name) roles_resources (role_id, resource_id, permission, rule) The roles table will hold super_admin et cetera. The roles_resources table will hold the permissions (add, modify, delete) and the rule (allow, deny) for that role on a certain resource. For convenience we assume that for every undefined permission we deny that permission for a certain role. This comes with one problem though. When someone does not log-in to your website they do not get any permissions applied which means that they will be denied to access the website. To solve this you would create a Guest account in the users table for which the credentials are known in your application (or if you store your configuration in your database then add a guest_user_name and guest_user_password fields). So every time a user visits your website, you log them in to the Guest account and apply the permissions applied to this account (mostly allow rules for the view permission on the resource pages). A few example inserts to give you an idea: INSERT INTO roles (role_id, role_name) VALUES (1, 'guest'), (2, 'member'), (3, 'normal_admin'), (4, 'super_admin'); INSERT INTO resources (resource_id, resource_name) VALUES (1, 'Pages'), (2, 'Login'); INSERT INTO roles_resources (1, 1, 'view', 'allow'), (1, 2, 'view', 'allow'), (1, 3, 'add', 'allow'), (1, 3, 'edit', 'allow'), (1, 4, 'add', 'allow'), (1, 4, 'edit', 'allow'), (1, 4, 'delete', 'allow');
-
Chances are services like Hotmail and Yahoo don't even use a traditional DBMS like MySQL and instead use something like NoSQL, like GMail which uses BigTable
-
Thats %3D, you need to use urldecode
-
libxml_use_internal_errors(true); $doc = new DomDocument(); if ($doc->loadHtmlFile('..url..')) { $xpath = new DomXPath($doc); foreach ($xpath->query('//span[@id="contentcenter_specs_externalnav_noflip_3"]') as $node) { echo $node->nodeValue, "<br>\n"; } }
-
If you have it installed, it will auto-recognize the .csv extension and display an Excel icon on the file. Double-click to open it.
-
Why not use Daniel0's solution?
-
$query = trim($_GET['q']); $query = preg_replace('#[^A-Za-z0-9 ]#', '', $query); if (3 < strlen($query)) {//words with less then 3 characters are considered invalid $query = escape($query); $query = 'SELECT thearticle, REF FROM cmsarticles' . " WHERE thearticle = '$query' OR thearticle LIKE '%$query%'" . ' ORDER BY id'; $result = query($query); if (0 < ($row_count = row_count())) { $page = ctype_digit($_GET['p']) ? intval($_GET['p']) : 1; $items_per_page = 20; $number_of_pages = floor($row_count / $items_per_page); $offset = ($page - 1) * $items_per_page; for ($number = 1, $index = $offset; $index < $row_count && $index < $offset + $items_per_page; ++$number, ++$index) { $thearticle = mysql_result($result, $index, 'thearticle'); $ref = mysql_result($result, $index, 'REF'); echo "$number. <a href=\"$ref\">$thearticle</a><br>\n"; } mysql_free_result($result); echo ((1 < $page) ? '<a href="'.build_url(array('p'=>$page-1)).'">< previous</a>' : '<strong>< previous</strong>'), ' ', (($page < $number_of_pages) ? '<a href="'.build_url(array('p'=>$page+1)).'">next ></a>' : '<strong>next ></strong>'); } } A fun exercise
-
Excel can read from a CSV source $file = fopen('excel.csv', 'w'); fputcsv($file, array('Title', 'URL')); $urls = array();//fill this with your URL's $doc = new DomDocument(); libxml_use_internal_errors(true); foreach ($urls as $url) { if ($doc->loadHtmlFile($url)) { $xpath = new DomXPath($doc); $title = $xpath->query('//title')->items(0)->nodeValue; fputcsv($file, array($title, $url)); } } fclose($file);
-
Need help writing PHP script for a school project!
ignace replied to canadian_angel's topic in PHP Coding Help
for ($investment = 10000, $return = 1.15, $years = 1, $goal = 1000000; $investment <= $goal; $investment *= $return, ++$years) { echo 'Investment: ', $investment, ' Return: ', ($investment * $return), ' Year: ', $years, "<br>\n"; } -
Seriously, this is a MESS. You can't be blamed for not being able to solve this problem, but using a tab-key or keeping your code clean isn't really that hard.
-
I have been following this thread for a while now, really no-one noticed that $host, $user, and $pass are not defined in his function? -- nevermind.
-
Bad idea, just assume I crafted the URL: index.php?page=../your/secret/config
-
You hate it, we hate it, we solved it: Introducing Zen Coding From your description of what you want to achieve I assume it would take between 30-50 hours at a minimum rate of $30 per hour would make for between $900-$1500 (however quite possibly I am too optimistic about the possible working hours)
-
<select name="box1" id="box1" class="textboxstyle" size="1" style="background-color: #FFF" onchange="this.style.backgroundColor = this.options[this.selectedIndex].value"> <option value="-" selected="selected">Please select</option> <option value="#00FF00" style="background-color: #00FF00"> </option> <option value="#FFFF00" style="background-color: #FFFF00"> </option> <option value="#FF0000" style="background-color: #FF0000"> </option> </select>
-
You need to remove the absolute positioning, make it relative (position: relative;) and float: right;