Jump to content


premiso

Member Since 30 Jul 2007
Offline Last Active Mar 26 2013 10:36 AM

#1408038 Seeking friends for a "geek" team

Posted by premiso on 24 January 2013 - 04:55 PM

I thought that was for premiso to have his virtual hell on earth?


Hell on earth? That is my HAVEN! 


#1407989 Seeking friends for a "geek" team

Posted by premiso on 24 January 2013 - 02:00 PM

 click on the links they post. Your eyes will implode, your brain will fry, you will go to hell. You have been warned!


Don't know what you are talking about. 


#1407568 Only print text from $variable before defined text string.

Posted by premiso on 22 January 2013 - 03:47 PM

$pos = strpos($description, 'I hate this part');

if ($pos !== false) {
    $firstpart = substr($description, 0, $pos);
}else {
    echo 'Section was not found';
}

echo $firstpart;

Using a mixture of substr and strpos


#1407525 Linux GUI for MySQL

Posted by premiso on 22 January 2013 - 01:16 PM

I use bash   :)

I know of http://sourceforge.n...ojects/mysqlcc/  which works decent. The workbench I just hated. The MySQLCC program was the best I found, but I still prefer to use the CLI. 


#1406186 Google Calendar Plug-In

Posted by premiso on 16 January 2013 - 03:20 PM

REALLY NO ONE?


STOP YELLING AT ME!

/me curls up in fetal position rocking back and forth mumbling nonsense. 


#1405621 Adding SMTP Auth. to PHP form to email..completely lost.

Posted by premiso on 14 January 2013 - 01:25 PM

I would suggest reading through a few tutorials, here is one to get you started:

http://www.tuxradar....ticalphp/15/5/2


#1395234 Cookie + Protocols = Trouble

Posted by premiso on 26 November 2012 - 12:14 PM

You would specify . instead of www.

setcookie('user', 'badie', time()+3600*60, '/', '.mydomain.com');

Which would make it valid for all subdomains. Just remember, when you destroy / unset a cookie you need to supply the same path / domain. 


#1386605 After 3 Fail Login Attemp User Block For 3Mins

Posted by premiso on 20 October 2012 - 11:00 AM

Welcome to the forums!

Let me greet you by saying, posting your code and then requesting us to add functionality to it rarely goes over well. What is better if posting the relevant sections of your code, and your attempts. If you need help with the logic of it, request that and we can point you in the right direction. If you want this done for you, I would suggest the freelance forums and offering some monetary value for the code.

Thanks!


#1385790 Match And Against For Searching

Posted by premiso on 17 October 2012 - 10:00 AM

Did you even read what I pasted?

If your query matches 50% or more of the rows it will return nothing. Simply adding the same row 10 times, will give you nothing. You have to change the data that is being searched by to be different in order to get results.


#1384566 How To Access And Use Base64 Please?

Posted by premiso on 11 October 2012 - 01:39 PM

must i add like this??


You do not HAVE to, I just wrote that there as a general demonstration, but by all means test it. Test it every which way you want that is how you learn!


#1384530 How Do I Change P Class Based On A Condition?

Posted by premiso on 11 October 2012 - 10:47 AM

"Short tags" are deprecated and shouldn't be used, they'll be out of the language entirely soon.


You may want to check your facts on that :)

http://www.php.net/m....short-open-tag

This directive also affected the shorthand <?= before PHP 5.4.0, which is identical to <? echo. Use of this shortcut required short_open_tag to be on. Since PHP 5.4.0, <?= is always available


What I think has been depreciated from the short tags, to my knowledge, is the opening <? which should be depreciated. I tend to use the <?= for .phtml type template files.


#1384528 Fetch Random Images From Database

Posted by premiso on 11 October 2012 - 10:44 AM

Where is the image being stored? On a file? How do you know the path / location to the image?

That code you have there, even the database image, does not hint to any such information. We will need to know that to assist you.


#1384515 Making Sure Usernames Are Not Duplicated

Posted by premiso on 11 October 2012 - 10:07 AM

Why not just set the column to be "unique" in MySQL? And the reason your code continues to add the user, is that you never kill the script, or set an else after checking the rows.

mysql_select_db("my_db", $con);
$result = mysql_query("SELECT username FROM members WHERE username = ' " . $username. " ' ");
$rows = mysql_num_rows($result);
if ($rows > 0)
         echo "Sorry, that username is already in use";
}else {
/* Write to MySQL database */

$sql="INSERT INTO members (username, hash, firstname, surname, email, address1, address2, town, county, postcode, birthday, birthmonth, birthyear, paypalemail, terms)
VALUES
('$_POST[username]','$hash','$_POST[firstname]','$_POST[surname]','$_POST[email]','$_POST[address1]','$_POST[address2]','$_POST[town]','$_POST[county]','$_POST[postcode]','$_POST[birthday]','$_POST[birthmonth]','$_POST[birthyear]','$_POST[paypalemail]','$_POST[terms]')";
if (!mysql_query($sql,$con))
  {
  die('Error: ' . mysql_error());
  }

  /* Redirect visitor to the thank you page */
header('Location: thanks.htm');
exit();
}

Should solve your problems here.

Edit:
As a side note, I would look into SQL Injection and how to prevent it. Just a side note :)


#1384497 Image Conversion To Jpg? (No Imagemagick)

Posted by premiso on 11 October 2012 - 08:46 AM

tl;dr

Summary:

That said, the "Let me google this for you" is actually funny. :-)


Thanks, I try to be a comedian now and again. Glad it worked!


#1384370 Simple Php\mysql Issue, Not Increasing Columns.

Posted by premiso on 10 October 2012 - 08:14 PM

Ok, so first up, try this query instead:

mysql_query(" UPDATE Reactions SET AWESOME=AWESOME+1, Used_IPs='$Used_IPs' WHERE Link='$Link' ") or die (mysql_error());

This will be way better than fetching each item and incrementing it in PHP and way less code.

Second up:
$Reaction = mysql_real_escape_string(htmlspecialchars($_GET['Reaction']));

Why are you doing that to reaction and using it for a check? I do not even see you using $_GET['Reaction'] in a query. I can understand the specialchars, but that should only be applied when you are attempting to display reaction, not just whenever or just because.




Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com