|
-
Embedded PHP
Date: 01/16/06
Keywords: php
I'm working on a personal project ( MMORPG ) and have designed the game server as 20% C/C++ and 80% scripting language. I've been looking at embedding Python, or Small because of the ( apparent ) ease of embedding and the docs available, but I would really like to embed the PHP engine.
The only problem is, I can't seem to find any docs regarding embedding PHP into a C application, aside from some obscure mailing list post in 2003 where someone had begun to embed PHP into an app. I'm familiar with writing extensions, with the Zend memory manager, etc, I just need a push in the right direction in regards to actually embedding the engine, converting datatypes between the two, etc.
Anyone have any docs related to this, or have done this and can share painful/painless stories?
Source: http://www.livejournal.com/community/php/395749.html
-
Embedded PHP
Date: 01/16/06
Keywords: php
I'm working on a personal project ( MMORPG ) and have designed the game server as 20% C/C++ and 80% scripting language. I've been looking at embedding Python, or Small because of the ( apparent ) ease of embedding and the docs available, but I would really like to embed the PHP engine.
The only problem is, I can't seem to find any docs regarding embedding PHP into a C application, aside from some obscure mailing list post in 2003 where someone had begun to embed PHP into an app. I'm familiar with writing extensions, with the Zend memory manager, etc, I just need a push in the right direction in regards to actually embedding the engine, converting datatypes between the two, etc.
Anyone have any docs related to this, or have done this and can share painful/painless stories?
Source: http://community.livejournal.com/php/395749.html
-
Regular Expression help?
Date: 01/16/06
Keywords: no keywords
Hi guys,
Following up on my previous post, I've managed to get the array to filter using preg_grep().
But I need some help on my regular expressions. I've currently got it as $regexp = "/".$_POST['cityname']."/"; which matches any instance of 'cityname'. The problem here is that the regular expression is case sensitive, and I need it to ignore cases.
I would use strtoupper or strtolower, but the array values are in Natural case. I think I should use an (i) in the regexp to allow it to ignore case, but I'm not sure where to fit it in. Can someone help me out?
SOLVED: $regexp = "/".$_POST['cityname']."/i";
Source: http://www.livejournal.com/community/php/395374.html
-
Regular Expression help?
Date: 01/16/06
Keywords: no keywords
Hi guys,
Following up on my previous post, I've managed to get the array to filter using preg_grep().
But I need some help on my regular expressions. I've currently got it as $regexp = "/".$_POST['cityname']."/"; which matches any instance of 'cityname'. The problem here is that the regular expression is case sensitive, and I need it to ignore cases.
I would use strtoupper or strtolower, but the array values are in Natural case. I think I should use an (i) in the regexp to allow it to ignore case, but I'm not sure where to fit it in. Can someone help me out?
SOLVED: $regexp = "/".$_POST['cityname']."/i";
Source: http://community.livejournal.com/php/395374.html
-
Update / Seeking Guidance
Date: 01/14/06
Keywords: php, html, web
Alright so in light of the responses with my previous post, I've decided to code this myself (I could really use the challenge and I've been meaning to get back into PHP for a while now anyways)
I've already got the code to add information to the datebase, now I'm working on displaying it. I have a question.
How can i have the HTML table add more rows to accomodate the added entry's in the "shows" section whenever the band chooses to add another show to their website? (so all the current shows are being displayed).
Thanks
Source: http://www.livejournal.com/community/php/395014.html
-
Update / Seeking Guidance
Date: 01/14/06
Keywords: php, html, web
Alright so in light of the responses with my previous post, I've decided to code this myself (I could really use the challenge and I've been meaning to get back into PHP for a while now anyways)
I've already got the code to add information to the datebase, now I'm working on displaying it. I have a question.
How can i have the HTML table add more rows to accomodate the added entry's in the "shows" section whenever the band chooses to add another show to their website? (so all the current shows are being displayed).
Thanks
Source: http://community.livejournal.com/php/395014.html
-
File Upload
Date: 01/13/06
Keywords: no keywords
I've got this small snippet for uploading an image, but it's not working. Anyone can help out? :) I get an error that I've got the wrong file type when I try to post something.
<.h3>Zur Zeit im Studio - Neuer Eintrag <.form action=" echo $PHP_SELF ?>" method="post" enctype="multipart/form-data"> <.table> <.tr> <.td> <.b>Band: <.input type="text" name="band" size="40">
|
<.tr>
<.td>
<.!-- this is where the image to upload goes-->
Bild URL:
<.input type="text" name="bild" size="40">
<.tr>
<.td>
Text:
<.textarea cols="50" rows="10" name="text">
<.tr>
<.td>
Englischer Text:
<.textarea cols="50" rows="10" name="entext">
<.tr>
<.td>
<.input type="submit" name="submit" value="Submit">
$GLOBALS['UPLOAD_SIZES']['max']){return -1;}
$arrSegments = split('[.]', $strName);
$strExtension = $arrSegments[count($arrSegments) - 1];
if ($GLOBALS['UPLOAD_TYPES'][strtoupper($strExtension)] != 1) {return -2;}
return 1;}
$intResult = verify_uploaded_file(
$HTTP_POST_FILES['upload_file']['name'],
$HTTP_POST_FILES['upload_file']['size']);
if ($intResult != 1){
print ("Error!");
if ($intResult == -1){die ($msg_base . 'The button is too large.
');}
elseif ($intResult == -2){die($msg_base . 'The only file types allowed are: JPG, JPEG, GIF, PNG.');}
}if (! move_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name'],
$MOVE_TO_PATH . $HTTP_POST_FILES['upload_file']['name']) ){die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file']['name']);}
*/
$sql = "INSERT INTO table(timestamp,band,bild,text,entext) VALUES ('$timestamp','$band','$bild','$text','$entext')";
$result = mysql_query($sql) or print ("Can't insert into table .
" . $sql . "
" . mysql_error());
if ($result != false)
{
print "Die Band wurde gepostet!";
}
mysql_close();
}
?>
Source: http://www.livejournal.com/community/php/394734.html
File Upload
Date: 01/13/06
Keywords: no keywords
I've got this small snippet for uploading an image, but it's not working. Anyone can help out? :)
I get an error that I've got the wrong file type when I try to post something.
<.h3>Zur Zeit im Studio - Neuer Eintrag
<.form action=" echo $PHP_SELF ?>" method="post" enctype="multipart/form-data">
<.table>
<.tr>
<.td>
<.b>Band:
<.input type="text" name="band" size="40">
<.tr>
<.td>
<.!-- this is where the image to upload goes-->
Bild URL:
<.input type="text" name="bild" size="40">
<.tr>
<.td>
Text:
<.textarea cols="50" rows="10" name="text">
<.tr>
<.td>
Englischer Text:
<.textarea cols="50" rows="10" name="entext">
<.tr>
<.td>
<.input type="submit" name="submit" value="Submit">
$GLOBALS['UPLOAD_SIZES']['max']){return -1;}
$arrSegments = split('[.]', $strName);
$strExtension = $arrSegments[count($arrSegments) - 1];
if ($GLOBALS['UPLOAD_TYPES'][strtoupper($strExtension)] != 1) {return -2;}
return 1;}
$intResult = verify_uploaded_file(
$HTTP_POST_FILES['upload_file']['name'],
$HTTP_POST_FILES['upload_file']['size']);
if ($intResult != 1){
print ("
Error!");
if ($intResult == -1){die ($msg_base . 'The button is too large.
');}
elseif ($intResult == -2){die($msg_base . 'The only file types allowed are: JPG, JPEG, GIF, PNG.');}
}if (! move_uploaded_file($HTTP_POST_FILES['upload_file']['tmp_name'],
$MOVE_TO_PATH . $HTTP_POST_FILES['upload_file']['name']) ){die('You did not upload a file or the file could not be moved to ' . $MOVE_TO_PATH . $HTTP_POST_FILES['upload_file']['name']);}
*/
$sql = "INSERT INTO table(timestamp,band,bild,text,entext) VALUES ('$timestamp','$band','$bild','$text','$entext')";
$result = mysql_query($sql) or print ("Can't insert into table .
" . $sql . "
" . mysql_error());
if ($result != false)
{
print "Die Band wurde gepostet!";
}
mysql_close();
}
?>
Source: http://community.livejournal.com/php/394734.html
August Burns Red
Date: 01/13/06
Keywords: php, mysql, html, database, sql, web
Hey Guys
I'm new to this community. I am starting a web design company, and although I used to be decent at PHP, that was a couple of years ago and my knowledge is now pretty much non-existent. I need a script coded for a band website and I was wondering if some of you would give me a price estimate on it.
The script is for bands that want to add shows to their website. The script needs to do the following
- Allow a user to add / edit / delete shows to their website. The shows will be in 2 categories (which will be 2 HTML tables) which are Upcoming shows, and past shows.
- The user puts in information in a form and it's stored in a MySQL database. The most important information is displayed in an HTML table, and in the last cell of the table will have a link for more information. When a user clicks on this link it opens up a popup window and displays ALL the information of the show (eg. Date, time, venue, cost, directions, other notes yada yada yada) in another HTML table (within the pop-up window)
I realise that this is a pretty simple script (in comparison to what you guys have probably coded in the past, so I hope someone out there can code it for me at a reasonable price
Thanks in advance
Source: http://www.livejournal.com/community/php/394319.html
August Burns Red
Date: 01/13/06
Keywords: php, mysql, html, database, sql, web
Hey Guys
I'm new to this community. I am starting a web design company, and although I used to be decent at PHP, that was a couple of years ago and my knowledge is now pretty much non-existent. I need a script coded for a band website and I was wondering if some of you would give me a price estimate on it.
The script is for bands that want to add shows to their website. The script needs to do the following
- Allow a user to add / edit / delete shows to their website. The shows will be in 2 categories (which will be 2 HTML tables) which are Upcoming shows, and past shows.
- The user puts in information in a form and it's stored in a MySQL database. The most important information is displayed in an HTML table, and in the last cell of the table will have a link for more information. When a user clicks on this link it opens up a popup window and displays ALL the information of the show (eg. Date, time, venue, cost, directions, other notes yada yada yada) in another HTML table (within the pop-up window)
I realise that this is a pretty simple script (in comparison to what you guys have probably coded in the past, so I hope someone out there can code it for me at a reasonable price
Thanks in advance
Source: http://community.livejournal.com/php/394319.html
Help with arrays...
Date: 01/13/06
Keywords: no keywords
Hi guys,
I'm working with a rather large array (9,266 records). The key is always a 3-character string, but the value is a variable length string. While I'm able to search the array on the keys, I need to be able to search the values to return the keys at times as well.
But array_search() won't work, since it requires an exact match, and I'll need to pull possible matches from a section of the string.
Example: I'm searching the values for the string "augusta". I know this matches 4 records in the array, but I need to pull the keys for this.
The records:
'AGS' => 'Augusta (Bush Field), GA, USA',
'AUG' => 'Augusta State Airport, ME, USA',
'DNL' => 'Augusta (Daniel Field), GA, USA',
'PUG' => 'Port Augusta, South Australia, Australia',
Anyone know of any way I can do this with an array?
EDIT: Yes, I know this is a better job for a db. For the time being, I'm stuck using an array.
Source: http://www.livejournal.com/community/php/394193.html
Help with arrays...
Date: 01/13/06
Keywords: no keywords
Hi guys,
I'm working with a rather large array (9,266 records). The key is always a 3-character string, but the value is a variable length string. While I'm able to search the array on the keys, I need to be able to search the values to return the keys at times as well.
But array_search() won't work, since it requires an exact match, and I'll need to pull possible matches from a section of the string.
Example: I'm searching the values for the string "augusta". I know this matches 4 records in the array, but I need to pull the keys for this.
The records:
'AGS' => 'Augusta (Bush Field), GA, USA',
'AUG' => 'Augusta State Airport, ME, USA',
'DNL' => 'Augusta (Daniel Field), GA, USA',
'PUG' => 'Port Augusta, South Australia, Australia',
Anyone know of any way I can do this with an array?
EDIT: Yes, I know this is a better job for a db. For the time being, I'm stuck using an array.
Source: http://community.livejournal.com/php/394193.html
Grabbing the page name only?
Date: 01/12/06
Keywords: php
Is there a nice and simple way to grab just the page.php part of an url as $PHP_SELF returns "folder/page.php".
I know this is probably something obvious but I just can't see it at the moment.
TIA
Paul
Source: http://www.livejournal.com/community/php/393760.html
Grabbing the page name only?
Date: 01/12/06
Keywords: php
Is there a nice and simple way to grab just the page.php part of an url as $PHP_SELF returns "folder/page.php".
I know this is probably something obvious but I just can't see it at the moment.
TIA
Paul
Source: http://community.livejournal.com/php/393760.html
php template and searchability (cross posted)
Date: 01/11/06
Keywords: php, google
I would like to build a site using php that has several repeated elements (headers, footers, menu) that appear on every page, with only the central content and some of the styling (to highlight menu items) changing.
It works well so far, but a friend tells me that this method is less search-friendly than coding out each individual page and that it will be ignored by Google. Is this true?
Also, give then common-template model, is it better to:
- Load all pages from a single php file with page-specific content in individual functions
- Load each page with its own content and use includes for common elements
- Have a central controlling php file that assembles each page by includes from a separate file for each part (header, content, footer, etc)
- Make each page a complete static unit with duplicate headers, footers, etc identical to other pages.
I can make any of these work, though #4 seems highly tedious. I just want opinions on which ones are considered more efficient and more "searchable."
Source: http://www.livejournal.com/community/php/393696.html
php template and searchability (cross posted)
Date: 01/11/06
Keywords: php, google
I would like to build a site using php that has several repeated elements (headers, footers, menu) that appear on every page, with only the central content and some of the styling (to highlight menu items) changing.
It works well so far, but a friend tells me that this method is less search-friendly than coding out each individual page and that it will be ignored by Google. Is this true?
Also, give then common-template model, is it better to:
- Load all pages from a single php file with page-specific content in individual functions
- Load each page with its own content and use includes for common elements
- Have a central controlling php file that assembles each page by includes from a separate file for each part (header, content, footer, etc)
- Make each page a complete static unit with duplicate headers, footers, etc identical to other pages.
I can make any of these work, though #4 seems highly tedious. I just want opinions on which ones are considered more efficient and more "searchable."
Source: http://community.livejournal.com/php/393696.html
sort by count?
Date: 01/10/06
Keywords: sql
Is there some possibility to sort this:
$sql = "SELECT band,cover1,cover1year,cover1title,cover2,cover2year,cover2title,cover3,cover3year,cover3title,cover4,cover4year,cover4title,cover5,cover5year,cover5title FROM referenzen ORDER BY band ASC";
by the count of covers (so the ones with 4+ are on top and the ones with only one are at the bottom)? (see this). Not all of the variables are always in use, I don't have any idea how to do this.
Source: http://www.livejournal.com/community/php/393297.html
sort by count?
Date: 01/10/06
Keywords: sql
Is there some possibility to sort this:
$sql = "SELECT band,cover1,cover1year,cover1title,cover2,cover2year,cover2title,cover3,cover3year,cover3title,cover4,cover4year,cover4title,cover5,cover5year,cover5title FROM referenzen ORDER BY band ASC";
by the count of covers (so the ones with 4+ are on top and the ones with only one are at the bottom)? (see this). Not all of the variables are always in use, I don't have any idea how to do this.
Source: http://community.livejournal.com/php/393297.html
exec variable question...
Date: 01/10/06
Keywords: php
Why can't I get exec to read my php variable?
> list.txt");
$message1 = exec( "cat list.txt");
mail("Email@Email.com", $subject, $message1, $from);
?>
list.txt is blank...
Source: http://www.livejournal.com/community/php/393000.html
exec variable question...
Date: 01/10/06
Keywords: php
Why can't I get exec to read my php variable?
> list.txt");
$message1 = exec( "cat list.txt");
mail("Email@Email.com", $subject, $message1, $from);
?>
list.txt is blank...
Source: http://community.livejournal.com/php/393000.html