Okay, I want to make a HTTP_POST using cURL to a SSL site. I already imported the certificate to my server. This is my code:
$url = "https://www.xxx.xxx";
$post = "";# all data that going to send
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, FALSE);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0');
$exe = curl_exec($ch);
$getInfo = curl_getinfo($ch);
if ($exe === false) {
$output = "Error in sending";
if (curl_error($ch)){
$output .= "\n". curl_error($ch);
}
} else if($geInfo['http_code'] != 777){
$output = "No data returned. Error: " . $geInfo['http_code'];
if (curl_error($ch)){
$output .= "\n". curl_error($ch);
}
}
curl_close($c);
echo $output;
It keep returned "500". Based on w3schools, 500 means Internal Server Error. Is my server having problem? How to solve/troubleshoot this?
I have a site which has been running for some time now that uses a great deal of user input to build the site. Naturally there are dozens of forms on the site. When building the site, I often used hidden form fields to pass data back to the server so that I know which record to update.
an example might be:
<input type="hidden" name="id" value="132" />
<input type="text" name="total_price" value="15.02" />
When the form is submitted, these values get passed to the server and I update the records based on the data passed (i.e. the price of record 132 would get changed to 15.02).
I recently found out that you can change the attributes and values via something as simple as firebug. So...I open firebug and change the id value to "155" and the price value to "0.00" and then submit the form. Viola! I view product number 155 on the site and it now says that it's $0.00. This concerns me.
How can I know which record to update without either a query string (easily modified) or a hidden input element passing the id to the server?
And if there's no better way (I've seen literally thousands of websites that pass the data this way), then how would I make it so that if a user changes these values, the data on the server side is not executed (or something similar to solve the issue)?
I've thought about encrypting the id and then decrypting it on the other side, but that still doesn't protect me from someone changing it and just happening to get something that matches another id in the database.
I've also thought about cookies, but I've heard that those can be manipulated as well.
Any ideas? This seems like a HUGE security risk to me.
Hello,
In the code below, "created" is a field in a MySQL table. This field is of the type "timestamp" and the default is set to "CURRENT_TIMESTAMP" of whenever a given row is created.
In the query below, I would like to create a new variable that equals the present date minus the timestamp of "created", rounded off to units of days. I would like the present date to be whenever the query is run.
How could I do this?
Thanks in advance,
John
$sqlStr = "SELECT
l.loginid,
l.username,
l.created,
...
I am writing a wordpress theme, and have run into a fairly basic problem. By default, when you inset an image into the post, it displays that image at the size you specify, on both the homepage and the single post.
I would like to have different sized images, displaying a thumbnail on the homepage, and a full sized image when you click through to the post. I am using wordpress 2.9's new thumbnail feature, which has created great thumbnails for the homepage. But now, I am stuck with a nice thumbnail next to a large photo (on the index/home page). On the single page, it is displaying correctly with just the large picture.
Basically, I need to know how to tell wordpress to only display the large post image on the single page, not on the index.
Also: I have used the timthumb script, but I think the answer is far more basic then needing plugins or scripts
Thanks!
I have the following MySQL InnoDB tables...
TABLE foldersA (
ID
title
)
TABLE foldersB (
ID
title
)
TABLE records (
ID
folderID
folderType
title
)
folderID in table "records" can point to ID in either "foldersA" or "foldersB" depending on the value of folderType. (0 or 1).
I am wondering:
Is there a way to create a CASCADE rule such that the appropriate rows in table records are automatically deleted when a row in either foldersA or folderB is deleted?
Or in this situation, am I forced to have to delete the rows in table "records" programatically?
Thanks for you help!
I want to add a meta tag like this one:
<meta name="key" content="value" />
to some of the pages in Wordpress. I know, I can add this into my template and it will show up. But the thing is, I am not allowed to even touch the template. It's totally template independent.
So, I have to add the meta tag only by doing something in my plugin code. I have tried wp_head action hook, but it is not working. Any idea of a workaround or anything to get the meta tag inside the head tags of the pages dynamically.
while($row=mysql_fetch_array($result2)){
//return $row['ProjectID'];
$sql="INSERT INTO `tycodashboard` (ProjectID,DesignationID,ReqcompID,IntOrgID,FinishedTimeID,ProjectStatusID,PhaseID
) VALUES('{$row['ProjectID']}','$pm,'$req','$initiating,'$initiating','$ftime,'$ProjectStatus,'$Phase)";
$result=mysql_query($sql);
if(!$result){
if(mysql_errno() == ER_DUP_ENTRY){
throw new Exception("INSERT FAILED.\n\nThe database already contains a Project with the Project Name \"$ldesc\", please pick another.");
}else{
throw new Exception("INSERT FAILED.\n\n".mysql_error());
}
}
}//exits
INSERT FAILED.
You have an error in your SQL syntax; check the manual that
corresponds to your MySQL server version for the
right syntax to use near '3','2,'2','2,'2,'3)' at line 2
Hi, I have a problem with resizing images.
What happens is that if you upload a file larger than the stated parameters, the image is cropped, then saved at 100% quality.
So if I upload a large jpeg which is 272Kb. The image is cropped by 100 odd pixels. The file size then goes up to 1.2Mb.
We are saving images at a 100% quality. I assume that this is what is causing the problem. The image is exported from Photoshop at 30% quality which reduces the file size. Resaving the image at 100% quality creates the same image but I assume with a lot of redundant file data.
Has anyone encountered this before? Does anyone have a solution?
This is what we are using.
$source_im = imagecreatefromjpeg ($file);
$dest_im = imagecreatetruecolor ($newsize_x, $newsize_y);
imagecopyresampled (
$dest_im, $source_im,
0, 0,
$offset_x, $offset_y,
$newsize_x, $newsize_y,
$sourceWidth, $sourceHeight
);
imagedestroy ($source_im);
if ($greyscale) {
$dest_im = $this->imageconvertgreyscale ($dest_im);
}
imagejpeg($dest_im, $save_to_file, $quality);
break;
Suppose I have options of searching are
1.occupation
2.education
3.religion
4.caste
5.country
and many more.
when i perform this search, i can get easily calculate refinements.
problem is i need to calculate refinements in a way that for individual refinement is calculated in a manner that all search parameter is considered expect the calculated refinement
check on the left side ... even i have choose the profession area, still search refinements of this is coming.... same functionality if of all refinements.Please help.I use sphinx for searching
seen this type of refinements in
http://ww2.shaadi.com/search
Is there any good tutorial for zend except the official zend tutorial at http://framework.zend.com/manual/en/. The zend official tutorial is very scattered and not very much helpful for newcomers.
I'm currently using this code to get the number of subscribers to my blog:
$whaturl="http://api.feedburner.com/awareness/1.0/GetFeedData?uri=http://feeds.feedburner.com/DesignDeluge";
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $whaturl);
$data = curl_exec($ch);
curl_close($ch);
$xml = new SimpleXMLElement($data);
$fb = $xml->feed->entry['circulation'];
but when I echo $fb it doesn't work (the whole file that $fb is being echoed on doesn't appear). Any ideas on why this isn't working?
i have line
new_element.innerHTML ="";
which will call the function addWidget as
function addWidget(url) {
alert(url);
var main= document.getElementById('mainwidget');
main.innerHTML = "";
}
but its not working whats the problem...
I have a system I am trying to design that will retrieve information from a database, so that it can be plotted in a jquery graph. I need to retrieve the information and somehow put it in the necessary coordinates format (for example two coordinates var d = [[1269417600000, 10],[1269504000000, 15]];).
My table that I am selecting from is a table that stores user votes with fields:
points_id (1=vote up, 2=vote down),
user_id,
timestamp,
topic_id
What I need to do is select all the votes and somehow group them into respective days and then sum the difference between 1 votes and 2 votes for each day. I then need to somehow display the data in the appropriate plotting format shown earlier. For example April 1, 4 votes. The data needs to be separated by commas, except the last plot entry, so I am not sure how to approach that. I showed an example below of the kind of thing I need but it is not correct,
echo "var d=[";
$query=mysql_query(
"SELECT *, SUM(IF(points_id = \"1\", 1,0))-SUM(IF([points_id = \"2\", 1,0)) AS 'total'
FROM points LEFT JOIN topic ON topic.topic_id=points.topic_id
WHERE topic.creator='$user' GROUP by timestamp
HAVING certain time interval"
);
while ($row=mysql_fetch_assoc($query)){
$timestamp=$row['timestamp'];
$votes=$row['total'];
echo "[$timestamp,$vote],";
}
echo "];";
Forgive me if this is a particularly stupid question!
mysql_query($query)
returns a boolean, but you can also assign it to a variable
$results = mysql_query($query)
and then use the other mysql_ functions to extract data.
Out of curiosity, how does mysq_query($query) act as both a boolean and a data container at the same time? What's happening "under the hood" during these steps?
(yes, I am a n00b..., please be kind!)
What is the reason of the error on title? My script is below. Thank you.
$fbFoodPerma = $fbSiteID."-".$fbFoodPerma;
$sql = mysql_query("
SELECT fbFoodPerma
FROM fbFoods
WHERE fbFoodPerma
LIKE '$fbFoodPerma'") or die(mysql_error());
$isStored = mysql_result($sql,0,"fbFoodPerma");
while ($isStored == "$fbFoodPerma") {
$fbFoodPerma = $fbFoodPerma."-";
$sql = mysql_query("
SELECT fbFoodPerma
FROM fbFoods
WHERE fbFoodPerma
LIKE '$fbFoodPerma'") or die(mysql_error());
$isStored = mysql_result($sql,0,"fbFoodPerma");
}
Hey guys,
I am looking to find a lean WYSIWYG inline editor. The main required feature is image uploading. A simple way to upload an image to the server and use it in the content being editted. I have come across a whole bunch of editors but nothing I liked so far. I am looking for something open source and free.
So far I have checked out TinyMCE which is free.. untill you need image uploading capabilities.
Ckeditor looks great.. uses jquery.. but requires you to have your own server side script to upload images. They barely give any documentation on how to do this.
There were a few others, but the bottom line was that I cant find anything that is simple with out of the box image uploading capabilities.
Thanks for any advice you may give!
I've a table which has 3 columns: id, a_id and b_id.
Suppose rows are like this:
1, a1, b1
2, a1, b2
3, a1, b3
4, a2, b4
5, a2, b5
6, a2, b6
I want to convert it to
1, a1, b1
2, a1, b1
3, a1, b1
4, a2, b4
5, a2, b4
6, a2, b4
So I want to make all the b_id corresponding to a_id same, and equal to the one which is found first. How can I do this? For simplicity, I've removed other columns from table. So please ignore row duplication here.
Hi,
I'd like to select products depending on several criteria from different attribute.
I know how to user $collection->addAttributeToFilter('someattribute', array('like' => '%'));
But I'd like to use several attribute for OR condition.
Like:
$collection->addAttributeToFilter('someattribute', array('like' => 'value'));`
OR
$collection->addAttributeToFilter('otherattribute', array('like' => 'value'));`
To get products which either 'someattribute' OR 'otherattribute' set to 'value'
Is it possible?
I currently use curl_multi_* to connect to a few sites. Its only sending a few $_GET variables to start a script, but it outputs the html from the sites to the browser. I want to stop this. I already use a short timeout, but sometimes the scripts start fast, and I don't want to set the timeout any lower, in case it causes it not to connect.
So how can I stop the output to the browser from cURL?
I have an array like this (output from print_r):
Array
(
[price] => 700.00
[room_prices] => Array
(
[0] =>
[1] =>
[2] =>
[3] =>
[4] =>
)
[bills] => Array
(
[0] => Gas
)
)
I'm running a custom function to convert it to an object. Only the top-level should be converted, the sub-arrays should stay as arrays. The output comes out like this:
stdClass Object
(
[price] => 700.00
[room_prices] => Array
(
[0] => Array
)
[bills] => Array
(
[0] => Array
)
)
Here is my conversion function. All it does is set the value of each array member to an object:
function array_to_object( $arr )
{
$obj = new stdClass;
if ( count($arr) == 0 )
return $obj;
foreach ( $arr as $k=>$v )
$obj->$k = $v;
return $obj;
}
I can't figure this out for the life of me!
Hi, when using scaffolding on a controller the views render fine and the app even attempts to insert the data; the problem is that the scaffold is completely ignoring the relations I'm defining in my model class, in fact it's ignoring the class entirely as I can delete the file and the controller still scaffolds and render the crud from the table.
Has this ever happened to you?
ok. i have searched the internet and tried many things but nothing seems to work for me.. i am now getting upset of this datatables.
I found 1 way which some ppl on net says works for them and it is giving me strange problem.
if you see the image, when i use the function fnGetPosition, it just cross out.. i don't know why other users over net have no issue on it..
All i am trying to get is FormID, if there is any other way please help me get the ID.
I'm trying to match a word in a string to see if it occurs at the end of that string. The usual strpos($theString, $theWord); wouldn't do that.
What would be the most efficient way to do it?