Try this.
$count = mysql_query("SELECT * FROM qqq WHERE question = '$question' && answer = '$answer' && questionid = '$id'") or die(mysql_error());
$score = mysql_num_rows($count);
Try this.
$count = mysql_query("SELECT * FROM qqq WHERE question = '$question' && answer = '$answer' && questionid = '$id'") or die(mysql_error());
$score = mysql_num_rows($count);
That didnt work... when i went to the page that you need to be logged into to view it just redirected me to login.php thanks for trying though....
Have you set your browser to delete your cookies when you close your browser. I would check your cookie preferences in your web browser and make sure cookies do not get deleted by the browser. I think that is the key to the problem.
Fried frozen ice with softdrinks mixed type and some spices added to it on the frying pan. A good old Macgyver trick and that should get my taste buds going.
Well what did you (the reader) think of January 010 as now it is the first of Feb 010.
I would suggest the following:
<?php file_get_contents('http://cronsubdomain.yoursite.com/job1.php');
file_get_contents('http://cronsubdomain.yoursite.com/job2.php');
file_get_contents('http://cronsubdomain.yoursite.com/job3.php');
file_get_contents('http://cronsubdomain.yoursite.com/job4.php');
file_get_contents('http://cronsubdomain.yoursite.com/job5.php');
file_get_contents('http://cronsubdomain.yoursite.com/job6.php');
file_get_contents('http://cronsubdomain.yoursite.com/job7.php');
?>
Then you will have no problems with memory limits and function definitions as they are each a separate request.
http://www.ubergizmo.com/15/archives/2009/01/samsung_opens_door_to_32gb_ram_stick.html
http://www.macnn.com/articles/09/12/21/64gb.and.32gb.ram.upgrades/
http://www.tyan.com/product_board_detail.aspx?pid=271
Thanks for that. I can now see by the end of the century we will truly have Atlantian technology. And my reverse hashing technology looks like will have the green light in just a few years. Until then I have to use a computer with 4GB of ram plus a server with 1GB ram. G' it will be fun to play around with 32GB of ram.
This is the most undocumented problem I have come across. All of the official documentation to the older versions of Imagick have been wiped and downloads are hard to find. But still after spending 9 hours flat finding peoples comments on old topics related to Imagick I manage to solve it and wrote a tutorial about it. My tutorial is the only one in existance which works with php 5.2.X and hope that helps future Daniweb posters. Surprising how undocumented this problem is and yet this problem is so common.
I discovered the Imagick library but haven't yet got the package installed (for windows xp and php5.2.8). I have downloaded Imagick-6.5.9-0-Q16-windows-dll.exe as the main application then as according to the documentation downloaded the php5.2.8 dll compilation. Then I went into the php.ini file and added the line extension=php_imagick.dll
.
After all of that I tried a sample code and checked php_info() then it the dll is not mentioned in php_info(). Also the test script fails as unknown classes errors appear. So what did I do wrong in the installation? I'm using xampp 1.7.0 and Windoze XP Service Pack 3.
Well the first month of 2010 has almost gone in a flash. I'm sure the years shortest month February coming up will be just as good. Do you have any new months resolutions. And what did you think of January 2010 or January 2009 for those who are Chinese.
Hi and I have been working on an image uploader but need to be able to convert tiff files using php. From my understanding there is the gd library which doesn't support tiff files and the exif library. Does anybody know how I can convert a tiff file to a jpeg without shell commands. I have managed to convert bmp to jpeg using the gd library but now need a solution for tiff. Any replies please?
you know what takeshi.... im so sick and tired of debugging your code... i had help you many times and even provided code in many of your threads but you didn't had even the effort to payback the guys that helped you. You dont mark you thread solved. You just come here and beg for answers which is very annoying that some solutions are simple and obvious. i think your so lazy that your just copy and paste the code without even understanding it. Were like baby spoon feeding you here. Grow up and do you assignments on your own. You wont learn anything if you dont put your effort on it. I hope i make sense to you.
One of the best ways of learning is by asking for help and as long as you learn from that help then next time they should be able to solve the same problem by themselves.
Perhaps this will work...
<?php
mysql_connect ("localhost", "root",'password') or die (mysql_error());
mysql_select_db ("records");
$criteria = (int)$_POST['criteria'];
$sql = "SELECT * FROM students WHERE ";
switch($criteria)
case 1: $sql .= "course"; break;
case 2: $sql .= "surname"; break;
case 3: $sql .= "department"; break;
case 4: $sql .= "email"; break;
case 5: $sql .= "studno"; break;
}
$sql .= " LIKE '%term%'";
$r=mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_assoc($r)){
echo '<br/> Surname: '.$row['lname'];
echo '<br/> Course: '.$row['course'];
echo '<br/> Student No: '.$row['studno'];
echo '<br/> Department: '.$row['department'];
echo '<br/> Email Address: '.$row['email'];
}
?>
thats the same code
If you read it more closely you will see that I changed how the array was added to the echo function and I changed the quotes type so you didn't have to escape the double quotes.
[edit]
Discovered a bug in my code...
<?
begin_block('Donate');
echo '<BR><BR><CENTER>This would need to contain your donation code, or something. maybe even a paypal link</CENTER><BR><BR>';
echo '<a href="member.php?mid='.$row['mid'].'">'.$row['login'].'</a>';
end_block();
?>
[/edit]
Generally when debugging mysql the following is how to do it.
<?php
$link = mysql_connect("localhost", "uname", "pword") or die('error 1<hr>'.mysql_error());
mysql_select_db("dbname", $link) or die('error 2<hr>'.mysql_error());
$result = mysql_query("SELECT ID FROM tbl_sellers", $link) or die('error 3<hr>'.mysql_error());
$num_rows = mysql_num_rows($result);
echo "$num_rows Rows\n";
?>
Try replacing your first script with the following.
<?
begin_block('Donate');
echo '<BR><BR><CENTER>This would need to contain your donation code, or something. maybe even a paypal link</CENTER><BR><BR>';
echo '<a href="member.php?mid='.$row['mid'].'">$row[login]</a>';
end_block();
?>
Also don't forget to include the api file.
header(); works fine, though not always.. i found this little treasure on the web.. it's better to use..
$url = "whereto.php"; // target of the redirect
$delay = "0"; // seconds of delay
echo '<meta http-equiv="refresh" content="'.$delay.';url='.$url.'">';
die();just put this in place of
header('Location: nextPage.php');
exit;
Also if you want to delay the header you can use the following.
$delay=2; //seconds
sleep($delay);
header('Location: nextPage.php');
//no html output before the header function
exit;
And in addition the header function is always much faster providing you use the exit; line. This is because the user doesn't need to downloading any content to be redirected where as the html method an entire page would need to be transfered. Also note that the meta redirect is not compatible with all browsers unlike the header function.
I have a great project and the code is done but now I need a big computer. The specs are as follows
Ram: 32GB
CPU: Whatever GHz
Harddrive: 8TB
Video: 256MB
etc. but Does anybody know when the technology will be available to have 32GB of ram with a price >$4000 AUD?
my problem is i dont have my own webserver so im trying to make an mp3 upload form.
Then you will be in for a real treat when you get a localhost server on your own computer. I would suggest downloading xampp 1.7.0 and install it to your computer then you should be able to run your script on your own computer. Also when installing it, be sure to install it at C:/xampp. Also make sure you choose to download the older version 1.7.0 as later versions are a bit buggy. With that installed, just copy and past your files into C:/xampp/htdocs and you can view them at http://localhost/. Enjoy.
The linked thread still barfs...
Same here and when I tried to post pi to 10000 digits it also said the server was out of memory. Annoying error.
I'm not sure about directly creating this script from scratch but perhaps there might be an api that you can use. So try and google for a webpage screen capture api.
<?php //connect ur dabase. $user = "username"; $pass = "pass" if ($_POST["username"] != $user && $_POST["pass"] != $pass ) { ?> <form method="post" action="index.php" > Username: <input type="text" name="username" /> <br/> Password: <input type="text" name="pass" /> <br/> <input type="submit" value="login" /> <?php } else { $select=mysql_query("select * from tablename where username=$user and password=$pass"); $count=mysql_num_rows($select); if($count==1) { //redirect page header('Location: http://www.example.com/'); exit; }else { echo "login failed"; } } ?>
Just keep in mind there is a T_if error there and a column ( ; ) will need adding on line 4.
When I first came here I asked how do I make a 3D human animator in c++ and I had very limited knowledge in c++ (didn't even know how to use variables). Yea, like one of the homework help questions except it wasn't homework (a self project). But the old times have changed and now I'm the one helping out.
The best way to have a short and easy to remember password is by having a password like the following ¢£¤¥¦§
or even the whole ascii table like the following
!"#
$%&'()*+,-./0123
456789:;<=>?@ABC
DEFGHIJKLMNOPQRS
TUVWXYZ[\]^_`abc
defghijklmnopqrs
tuvwxyz{|}~€‚ƒ
„…†‡ˆ‰Š‹ŒŽ‘’“
”•–—˜™š›œžŸ ¡¢£
¤¥¦§¨©ª«¬®¯°±²³
´µ¶·¸¹º»¼½¾¿ÀÁÂÃ
ÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓ
ÔÕÖרÙÚÛÜÝÞßàáâã
äåæçèéêëìíîïðñòó
ôõö÷øùúûüýþÿ
Who has a password like the above? Now that's the uncrackable. But as for a side note, has any site made an alternative to passwords because I heard there was a debate if passwords should be depreciated but obviously never went ahead. (No reply expected) I myself am developing an alternative system where you click colors to make your password as then it can never be weak. Also have you heard of passwords like the following
qwerty
itunes!
internet
mycomputer
c++rox
c++rox!
A list of simple passwords. I wonder if anybody has made a list like that because just like calculating pi anybody could spend half their life writing out possible passwords. But yea, I've heard of some of the passwords people use and makes me wonder why do they bother using a password.
Perhaps the following code would be of some use to you.
<?php
//no html/browser output before this function
header('Location: http://www.example.com/');
exit;
//...
This is a hard question which I paid good money to solve. You need to download the library(s) source (eg the GD Source) then upload the source code to your server. After that you need to compile the source into the webserver via command line and when your finished that you then restart or start apache. That's the basic concept but I have no idea on how to compile the source.
I think the reason why 0 is not isset is because the binary value of zero is 00000000. So any variable/array with the binary value 00000000 is said to be not isset. That is why zero is unset.
As a test you can try the following but could you mention what version of php you are using and if possible mention the effected php.ini settings.
ini_set('memory_limit','8000M');
ini_set('max_execution_time','102400');
ini_set('upload_max_filesize','7500M');
ini_set('file_uploads','1');
Also what do the errors say?
50MB!!
You should have mentioned that in the first place. Factoring in that you should place at the top of your page the following if your webhost doesn't mind big uploads.
ini_set('memory_limit','80M');
ini_set('max_execution_time','512');
ini_set('upload_max_filesize','75M');
ini_set('file_uploads','75M');
Also note that I added a line.
If you mean to redirect to another page then that will start to get complex. You would need to gather all of the form variables into a javascript array (or id's eg getElementById) then submit that array as an ajax request to a php page and use javascript to redirect to another page.
Hi,
I tried your concept, but i am stuck.
When i click the button I want to invoke another PHP script, How do i do that?
Thankyou.
Does anyone have issue with PHP version 5.1.3. it is crap and causes cpanel and other php software issues, i cann't get the latest xammp becacuse of it. Does anyone know when is the next release to fix these problems is coming out?
I agree. A few weeks ago I was hoping a topic like this could be pinned to the php forum making users aware of the incompatibility of php 5.1.3 as well as some later versions. Even mediawiki doesn't work on the latest 6 releases due to many bugs and incompatible oop changes. The developers say these oop changes are for the better but when it comes to compatibility - in the short term I don't think so.
With the following:
ini_set('memory_limit','64M');
ini_set('max_execution_time','256');
ini_set('upload_max_filesize','60M');
I think what your looking for is the empty() function Below is an example.
<?php
$arr=array('','a',0,NULL);
echo '//empty<br>';
$i=1;
foreach ($arr AS $val) {
if (empty($val) {
echo $i.' passed<br>'; }
$i++;
}
echo '//isset<br>';
$i=1;
foreach ($arr AS $vals) {
if (isset($vals)) {
echo $i.' passed<br>'; }
$i++;
}
[link]http://php.net/manual/en/function.isset.php[/link]
Clearly states that "isset — Determine if a variable is set and is not NULL"?
I have been trying to use isset() to check values for NULL and it still appears yet when I use != NULL then it works. I think the fine line is in various instances but if anyone can confirm my conclusions:
1. $variable = "" > value SET
2. $variable = "a" > value SET
3. no definition > value NOT SET
4. $variable = 0 > value NOT SET
5. $variable = NULL > value NOT SETany other examples?
Inparticular the 1. and 4. should be noted as I thought 1. would be NOT SET and 4. should be SET but it seems they are not through testing. Anyone confirm these as they dont seem logical to me?Thanks, Regards X
PS: If anyone has anything else to add go ahead.
This is not a PHP function. It is likely that you have an included file or code somewhere which defines this.
Indeed because if you go into the official documentation and manually put the function into the url a 404 comes up and when searching the official documentation it does not appear. /manual/en/function.tabs.php
Try your code without including any files and I bet the function will not exist.
I would suggest the following:
$zone=array('id'=>array(),'name'=>array());
while ($row=mysql_fetch_assoc($result)) {
$zone['id'][]=$row['zone_id'];
$zone['name'][]=$row['zone_name'];
}
//first index
echo $zone['id'][0];
echo $zone['name'][0];
//second index
echo $zone['id'][1];
echo $zone['name'][1];
How be sure that not much data is being stored in the array (>1MB) as you can make your script run out of memory.
I believe that they deserve to be rated highly.
Not always. Just Host was rated as the Number 1 Australian webhost and I would rate them as somewhere near the bottom. Sometimes the ratings are done by the webhost meaning the ratings are not always accurate.
It is possible to use no submit buttons and instead just have a regular button <input type="button"
and use a javascript function onclick to submit the two forms. An example is as follows.
<script>
function sender() {
document.forms["form1"].submit();
document.forms["form2"].submit();
return true;
}
</script>
<form id="form1">
<input type="text" value="test" name="test1">
</form>
<form id="form2">
<input type="text" value="test" name="test2">
</form>
<input type="button" onclick=javascript:sender()>
Double post and no code tags. I wonder what the the mods will think of that. But as the the solution - replace your while loop with the following.
while($noticia = mysql_fetch_assoc($result))
{
if($bgcolor=='#f1f1f1'){$bgcolor='#ffffff';}
else{$bgcolor='#f1f1f1';}
echo "<tr >";
echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$noticia['id'].'</font></td>';
echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$noticia['name'].'</font></td>';
echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$noticia['class'].'</font></td>';
echo "<td align=left bgcolor=$bgcolor id='title'> <font face='Verdana' size='2'>".$noticia['mark'].'</font></td>';
echo "</tr>";
}
I prefer to make my own so that way it is guaranteed to be secure and with all the features I need. And the process of making the template is fun too. But if I ever need to scratch out a quick cms then I would use mediawiki with custom extensions.
Note to mods: This is in the php section as the question is mainly directed to the php gurus.
I have been reading on some rather old news and discovered that the Secure Hash Algorithm (SHA1) has been cracked. Does anybody know where I can download a copy of this cracking software and possibly its source as I myself have been trying to crack SHA1 with some good luck so far.
Now I know most of the viewers will say it is impossible to crack any hashing algorithm but when you read it's code SHA1 is not that secure. It still contains the original data in number form unlike some other algorithms. But I will let you express your opinions as I have some c++ proof on how to crack the first layer of SHA1 but want to see how that group cracked the whole thing. As for the question, where do I find that SHA1 cracker?
I just noticed you changed your custom user title, cwarn and I was reminded that I never replied to this thread. Still really enjoy the show though I don't own any of the DVDs (I watched through the series on TV Land about 6 years ago). Richard Dean Anderson showed up for one of the McGruber bits on SNL. I hadn't seen him in a while (I'm not into Stargate) so to me he aged quite a bit.
To save some debates when I was referring to Macgyver in this thread I was referring to the movie character and NOT myself.
Is this not giving you an error :
"stream << hex << number;" ?Make it stream <<std::hex << number; "
>> outputs a bunch of numbers
What what do you mean? In hex, just numbers could represent
some decimal numbers as well.
Ow, the std::hex was what I was missing and surprisingly I didn't get any errors about that. Thanks for that - rep points added as your a genius.
Problem *Solved*
I just tried your function and it only outputs a bunch of numbers. Below is an example of what I'm doing.
#include<iostream>
#include <sstream>
#include <string>
#define rotateleft(x,n) ((x<<n) | (x>>(32-n)))
#define rotateright(x,n) ((x>>n) | (x<<(32-n)))
typedef size_t Type;
std::string hex(const Type& number){
std::stringstream stream;
stream << hex << number;
return stream.str();
}
std::string SHA1(unsigned char * str1)
{
int i;
unsigned long int h0,h1,h2,h3,h4,a,b,c,d,e,f,k,temp;
h0 = 0x67452301;
h1 = 0xEFCDAB89;
h2 = 0x98BADCFE;
h3 = 0x10325476;
h4 = 0xC3D2E1F0;
unsigned char * str;
str = (unsigned char *)malloc(strlen((const char *)str1)+100);
strcpy((char *)str,(const char *)str1);
int current_length = strlen((const char *)str);
int original_length = current_length;
str[current_length] = 0x80;
str[current_length + 1] = '\0';
char ic = str[current_length];
current_length++;
int ib = current_length % 64;
if(ib<56)
ib = 56-ib;
else
ib = 120 - ib;
for(i=0;i < ib;i++)
{
str[current_length]=0x00;
current_length++;
}
str[current_length + 1]='\0';
for(i=0;i<6;i++)
{
str[current_length]=0x0;
current_length++;
}
str[current_length] = (original_length * 8) / 0x100 ;
current_length++;
str[current_length] = (original_length * 8) % 0x100;
current_length++;
str[current_length+i]='\0';
int number_of_chunks = current_length/64;
unsigned long int word[80];
for(i=0;i<number_of_chunks;i++)
{
for(int j=0;j<16;j++)
{
word[j] = str[i*64 + j*4 + 0] * 0x1000000 + str[i*64 + j*4 + 1] * 0x10000 + str[i*64 + j*4 + 2] * 0x100 + str[i*64 + j*4 + 3];
}
for(int j=16;j<80;j++)
{
word[j] = rotateleft((word[j-3] ^ word[j-8] ^ word[j-14] ^ word[j-16]),1);
}
a = h0;
b = h1;
c = h2;
d = h3;
e = h4;
for(int m=0;m<80;m++)
{
if(m<=19)
{
f = (b & …
hello crawn,
each page taking minimum 50sec. to load every time. but i have 2mbps fastness in server. it is also takingminimum 40sec to load each and every page. is there any options to avoid this problem?
It is because there are so many small translations that are being made. Try using the display function less often or less html code in the displayhtml function. The only other option would be to tweak the displayhtml function.
Hi and I am writing a small program but need to make a function that converts an integer to a hex. Below is an example of a similar function but need the result stored in a std::string variable.
printf("%x%x%x%x%x",h0, h1, h2, h3, h4);
Does anybody know how to create a hex() function which will do the same as the above except instead of printing the data it will store the data? I'm also using c++ and hoping this one will work in VC++.
Following a recipe which is Fried ice with some mixed soft-drinks and a little bit of fuzzes candy. That should bring some interesting results.
Your mysql connect is invalid if you are assigning a link. Try the following.
$link=mysql_connect(db_host, db_username, db_pass, true);
Also line 66 and 67 are invalid and should be as follows:
$qry="SELECT * FROM `Goodisonpark` WHERE `email`='$email' AND `password`='$pass' AND `email_activated`=1";
$result=mysql_query($qry) or die(mysql_error());
Is email_activated an integer field because if it is then the mysql query would be as follows.
mysql_query("SELECT * FROM `Goodisonpark` WHERE `email`='$email' AND `password`='$pass' AND `email_activated`=1");
I do this a lot as my website is scattered between two web servers and the easiest way is with curl and file_get_contents(). You can retrieve contents from a database using file_get_contents('http://example.com/sql.php?key=asldfkjasldkfj&column=23')
. Then it will return the contents of that mysql request and you can use the url parameters as part of the WHERE clause. On the other hand there is curl with allows you to do $_POST requests. This way you can send larger amounts of data and will be harder for people to tap into the database.
Your right about unlimited hosting. I signed up for justhost and although I get unlimited webspace and unlimited bandwidth I am very restricted on what content I can publish and how much traffic I can have. So people like that are just a rip off.
If you are after decent hosting and don't mind the occasional server maintenance (1 or 2 times a month) then Jumba has a wide range of plans suitable for a range of needs. The only trouble I have ever encountered with Jumba is being migrated to a new server twice. But that was to reduce serverload on their servers for better customer experience.
Also I will warn you now 1dollarhoster is a scam. It offers a lot of stuff (eg 200MB) for $1 but they don't allow you to have a domain name and they have virtually no support. IMO Jumba truly is the best.
Mods - Please do not snip links as it shows what plans are available for what prices as I have been on those plans and experienced them myself. :-)
I still use Netscape 7.2 to drive and receive my email and newsgroups.
I believe Opera can do that for you...