|
In case it isn't obvious, This site is
rather young. I have really only started its development. Look around to see
what this site is, and is going to be, about.
|
|
|
January 2, 2008
I have neglected this page, but the "news" page has been kept a
little more up to date. I have been working on a site where I use cURL
to bring the contents of a site hosted by another company into the site
we are hosting. Our client purchased a hosted version of a classifieds
program, but they can't do the SEO like we can. I am learning a lot about
cookies, javascript, string replacements as well as php's libcurl.
Check out this curl
article for a bit of code.
December 12, 2006
Just a quick note: I about drove myself crazy trying to figure out why
the simplest change to my perl cgi script caused a "500 Internal Server
Error ". I checked and double checked that I was downloading and
uploading in ASCII, not binary. I checked my edits. Finally, I
downloaded it, renamed the orginal on the server, and uploaded it again.
I still had the error. I had had it! I started to think my FTP program
was messing up. Then I decided to check the error log as suggested by
the actual error message. (I was not very familar with how to access my
log), but found it in cpanel, the server admin offered by my host. It
was all a CHMOD error!! I found out the hard way that my file
permissions were lost in the transfer. The Perl CGI script had to be set
to 744.
I hope this helps someone.
July 1, 2006
DMAN ver
alpha0.1
I am working on a tool similar to a directory
submission manager currently offered by 123promotion.co.uk because I prefer
this type of thing be local. If 123promotion ever decides not to offer it,
I'll lose not only the ability to track my directory submissions, but also
my data. DMAN alpha0.1 will be simplified in that I will not require login
for this version. This info I am posting today is my outline. I have already
set up tables who's structure I will post later. It's almost obvious, except
some instances of boolean values, and the meaning of certain column names.
The below was a cut and paste from my personal notes,
so forgive the lack of proper caps:
|
don't worry
about directory ids that aren't yet assigned to clients in the lookup table
(status) because the first time a client accesses a directory, it will be placed in
the lookup table.
so it would go something like this
display the client that goes with an id
display all directories, and the statuses of those that have clientid
matches in the lookup table.
if the status is changed, the lookup table is updated.
>>>>>>>>>>>>>>
create a client
ask for name and url (or use info from edit form)
check for existence of url //using url as a logical key, but not an
actual mySQL KEY.
if url exits, offer edit
insert data to client table.
<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>
edit a client
ask for name and url (or use info from create URL form)
check for existence of url
if url does not exist, offer create
present existing data as pre-filled submit form
offer delete
confirm delete: break
check for existence of new url
if new url exists AND is not associated with current clientID then deny
edit.
call "edit a client" again with previous query arguments
update table
<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>
create a directory
ask for url
if exists, offer edit
show full form with url readonly.
ask for:
name
submit URL
price
allowanchor
allowdescription
allowkeywords
pagerank
deeppagerank
comments
insert into directory
<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>
edit a directory
ask for url (or use info rom create directory form)
check for existance of url
if url does not exist, offer create
present data as pre-filled submit form
offer delete
confirm delete:break
check for existance of new url
if new url exists AND is not associated with current directoryID then deny
edit.
call "edit a directory" again with previous query arguments
update table
<<<<<<<<<<<<<<<<<
>>>>>>>>>>>>>>>>>
Manage Client Directories
ask for clientID or URL
ask for directory limit??
store clientID
display clientID
display client name
find and store all rows of status where clientid matches current
apply paginated display from http://www.programmingtalk.com/showthread.php?p=29121
find and store all rows of directory up to limit order by directory name??
display each directory and status information where it exists. include link
to update status
use one sql syntax for non-existent keys INSERT
use another syntax for existent keys UPDATE
allow toggle so that errors can be corrected.
clicking on "not submitted" inserts date
clicking on date inserts "not submitted"
...not approved...
include a link on each directory to edit that directory
Provide link to Manage Client Directories with no Query string.
<<<<<<<<<<<<<<<<<<
XXXXXXXXXXXXXXXX
paginated display example from http://www.programmingtalk.com/showthread.php?p=29121
<table width="800">
<tr>
<td>
<?php
// open connection
$conn = mysql_connect("localhost", "my_username", "pass");
// pick database
mysql_select_db("my_database",$conn);
// bring out the results of our query and format them in rows *and* columns.
// set the number of results to display on each page... 4x2=8
if (!($limit)){
$limit = 8;
}
// check to see if we're on the first page of the results
if (!($page)){
$page = 0;
}
// in order to paginate the results we need to know in advance how many
there are
$numresults = mysql_query("SELECT * FROM yourTable WHERE column = 'value'");
$numrows = mysql_num_rows($numresults);
// if there are no results, print a friendly message
if ($numrows == 0){
print("<td>There are currently no results for this query</td>\n
</tr>\n</table>\n");
exit();
}
// divide the number of results by the number displayed on each page, to get
number of pages
$pages = intval($numrows/$limit);
// if there are results left over, we need to add one more page
if ($numrows%$limit) {
$pages++;
}
$current = ($page/$limit) + 1; // calculate the current page number.
if (($pages < 1) || ($pages == 0)) {
$total = 1;
} else { // if $pages is less than one or equal to 0, total pages equals 1
$total = $pages;
} // if not, total pages is the value of $pages
$first = $page + 1;
//if this is not the last results page, last result = $page plus $limit
if (!((($page + $limit) / $limit) >= $pages) && $pages != 1) {
$last = $page + $limit;
} else { // if this is the last results page, last result equals total
number of results
$last = $numrows;
}
// below here can be changed if you want more or less columns etc
$numcols = 4; // how many columns we want on the page
$numcolsprinted = 0; // how many columns we have so far, do not change!
// get the results to be displayed in this set
$query = "SELECT * FROM FROM yourTable WHERE column = 'value' LIMIT $page,
$limit ";
$result = mysql_query($query, $mysql_link) or die (mysql_error());
// get each row
while ($row = mysql_fetch_array($result)) {
$producturl = $row["ProductURL"];
$imageurl = $row["ImageURL"];
$title = $row["Title"];
// we have to check to see if a row has been completed and if it has, start
a new one
if ($numcolsprinted == $numcols) {
print "</tr>\n<tr>\n";
$numcolsprinted = 0;
}
// output a row of results with columns evenly spaced
print " <td><a href=\"$producturl\"><img src=\"$imageurl\"
border=\"0\"></a><br><a href=\"$producturl\">$title</a></td>\n";
// increment row counter
$numcolsprinted++;
} // end while loop, at this point we have all the results
// now we need to pad out the table with empty cells if there's a final row
with
// fewer results than the number of columns we want to display
$colstobalance = $numcols - $numcolsprinted;
for ($i=1; $i<=$colstobalance; $i++) {
print " <td> </td>\n
</tr>";
}
?>
<tr>
<td colspan="4"></td>
</tr>
<tr>
<td colspan="4">
<?php
if ($page != 0) { // don't show back link if this is the first page
$back_page = $page - $limit;
echo(" <a href=\"$PHP_SELF?query=".$query."&page=$back_page&limit=$limit\">previous</a> \n");
} else {
print (" ");
}
$ppage = $limit*($i - 1);
print ("page $current of $pages");
if (!((($page+$limit) / $limit) >= $pages) && $pages != 1) { // if this
isn't the last page show 'next' link
$next_page = $page + $limit;
echo(" <a href=\"$PHP_SELF?query=".$query."&page=$next_page&limit=$limit\">next</a> \n");
} else {
print (" ");
}
?>
</td>
</tr>
</table>
|
|
|