1

I have a custom script that has been working good untill I changed servers. the script is connecting to the database, but for some reason can't recognize if a user is logged in to wikimedia anymore.

Thought it would be a quick fix, but after reading through every line in this page it's not obvious what the problem is.

Users can still log in to wikimedia fine, but this custom script is reacting as though users are not logged in.

Any pointers would be great. Thanks for taking the time to look.

Page output is

"Please login to instructions.xxxxxx.com then you can submit your AD code"

<?php
$uid=$_COOKIE['zencuben_ovinstr_instr_UserID'];
$uname=$_COOKIE['zencuben_ovinstr_instr_UserName'];

$con = mysqli_connect("localhost","my_user","my_pass","my_db) or die("Some error occurred");

if(isset($_REQUEST['submit']))
{
if($_REQUEST['zid']){
        $code=$_REQUEST['zid'];
        $_script="<script src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
        <link rel='stylesheet' href='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css'>
        <script src='https://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js'></script>
        <link href='http://advertising.oxxmo.com/style/video-js.min.css' rel='stylesheet' type='text/css'>
        <script type='text/javascript' src='http://advertising.xxxxo.com/js/videojs-ie8.min.js'></script><!-- Exclude this if you do not need ie8 support -->
        <script type='text/javascript' src='http://advertising.oxxo.com/js/video.min.js'></script>
        <script>
        videojs.options.flash.swf = 'http://advertising.oxxx.com/images/video-js.swf';
        </script>
        <script language='JavaScript' src='http://advertising.xxxx.com/show-ad.php?zid=".$code."'></script>";
    }else{
        $_script=$_REQUEST['ccode'];
    }

if($uid!='')
{
$check="select * from `videos_ins` where `user_id`='".$uid."'";
$chk_query=mysqli_num_rows(mysqli_query($con, $check));
if($chk_query>0)
{
$strSQL = "update `videos_ins`  SET `video_code`='".addslashes($_script)."' where `user_id`='".$uid."'";
$ins_code=mysqli_query($con, $strSQL);
if($ins_code)
{
echo "<font color='green'><b>Your code for video is updated</b></font>";
}
else
{
echo "<font color='red'><b>Your code for video is not updated</b></font>";
}
}
else
{
$value = "user_id='".$uid."',
          user_name='".$uname."',
          video_code = '".addslashes($_script)."'";

$strSQL = "INSERT INTO `videos_ins`  SET ".$value."";
//echo "INSERT INTO `videos`  SET ".$value."";
$ins_code=mysqli_query($con, $strSQL);
if($ins_code)
{
echo "<font color='green'><b>Your code for video is added</b></font>";
}
else
{
echo "<font color='red'><b>Your code for video is not added</b></font>";
}
}
}
else
{
echo "<font color='green'><b>Please login to <a href='http://instructions.xxxx.com' target='_blank'>instructions.xxxx.com</a> then you can submit your AD code</b></font>";
}
}                   
?>
<?php
$check="select * from `videos_ins` where `user_id`='".$uid."'";
$chk_query=mysqli_fetch_array(mysqli_query($con, $check));
?>
<script type="text/javascript" src="http://xxxx.com/jq.js"></script>
<br>
<b>Enter Video code here</b><br /><br />
<!--<input type="radio" name="text_control" id="show_text" checked="checked">ZID<br>
<input type="radio" name="text_control" id="show_textarea">COMPLETE CODE<br><br>-->


<script>
$( "#show_text" ).click(function() {
    $( "#ccode" ).hide( 1000 );
    $( "#ccode" ).removeAttr('required','required');
    $( "#zid" ).attr('required','required');
    $( "#zid" ).show( "slow" );
});
$( "#show_textarea" ).click(function() {
    $( "#zid" ).hide( 1000 );
    $( "#zid" ).removeAttr('required','required');
    $( "#ccode" ).attr('required','required');
    $( "#ccode" ).show( "slow" );
});
 </script>
<form method="post" action="" enctype="multipart/form-data">

<input type="text" id="zid" name="zid" required="required" maxlength="10" placeholder="MAX 10 CHAR">
    <textarea id="ccode" name="ccode" style="display:none;" rows="9" cols="40"></textarea><br><br>
<input  type="submit" name="submit" value="Submit AD Code"/><br /><br /><br />

<font color="#00CC66"><b>Submitted AD code</b></font><br />
<textarea name="sv" rows="9" cols="40" spellcheck="false"><?=$chk_query['video_code']?></textarea>

</form>
maxhb
  • 8,554
  • 9
  • 29
  • 53
cam
  • 13
  • 5
  • I would suggest you to not post codes including any credentials, like db password or other things from security reasons, instead you can write `db_user` and `db_password` or just use `xxxxx` – Armen Feb 15 '16 at 06:28
  • @armen the credentials have been modified – cam Feb 15 '16 at 06:30
  • As i understood from your script your problem is that `$uid` is empty which is taken from `$uid=$_COOKIE['zencuben_ovinstr_instr_UserID'];` so it mean that cookies not passed to your php script. You have to check where `zencuben_ovinstr_instr_UserID` are set and change it to be set for your new domain – Armen Feb 15 '16 at 06:40
  • @armen I believe you are right. I think I need to change this line to check for a different cookie. Could you explain the line zencuben_ovinstr_instr... ? Zencuben is the old cpanel account, but what is ovinstr_instr ? – cam Feb 15 '16 at 06:53
  • Is it maybe database and database user? – cam Feb 15 '16 at 07:00
  • @armen fixed it by changing $uid=$_COOKIE['zencuben_ovinstr_instr_UserID']; to $uid=$_COOKIE['newval_ovinstr_instr_UserID']; thanks for your advice – cam Feb 15 '16 at 07:12

0 Answers0