I am very new to php/mysql and this is causing me to loose hairs, I am trying to build a multi level site navigation. In this part of my script I am readying the sub and parent categories coming from a form for insertion into the database:
// get child categories
$catFields = $_POST['categories'];
if (is_array($catFields)) {
$categor...
How do you securely pass credit card information between pages in PHP? I am building an ecommerce application and I would like to have the users to go through the checkout like this:
Enter Information -> Review -> Finalize Order
Problem is that I am not sure on how to safely pass credit information from when the user inputs them to whe...
Whats the best way to send data to the server and have it run through a php script. Bearing in mind I do not want to have the user redirected to a different page and no response needs to be sent back from the server.
...ammended...
I have the following markup.
<div id='0001' class='threadWrapper'>
<div class='littleme'>
I'm hoping to...
Hi,
I use DOMDocument. My code here.
$dom = new DOMDocument('1.0', 'utf-8');
$textNode = $dom->createTextNode('<input type="text" name="lastName" />');
$dom->appendChild($textNode);
echo $dom->saveHTML();
Output:
<input type="text" name="lastName" />
I want to this output
<input type="text" name="lastName" />
How can i do?...
I am trying to modify a wordpress / MySQL function to display a little more information. I'm currently running the following query that selects the post, joins the 'postmeta' and gets the info where the meta_key = _liked
function most_liked_posts($numberOf, $before, $after, $show_count) {
global $wpdb;
$request = "SELECT ID, p...
I'm using the PHPMailer-Lite class to build an email sending script and I'm not sure if I should use addslashses() on the $name variable when adding it to the constructor.
If somebody's last name would be O'Riley (or any other name that contains characters which should normally be sanitized before handling) and I would send it unescaped...
I know I'm probably missing something easy, but I have a foreach loop and I'm trying to modify the values of the first array, and output a new array with the modifications as the new values.
Basically I'm starting with an array:
0 => A:B
1 => B:C
2 => C:D
And I'm using explode() to strip out the :'s and second letters, so I want to ...
Not sure what could be the problem.
I'm dumping data from an array $theArray into theFile.txt, each array item on a separate line.
$file = fopen("theFile.txt", "w");
foreach ($theArray as $arrayItem){
fwrite($file, $arrayItem . '\n');
}
fclose($file);
Problem is when I open theFile.txt, I see the \n being outputted literally.
A...
I'm using a third-party API to send messages to users. But this third-party limits 30 calls per hour. I'm using PHP on linux.
What's the best way to implement this?
...
This is my php code (I already have a connection to the db):
$result = mysql_query("SHOW TABLE STATUS FROM mydb LIKE 'mytable';");
while ($array = mysql_fetch_array($result)) {
$updatetime = $array['Update_time'];
}
echo $updatetime;
I get:
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL r...
Hey all,
I try to use single quotes as much as possible and I've noticed that I can't use \n in single quotes. I know I can just enter a newline literally by pressing return, but that screws up the indentation of my code.. Is there some ASCII character or something that I can type that will produce newline when I'm using single quotes?
...
Is it possible to loop through a query so that if (for example) 500,000 rows are found, it'll return results for the first 10,000 and then rerun the query again?
So, what I want to do is run a query and build an array, like this:
$result = pg_query("SELECT * FROM myTable");
$i = 0;
while($row = pg_fetch_array($result) ) {
$myArray[$...
I'm trying to use the following code and it still strips out all the tags. Am I doing something wrong? I'm using the newest V1.10
$allowed_tags = array('img', 'object', 'param', 'embed', 'a', 'href', 'p', 'br', 'em', 'strong', 'li', 'ol', 'span');
$allowed_attributes = array('style', 'src', 'alt', 'href', 'width', 'height', 'value', '...
Hi all,
For example,
STEP 1:
I am browsing a page without logging in and my last page before logging in is beforeLogin.php
STEP 2:
Now my prob is when i logged in i am redirecting to the index.php page. Instead i should be redirected to the last page what i had browsed.
That is from the above example is should redirected to befor...
How can I authenticate my users via our their Google Apps account.
I also need access to their email.
I've read Oauth is needed but I have no idea if that is correct.
I'm using PHP.
...
Protocol Buffers doesn't have a native Exception type. What would a suitable .proto file for cross-language exceptions look like?
...
Hi , I have a html form with the data by this post method
'form id='form1' name='form1' method='post' action='process.php'etc '
to a php page for processing into a mysql database . When the user has filled in the form BEFORE submitting it I have a button that the user can click to open up a new page to display a pdf of the data ent...
Hello
Here is one script with out any errors
$url="http://yahoo.com";
$file1 = fopen($url, "r");
$content = file_get_contents($url);
$t_beg = explode('<title>',$content);
$t_end = explode('</title>',$t_beg[1]);
echo $t_end[0];
And here is the same script using a look to check multiple urls and getting errors
for ($j=1;$j<=$i;...
I'd like to "grab" a few hundred urls from a few hundred html pages.
Pattern:
<h2><a href="http://www.the.url.might.be.long/urls.asp?urlid=1" target="_blank">The Website</a></h2>
...
I currently have a Java Applet which contains a method callfromjs(). Javascript calls this method from the applet so that I don't have to deal with the clunky applet GUI, and then I can create the responses on the DOM easily from javascript.
The problem is that the browser hangs while first loading the applet. To get around this, I fig...