Help with php script needed

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • zalka
    Confirmed User
    • Nov 2006
    • 168

    #1

    Help with php script needed

    Hi i have just installed a free banner exchange script but i have a problem, on testing i find that when you attempt to join the exchange it will not except your email address no matter what you type in.

    <a href="http://www.freegamesmachine.com/exchange20/index.php">index</a>

    this is the php.

    <?
    $file_rev="041306";
    ////////////////////////////////////////////////////////
    // phpBannerExchange //
    // by: Darkrose //
    // ([email protected]) //
    // //
    // You can redistribute this software under the terms //
    // of the GNU General Public License as published by //
    // the Free Software Foundation; either version 2 of //
    // the License, or (at your option) any later //
    // version. //
    // //
    // You should have received a copy of the GNU General //
    // Public License along with this program; if not, //
    // write to the Free Software Foundation, Inc., 59 //
    // Temple Place, Suite 330, Boston, MA 02111-1307 USA //
    // //
    // Copyright 2004 by eschew.net Productions. //
    // Please keep this copyright information intact. //
    ////////////////////////////////////////////////////////

    include("config.php");
    include("css.php");
    include("lang/errors.php");
    include("lang/common.php");
    if($use_gzhandler==1){
    ob_start("ob_gzhandler");
    }

    $db=mysql_connect("$dbhost","$dbuser","$dbpass");
    mysql_select_db($dbname,$db);

    session_start();
    session_register(ref);

    require_once('lib/template_class.php');
    include("config.php");
    include("lang/common.php");
    $session=session_id();

    $name=$_REQUEST['name'];
    $email=$_REQUEST['email'];
    $login=$_REQUEST['login'];
    $pass=$_REQUEST['pass'];
    $pass2=$_REQUEST['pass2'];
    $newsletter=$_REQUEST['newsletter'];
    $targeturl=$_REQUEST['targeturl'];
    $category=$_REQUEST['category'];
    $bannerurl=$_REQUEST['bannerurl'];
    $coupon=$_REQUEST['coupon'];
    $ref=$_SESSION['ref'];

    if (get_magic_quotes_gpc()) {
    $name = stripslashes($name);
    $email = stripslashes($email);
    $login=stripslashes($login);
    $pass=stripslashes($pass);
    $pass2=stripslashes($pass2);
    $newsletter=stripslashes($newsletter);
    $targeturl=stripslashes($targeturl);
    $category=stripslashes($category);
    $bannerurl=stripslashes($bannerurl);
    $coupon=stripslashes($coupon);
    $ref=stripslashes($ref);
    }

    $name=mysql_real_escape_string($name);
    $email=mysql_real_escape_string($email);
    $login=mysql_real_escape_string($login);
    $pass=mysql_real_escape_string($pass);
    $pass2=mysql_real_escape_string($pass2);
    $newsletter=mysql_real_escape_string($newsletter);
    $targeturl=mysql_real_escape_string($targeturl);
    $category=mysql_real_escape_string($category);
    $bannerurl=mysql_real_escape_string($bannerurl);
    $coupon=mysql_real_escape_string($coupon);
    $ref=mysql_real_escape_string($ref);

    $err=0;

    if($_REQUEST['submit']){

    // check to see if the coupon is valid.
    if($_REQUEST[coupon]){
    $promo=mysql_query("select * from bannerpromos where promocode='$coupon' limit 1");
    $num=@mysql_num_rows($promo);
    $coup_array=@mysql_fetch_array($promo);

    // check to make sure the coupon is for 'mass credits'
    // because that's the only coupon type that will work with
    // a new sign up!

    $promotype=$coup_array[promotype];
    if(!$num or $promotype != '1'){
    $err = 1;
    $error_html .= "$LANG_err_nocoupon<br><br>\n";
    }
    }

    // Validate the Name
    if(strlen(trim($name)) < 2){
    $err = 1;
    $error_html .= "$LANG_err_nametooshort.<br><br>\n";
    }

    if(strlen(trim($name)) > 100){
    $err = 1;
    $error_html .= "$LANG_err_nametoolong.<br><br>\n";
    }

    // Validate the Login
    if(strlen(trim($login)) > 20){
    $err = 1;
    $error_html .= "$LANG_err_loginshort.<br><br>\n";
    }

    if(strlen(trim($login)) < 2){
    $err = 1;
    $error_html .= "$LANG_err_loginlong.<br><br>\n";
    }


    $check_login=mysql_query("select * from banneruser where login = '$login'");
    $get_login=@mysql_fetch_array($check_login);
    $exists=$get_login[login];
    $existsmail=$get_login[email];
    if($exists == $login){
    $err = 1;
    $error_html .= "$LANG_err_logininuse!<br><br>\n";
    }

    if($emailexists == $email){
    $err = 1;
    $error_html .= "$LANG_err_emailinuse!<br><br>\n";
    }

    if($allow_upload=='N'){
    if($imagestuff = @GetImageSize($bannerurl)){
    $imagewidth = $imagestuff[0];
    $imageheight = $imagestuff[1];

    // Validate the Banner Width and Height
    if($imagewidth != $bannerwidth){
    $err=1;
    $error_html .= "$LANG_err_badwidth<br><br>\n";
    }
    if($imageheight != $bannerheight){
    $err=1;
    $error_html .= "$LANG_err_badheight<br><br>\n";
    }
    }else{
    $err = 1;
    $error_html .= "$LANG_err_badimage<br><br>\n";
    }
    }

    // Validate the Email Address
    if (!preg_match('/^[A-z0-9_\-]+\@(A-z0-9_-]+\.)+[A-z]{2,4}$/', $email)){
    $err = 1;
    $error_html .= "$LANG_err_email.<br><br>\n";
    }

    // Validate the Password
    if($pass != $pass2){
    $err = 1;
    $error_html .= "$LANG_err_passmismatch\n";
    }
    if(strlen(trim($pass)) < 4){
    $err = 1;
    $error_html .= "$LANG_err_passshort.<br><br>\n";
    }

    if($err=="1"){
    $error="<br><b>$LANG_rejected</b></font><blockquote>".$error_html."</blockquote>\n [<a href=\"javascriptstory.go(-1)\">$LANG_back</a>]";

    $page = new Page('template/admin_error.php');
    $page->replace_tags(array(
    'css' => "$css",
    'session' => "$session",
    'baseurl' => "$baseurl",
    'title' => "$exchangename - $LANG_signupwords",
    'shorttitle' => "$LANG_signconf_title",
    'error' => "$error",
    'menu' => 'common_menuing.php',
    'footer' => 'footer.php'));

    $page->output();

    } else {
    if($usemd5 == 'Y'){
    $encpass = md5($pass);
    $insert=mysql_query("insert into banneruser values ('','$login','$encpass','$name','$email','$newslet ter')",$db);
    }else{
    $insert=mysql_query("insert into banneruser values ('','$login','$pass','$name','$email','$newsletter ')",$db);
    }
    $timestamp=time();
    $get_id=mysql_query("select * from banneruser where login='$login'");
    $get_rows=mysql_fetch_array($get_id);
    $insert_stats=mysql_query("insert into bannerstats values ('$get_rows[id]','$category','0','$startcredits','0','0','0','0', '0','','$timestamp')",$db);
    if($allow_upload=='N'){
    $insert_banner=mysql_query("insert into bannerurls values ('','$bannerurl','$targeturl','0','0','$get_rows[id]','0')");
    }
    if($ref =! '0' or ''){
    $insert_banner=mysql_query("insert into bannerrefs values ('','$ref','$get_rows[id]','0')");
    }
    if($_REQUEST[coupon]){
    $newcredits=$coup_array[promocredits];
    $promoid=$coup_array[promoid];
    $query=mysql_query("update bannerstats set credits=credits+'$newcredits' where uid='$get_rows[id]'");
    $logupdate=mysql_query("insert into bannerpromologs values('','$get_rows[id]','$promoid','$timestamp')");
    $coupon_msg=$LANG_coupon_added;
    }

    if($allow_upload=="Y"){
    $uploading=$LANG_signup_uploadmsg;
    }else{
    $uploading="";
    }
    $page = new Page('template/signconf.php');
    $page->replace_tags(array(
    'session' => "$session",
    'css' => "$css",
    'baseurl' => "$baseurl",
    'title' => "$exchangename - $LANG_signconf_title",
    'shorttitle' => "$LANG_signconf_title",
    'thanks' => "$LANG_signup_thanks",
    'info' => "$LANG_signupinfo",
    'uploading' => "$uploading",
    'coup_msg' => "$coupon_msg",
    'menu' => 'common_menuing.php',
    'footer' => 'footer.php'));

    $page->output();

    session_destroy();
    if($sendemail == "Y"){
    include("template/mail/mail_newadmin.php");
    mail($ownermail,$subject,$content,"From: $email");
    }else{
    }
    include("template/mail/mail_newuser.php");
    mail($email,$usrsubject,$usrcontent,"From: $ownermail");
    }
    }

    Any ideas im lost.

    Thanks

    Dump Your Site Here
    Sexyads 50/50 Revshare TotemCash 50/50 Revshare
    $40 per signup Adultdating Dollars
    Moocash.com Hottest Amateur Cam Action

  • shwsrvcs
    Confirmed User
    • Aug 2006
    • 600

    #2
    contact the person that wrote the script listed at the top of the code.
    MUTTCASH! Start Earning today! www.muttcash.com

    Comment

    • zalka
      Confirmed User
      • Nov 2006
      • 168

      #3
      I tried but he dosent give any help anymore, he even closed his help forums because of spamming so im stuck.


      Dump Your Site Here
      Sexyads 50/50 Revshare TotemCash 50/50 Revshare
      $40 per signup Adultdating Dollars
      Moocash.com Hottest Amateur Cam Action

      Comment

      • rowan
        Too lazy to set a custom title
        • Mar 2002
        • 17393

        #4
        Originally posted by zalka
        // Validate the Email Address
        if (!preg_match('/^[A-z0-9_\-]+\@(A-z0-9_-]+\.)+[A-z]{2,4}$/', $email)){
        $err = 1;
        $error_html .= "$LANG_err_email.<br><br>\n";
        }
        Commenting out (add "//" minus the quotes to the very start) these lines should stop the error, but it does mean that someone can enter complete garbage and it will be accepted.

        Perhaps someone who is more familiar with regular expressions can debug the above.

        Comment

        • zalka
          Confirmed User
          • Nov 2006
          • 168

          #5
          Thanks but i need a genuine email address entered, shouldnt there be a "else" statement somewhere after the code.

          im stumped

          Dump Your Site Here
          Sexyads 50/50 Revshare TotemCash 50/50 Revshare
          $40 per signup Adultdating Dollars
          Moocash.com Hottest Amateur Cam Action

          Comment

          • zalka
            Confirmed User
            • Nov 2006
            • 168

            #6
            Ive found an update code

            // Validate the Email Address
            $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2, 4})$";
            if (!eregi($regexp, $email)){
            $err = 1;
            $error_html .= "$LANG_err_email.<br><br>\n";
            }

            but it still gives me an email error

            Dump Your Site Here
            Sexyads 50/50 Revshare TotemCash 50/50 Revshare
            $40 per signup Adultdating Dollars
            Moocash.com Hottest Amateur Cam Action

            Comment

            • Megafoo
              Confirmed User
              • Sep 2007
              • 232

              #7
              did you make sure you uploaded the script in binary mode?
              ICQ number: 497388922

              Comment

              • zalka
                Confirmed User
                • Nov 2006
                • 168

                #8
                Yes it was uploaded in binary mode.

                Dump Your Site Here
                Sexyads 50/50 Revshare TotemCash 50/50 Revshare
                $40 per signup Adultdating Dollars
                Moocash.com Hottest Amateur Cam Action

                Comment

                • rowan
                  Too lazy to set a custom title
                  • Mar 2002
                  • 17393

                  #9
                  Binary mode shouldn't make any difference with a clear text PHP script like the above. I think it's the regex that is the key, but I don't know enough about them to be able to offer you a solution. Hopefully someone else can.

                  Comment

                  • donborno
                    Confirmed User
                    • Jan 2007
                    • 374

                    #10
                    Try
                    Code:
                    $regexp = "^([_a-z0-9-]+)(\.[_a-z0-9-]+)*@([a-z0-9-]+)(\.[a-z0-9-]+)*(\.[a-z]{2,4})$";
                    Note that I removed the space between 2, and 4. Works fine in Perl.

                    Comment

                    • zalka
                      Confirmed User
                      • Nov 2006
                      • 168

                      #11
                      This is the message i get whin i attempt to signup this is my owm email address or any other email address i type in.


                      The system was unable to validate your email address because it contains special characters. Please contact the administrator for assistance. (You entered [email protected])..


                      Im stumped.

                      Dump Your Site Here
                      Sexyads 50/50 Revshare TotemCash 50/50 Revshare
                      $40 per signup Adultdating Dollars
                      Moocash.com Hottest Amateur Cam Action

                      Comment

                      • donborno
                        Confirmed User
                        • Jan 2007
                        • 374

                        #12
                        Why don't you simply do what I said? I now tried it in PHP too and it's working fine. Just remove that space.

                        Comment

                        • zalka
                          Confirmed User
                          • Nov 2006
                          • 168

                          #13
                          Donborno yes you got it works a treat thanks for your help in this. And to everyone else, thanks alot.


                          Dump Your Site Here
                          Sexyads 50/50 Revshare TotemCash 50/50 Revshare
                          $40 per signup Adultdating Dollars
                          Moocash.com Hottest Amateur Cam Action

                          Comment

                          Working...