Jump to content


Member Since 31 Jul 2007
Offline Last Active Oct 29 2015 08:23 PM

#1408038 Seeking friends for a "geek" team

Posted by premiso on 24 January 2013 - 09: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 - 07: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 - 08: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 - 06: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 - 08:20 PM



/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 - 06:25 PM

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


#1395234 Cookie + Protocols = Trouble

Posted by premiso on 26 November 2012 - 05: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 - 04:00 PM

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.


#1385790 Match And Against For Searching

Posted by premiso on 17 October 2012 - 03:00 PM

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 - 06: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 - 03:47 PM

"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 :)


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 - 03:44 PM

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 - 03:07 PM

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)
if (!mysql_query($sql,$con))
  die('Error: ' . mysql_error());

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

Should solve your problems here.

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 - 01:46 PM



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 11 October 2012 - 01:14 AM

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.